java.io.Closeable, java.lang.AutoCloseable@Private public class KeyProviderCryptoExtension extends KeyProviderExtension<KeyProviderCryptoExtension.CryptoExtension>
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
KeyProviderCryptoExtension.CryptoExtension |
CryptoExtension is a type of Extension that exposes methods to generate
EncryptedKeys and to decrypt the same.
|
static class |
KeyProviderCryptoExtension.EncryptedKeyVersion |
An encrypted encryption key (EEK) and related information.
|
KeyProviderExtension.ExtensionKeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
EEK |
Designates an encrypted encryption key, or EEK.
|
static java.lang.String |
EK |
Designates a decrypted encrypted encryption key, that is, an encryption key
(EK).
|
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME, JCEKS_KEY_SERIAL_FILTER, JCEKS_KEY_SERIALFILTER_DEFAULT| Modifier | Constructor | Description |
|---|---|---|
protected |
KeyProviderCryptoExtension(KeyProvider keyProvider,
KeyProviderCryptoExtension.CryptoExtension extension) |
This constructor is to be used by sub classes that provide
delegating/proxying functionality to the
KeyProviderCryptoExtension |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Can be used by implementing classes to close any resources
that require closing
|
static KeyProviderCryptoExtension |
createKeyProviderCryptoExtension(KeyProvider keyProvider) |
Creates a
KeyProviderCryptoExtension using a given
KeyProvider. |
KeyProvider.KeyVersion |
decryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion encryptedKey) |
Decrypts an encrypted byte[] key material using the given a key version
name and initialization vector.
|
void |
drain(java.lang.String keyName) |
Calls
KeyProviderCryptoExtension.CryptoExtension.drain(String) for the given key name on the
underlying KeyProviderCryptoExtension.CryptoExtension. |
KeyProviderCryptoExtension.EncryptedKeyVersion |
generateEncryptedKey(java.lang.String encryptionKeyName) |
Generates a key material and encrypts it using the given key version name
and initialization vector.
|
KeyProviderCryptoExtension.EncryptedKeyVersion |
reencryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion ekv) |
Re-encrypts an encrypted key version, using its initialization vector
and key material, but with the latest key version name of its key name
in the key provider.
|
void |
reencryptEncryptedKeys(java.util.List<KeyProviderCryptoExtension.EncryptedKeyVersion> ekvs) |
Batched version of
reencryptEncryptedKey(EncryptedKeyVersion). |
void |
warmUpEncryptedKeys(java.lang.String... keyNames) |
Notifies the Underlying CryptoExtension implementation to warm up any
implementation specific caches for the specified KeyVersions
|
createKey, createKey, deleteKey, flush, getCurrentKey, getExtension, getKeyProvider, getKeys, getKeysMetadata, getKeyVersion, getKeyVersions, getMetadata, invalidateCache, isTransient, rollNewVersion, rollNewVersion, toStringbuildVersionName, findProvider, generateKey, getBaseName, getConf, needsPassword, noPasswordError, noPasswordWarning, optionspublic static final java.lang.String EEK
public static final java.lang.String EK
protected KeyProviderCryptoExtension(KeyProvider keyProvider, KeyProviderCryptoExtension.CryptoExtension extension)
KeyProviderCryptoExtensionkeyProvider - key provider.extension - crypto extension.public void warmUpEncryptedKeys(java.lang.String... keyNames)
throws java.io.IOException
keyNames - Arrays of key Namesjava.io.IOException - raised on errors performing I/O.public KeyProviderCryptoExtension.EncryptedKeyVersion generateEncryptedKey(java.lang.String encryptionKeyName) throws java.io.IOException, java.security.GeneralSecurityException
KeyVersion material and is encrypted using the
same cipher.
NOTE: The generated key is not stored by the KeyProvider
encryptionKeyName - The latest KeyVersion of this key's material will
be encrypted.java.io.IOException - thrown if the key material could not be generatedjava.security.GeneralSecurityException - thrown if the key material could not be
encrypted because of a cryptographic issue.public KeyProvider.KeyVersion decryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion encryptedKey) throws java.io.IOException, java.security.GeneralSecurityException
encryptedKey - contains keyVersionName and IV to decrypt the encrypted
key materialjava.io.IOException - thrown if the key material could not be decryptedjava.security.GeneralSecurityException - thrown if the key material could not be
decrypted because of a cryptographic issue.public KeyProviderCryptoExtension.EncryptedKeyVersion reencryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion ekv) throws java.io.IOException, java.security.GeneralSecurityException
If the latest key version name in the provider is the same as the one encrypted the passed-in encrypted key version, the same encrypted key version is returned.
NOTE: The generated key is not stored by the KeyProvider
ekv - The EncryptedKeyVersion containing keyVersionName and IV.java.io.IOException - If the key material could not be re-encryptedjava.security.GeneralSecurityException - If the key material could not be
re-encrypted because of a cryptographic issue.public void drain(java.lang.String keyName)
KeyProviderCryptoExtension.CryptoExtension.drain(String) for the given key name on the
underlying KeyProviderCryptoExtension.CryptoExtension.keyName - key name.public void reencryptEncryptedKeys(java.util.List<KeyProviderCryptoExtension.EncryptedKeyVersion> ekvs) throws java.io.IOException, java.security.GeneralSecurityException
reencryptEncryptedKey(EncryptedKeyVersion).
For each encrypted key version, re-encrypts an encrypted key version, using its initialization vector and key material, but with the latest key version name of its key name. If the latest key version name in the provider is the same as the one encrypted the passed-in encrypted key version, the same encrypted key version is returned.
NOTE: The generated key is not stored by the KeyProvider
ekvs - List containing the EncryptedKeyVersion'sjava.io.IOException - If any EncryptedKeyVersion could not be re-encryptedjava.security.GeneralSecurityException - If any EncryptedKeyVersion could not be
re-encrypted because of a cryptographic issue.public static KeyProviderCryptoExtension createKeyProviderCryptoExtension(KeyProvider keyProvider)
KeyProviderCryptoExtension using a given
KeyProvider.
If the given KeyProvider implements the
KeyProviderCryptoExtension.CryptoExtension interface the KeyProvider itself
will provide the extension functionality.
If the given KeyProvider implements the
KeyProviderExtension interface and the KeyProvider being
extended by the KeyProvider implements the
KeyProviderCryptoExtension.CryptoExtension interface, the KeyProvider being extended will
provide the extension functionality. Otherwise, a default extension
implementation will be used.
keyProvider - KeyProvider to use to create the
KeyProviderCryptoExtension extension.KeyProviderCryptoExtension instance using the
given KeyProvider.public void close()
throws java.io.IOException
KeyProviderclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class KeyProviderjava.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.