java.io.Closeable, java.lang.AutoCloseable, KeyProviderCryptoExtension.CryptoExtension, KeyProviderDelegationTokenExtension.DelegationTokenExtension, KeyProviderExtension.Extension, DelegationTokenIssuerpublic class LoadBalancingKMSClientProvider extends KeyProvider implements KeyProviderCryptoExtension.CryptoExtension, KeyProviderDelegationTokenExtension.DelegationTokenExtension
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME, JCEKS_KEY_SERIAL_FILTER, JCEKS_KEY_SERIALFILTER_DEFAULTTOKEN_LOG| Constructor | Description |
|---|---|
LoadBalancingKMSClientProvider(java.net.URI providerUri,
KMSClientProvider[] providers,
Configuration conf) |
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.Void |
cancelDelegationToken(Token<?> token) |
Cancels the given token.
|
void |
close() |
Can be used by implementing classes to close any resources
that require closing
|
KeyProvider.KeyVersion |
createKey(java.lang.String name,
byte[] material,
KeyProvider.Options options) |
Create a new key.
|
KeyProvider.KeyVersion |
createKey(java.lang.String name,
KeyProvider.Options options) |
Create a new key generating the material for it.
|
KeyProvider.KeyVersion |
decryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion encryptedKeyVersion) |
Decrypts an encrypted byte[] key material using the given key version
name and initialization vector.
|
void |
deleteKey(java.lang.String name) |
Delete the given key.
|
void |
drain(java.lang.String keyName) |
Drains the Queue for the provided key.
|
void |
flush() |
Ensures that any changes to the keys are written to persistent store.
|
KeyProviderCryptoExtension.EncryptedKeyVersion |
generateEncryptedKey(java.lang.String encryptionKeyName) |
Generates a key material and encrypts it using the given key name.
|
java.lang.String |
getCanonicalServiceName() |
The service name used as the alias for the token in the credential
token map.
|
KeyProvider.KeyVersion |
getCurrentKey(java.lang.String name) |
Get the current version of the key, which should be used for encrypting new
data.
|
Token<?> |
getDelegationToken(java.lang.String renewer) |
Unconditionally get a new token with the optional renewer.
|
java.util.List<java.lang.String> |
getKeys() |
Get the key names for all keys.
|
KeyProvider.Metadata[] |
getKeysMetadata(java.lang.String... names) |
Get key metadata in bulk.
|
KeyProvider.KeyVersion |
getKeyVersion(java.lang.String versionName) |
Get the key material for a specific version of the key.
|
java.util.List<KeyProvider.KeyVersion> |
getKeyVersions(java.lang.String name) |
Get the key material for all versions of a specific key name.
|
KeyProvider.Metadata |
getMetadata(java.lang.String name) |
Get metadata about the key.
|
KMSClientProvider[] |
getProviders() |
|
void |
invalidateCache(java.lang.String keyName) |
Can be used by implementing classes to invalidate the caches.
|
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) |
|
long |
renewDelegationToken(Token<?> token) |
Renews the given token.
|
KeyProvider.KeyVersion |
rollNewVersion(java.lang.String name) |
Roll a new version of the given key generating the material for it.
|
KeyProvider.KeyVersion |
rollNewVersion(java.lang.String name,
byte[] material) |
Roll a new version of the given key.
|
Token<? extends TokenIdentifier> |
selectDelegationToken(Credentials creds) |
|
void |
warmUpEncryptedKeys(java.lang.String... keyNames) |
Calls to this method allows the underlying KeyProvider to warm-up any
implementation specific caches used to store the Encrypted Keys.
|
buildVersionName, findProvider, generateKey, getBaseName, getConf, isTransient, needsPassword, noPasswordError, noPasswordWarning, optionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDelegationTokens, getAdditionalTokenIssuerspublic LoadBalancingKMSClientProvider(java.net.URI providerUri,
KMSClientProvider[] providers,
Configuration conf)
@VisibleForTesting public KMSClientProvider[] getProviders()
public Token<? extends TokenIdentifier> selectDelegationToken(Credentials creds)
selectDelegationToken in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensionpublic java.lang.String getCanonicalServiceName()
DelegationTokenIssuergetCanonicalServiceName in interface DelegationTokenIssuerpublic Token<?> getDelegationToken(java.lang.String renewer) throws java.io.IOException
DelegationTokenIssuergetDelegationToken in interface DelegationTokenIssuerrenewer - renewer.java.io.IOException - raised on errors performing I/O.public long renewDelegationToken(Token<?> token) throws java.io.IOException
KeyProviderDelegationTokenExtension.DelegationTokenExtensionrenewDelegationToken in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensiontoken - The token to be renewed.java.io.IOException - raised on errors performing I/O.public java.lang.Void cancelDelegationToken(Token<?> token) throws java.io.IOException
KeyProviderDelegationTokenExtension.DelegationTokenExtensioncancelDelegationToken in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensiontoken - The token to be cancelled.java.io.IOException - raised on errors performing I/O.public void warmUpEncryptedKeys(java.lang.String... keyNames)
throws java.io.IOException
KeyProviderCryptoExtension.CryptoExtensionwarmUpEncryptedKeys in interface KeyProviderCryptoExtension.CryptoExtensionkeyNames - Array of Key Namesjava.io.IOException - thrown if the key material could not be encrypted.public void drain(java.lang.String keyName)
KeyProviderCryptoExtension.CryptoExtensiondrain in interface KeyProviderCryptoExtension.CryptoExtensionkeyName - the key to drain the Queue forpublic void invalidateCache(java.lang.String keyName)
throws java.io.IOException
KeyProviderinvalidateCache in class KeyProviderkeyName - the basename of the keyjava.io.IOException - raised on errors performing I/O.public KeyProviderCryptoExtension.EncryptedKeyVersion generateEncryptedKey(java.lang.String encryptionKeyName) throws java.io.IOException, java.security.GeneralSecurityException
KeyProviderCryptoExtension.CryptoExtensionKeyVersion material of the latest key version
of the key and is encrypted using the same cipher.
NOTE: The generated key is not stored by the KeyProvider
generateEncryptedKey in interface KeyProviderCryptoExtension.CryptoExtensionencryptionKeyName - 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 encryptedKeyVersion) throws java.io.IOException, java.security.GeneralSecurityException
KeyProviderCryptoExtension.CryptoExtensiondecryptEncryptedKey in interface KeyProviderCryptoExtension.CryptoExtensionencryptedKeyVersion - 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
KeyProviderCryptoExtension.CryptoExtensionIf 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
reencryptEncryptedKey in interface KeyProviderCryptoExtension.CryptoExtensionekv - The EncryptedKeyVersion containing keyVersionName and IV.java.io.IOException - If the key material could not be re-encrypted.java.security.GeneralSecurityException - If the key material could not be
re-encrypted because of a cryptographic issue.public void reencryptEncryptedKeys(java.util.List<KeyProviderCryptoExtension.EncryptedKeyVersion> ekvs) throws java.io.IOException, java.security.GeneralSecurityException
KeyProviderCryptoExtension.CryptoExtensionKeyProviderCryptoExtension.CryptoExtension.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
reencryptEncryptedKeys in interface KeyProviderCryptoExtension.CryptoExtensionekvs - 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 KeyProvider.KeyVersion getKeyVersion(java.lang.String versionName) throws java.io.IOException
KeyProvidergetKeyVersion in class KeyProviderversionName - the name of a specific version of the keyjava.io.IOException - raised on errors performing I/O.public java.util.List<java.lang.String> getKeys()
throws java.io.IOException
KeyProvidergetKeys in class KeyProviderjava.io.IOException - raised on errors performing I/O.public KeyProvider.Metadata[] getKeysMetadata(java.lang.String... names) throws java.io.IOException
KeyProvidergetKeysMetadata in class KeyProvidernames - the names of the keys to getjava.io.IOException - raised on errors performing I/O.public java.util.List<KeyProvider.KeyVersion> getKeyVersions(java.lang.String name) throws java.io.IOException
KeyProvidergetKeyVersions in class KeyProvidername - the base name of the key.java.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion getCurrentKey(java.lang.String name) throws java.io.IOException
KeyProvidergetCurrentKey in class KeyProvidername - the base name of the keyjava.io.IOException - raised on errors performing I/O.public KeyProvider.Metadata getMetadata(java.lang.String name) throws java.io.IOException
KeyProvidergetMetadata in class KeyProvidername - the basename of the keyjava.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion createKey(java.lang.String name, byte[] material, KeyProvider.Options options) throws java.io.IOException
KeyProvidercreateKey in class KeyProvidername - the base name of the keymaterial - the key material for the first version of the key.options - the options for the new key.java.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion createKey(java.lang.String name, KeyProvider.Options options) throws java.security.NoSuchAlgorithmException, java.io.IOException
KeyProvider
This implementation generates the key material and calls the
KeyProvider.createKey(String, byte[], Options) method.
createKey in class KeyProvidername - the base name of the keyoptions - the options for the new key.java.security.NoSuchAlgorithmException - no such algorithm exception.java.io.IOException - raised on errors performing I/O.public void deleteKey(java.lang.String name)
throws java.io.IOException
KeyProviderdeleteKey in class KeyProvidername - the name of the key to deletejava.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion rollNewVersion(java.lang.String name, byte[] material) throws java.io.IOException
KeyProviderrollNewVersion in class KeyProvidername - the basename of the keymaterial - the new key materialjava.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion rollNewVersion(java.lang.String name) throws java.security.NoSuchAlgorithmException, java.io.IOException
KeyProvider
This implementation generates the key material and calls the
KeyProvider.rollNewVersion(String, byte[]) method.
rollNewVersion in class KeyProvidername - the basename of the keyjava.security.NoSuchAlgorithmException - This exception is thrown when a particular
cryptographic algorithm is requested
but is not available in the environment.java.io.IOException - raised on errors performing I/O.public void close()
throws java.io.IOException
KeyProviderclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class KeyProviderjava.io.IOExceptionpublic void flush()
throws java.io.IOException
KeyProviderflush in class KeyProviderjava.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.