public class LoadBalancingKMSClientProvider extends KeyProvider implements KeyProviderCryptoExtension.CryptoExtension, KeyProviderDelegationTokenExtension.DelegationTokenExtension
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options| Modifier and Type | Field and Description | 
|---|---|
static org.slf4j.Logger | 
LOG  | 
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME| Constructor and Description | 
|---|
LoadBalancingKMSClientProvider(org.apache.hadoop.crypto.key.kms.KMSClientProvider[] providers,
                              Configuration conf)  | 
| Modifier and Type | Method and Description | 
|---|---|
Token<?>[] | 
addDelegationTokens(String renewer,
                   Credentials credentials)
The implementer of this class will take a renewer and add all
 delegation tokens associated with the renewer to the
  
Credentials object if it is not already present, | 
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(String name,
         byte[] material,
         KeyProvider.Options options)
Create a new key. 
 | 
KeyProvider.KeyVersion | 
createKey(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 a key version
 name and initialization vector. 
 | 
void | 
deleteKey(String name)
Delete the given key. 
 | 
void | 
drain(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(String encryptionKeyName)
Generates a key material and encrypts it using the given key version name
 and initialization vector. 
 | 
KeyProvider.KeyVersion | 
getCurrentKey(String name)
Get the current version of the key, which should be used for encrypting new
 data. 
 | 
List<String> | 
getKeys()
Get the key names for all keys. 
 | 
KeyProvider.Metadata[] | 
getKeysMetadata(String... names)
Get key metadata in bulk. 
 | 
KeyProvider.KeyVersion | 
getKeyVersion(String versionName)
Get the key material for a specific version of the key. 
 | 
List<KeyProvider.KeyVersion> | 
getKeyVersions(String name)
Get the key material for all versions of a specific key name. 
 | 
KeyProvider.Metadata | 
getMetadata(String name)
Get metadata about the key. 
 | 
org.apache.hadoop.crypto.key.kms.KMSClientProvider[] | 
getProviders()  | 
long | 
renewDelegationToken(Token<?> token)
Renews the given token. 
 | 
KeyProvider.KeyVersion | 
rollNewVersion(String name)
Roll a new version of the given key generating the material for it. 
 | 
KeyProvider.KeyVersion | 
rollNewVersion(String name,
              byte[] material)
Roll a new version of the given key. 
 | 
void | 
warmUpEncryptedKeys(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, optionspublic LoadBalancingKMSClientProvider(org.apache.hadoop.crypto.key.kms.KMSClientProvider[] providers,
                              Configuration conf)
public org.apache.hadoop.crypto.key.kms.KMSClientProvider[] getProviders()
public Token<?>[] addDelegationTokens(String renewer, Credentials credentials) throws IOException
KeyProviderDelegationTokenExtension.DelegationTokenExtensionCredentials object if it is not already present,addDelegationTokens in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensionrenewer - the user allowed to renew the delegation tokenscredentials - cache in which to add new delegation tokensIOException - thrown if IOException if an IO error occurs.public long renewDelegationToken(Token<?> token) throws IOException
KeyProviderDelegationTokenExtension.DelegationTokenExtensionrenewDelegationToken in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensiontoken - The token to be renewed.IOExceptionpublic Void cancelDelegationToken(Token<?> token) throws IOException
KeyProviderDelegationTokenExtension.DelegationTokenExtensioncancelDelegationToken in interface KeyProviderDelegationTokenExtension.DelegationTokenExtensiontoken - The token to be cancelled.IOExceptionpublic void warmUpEncryptedKeys(String... keyNames) throws IOException
KeyProviderCryptoExtension.CryptoExtensionwarmUpEncryptedKeys in interface KeyProviderCryptoExtension.CryptoExtensionkeyNames - Array of Key NamesIOExceptionpublic void drain(String keyName)
KeyProviderCryptoExtension.CryptoExtensiondrain in interface KeyProviderCryptoExtension.CryptoExtensionkeyName - the key to drain the Queue forpublic KeyProviderCryptoExtension.EncryptedKeyVersion generateEncryptedKey(String encryptionKeyName) throws IOException, 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 KeyProvidergenerateEncryptedKey in interface KeyProviderCryptoExtension.CryptoExtensionencryptionKeyName - The latest KeyVersion of this key's material will be encrypted.IOException - thrown if the key material could not be generatedGeneralSecurityException - thrown if the key material could not be encrypted because of a
           cryptographic issue.public KeyProvider.KeyVersion decryptEncryptedKey(KeyProviderCryptoExtension.EncryptedKeyVersion encryptedKeyVersion) throws IOException, GeneralSecurityException
KeyProviderCryptoExtension.CryptoExtensiondecryptEncryptedKey in interface KeyProviderCryptoExtension.CryptoExtensionencryptedKeyVersion - contains keyVersionName and IV to decrypt the encrypted key
          materialIOException - thrown if the key material could not be decryptedGeneralSecurityException - thrown if the key material could not be decrypted because of a
           cryptographic issue.public KeyProvider.KeyVersion getKeyVersion(String versionName) throws IOException
KeyProvidergetKeyVersion in class KeyProviderversionName - the name of a specific version of the keyIOExceptionpublic List<String> getKeys() throws IOException
KeyProvidergetKeys in class KeyProviderIOExceptionpublic KeyProvider.Metadata[] getKeysMetadata(String... names) throws IOException
KeyProvidergetKeysMetadata in class KeyProvidernames - the names of the keys to getIOExceptionpublic List<KeyProvider.KeyVersion> getKeyVersions(String name) throws IOException
KeyProvidergetKeyVersions in class KeyProviderIOExceptionpublic KeyProvider.KeyVersion getCurrentKey(String name) throws IOException
KeyProvidergetCurrentKey in class KeyProvidername - the base name of the keyIOExceptionpublic KeyProvider.Metadata getMetadata(String name) throws IOException
KeyProvidergetMetadata in class KeyProvidername - the basename of the keyIOExceptionpublic KeyProvider.KeyVersion createKey(String name, byte[] material, KeyProvider.Options options) throws 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.IOExceptionpublic KeyProvider.KeyVersion createKey(String name, KeyProvider.Options options) throws NoSuchAlgorithmException, IOException
KeyProviderKeyProvider.createKey(String, byte[], Options) method.createKey in class KeyProvidername - the base name of the keyoptions - the options for the new key.NoSuchAlgorithmExceptionIOExceptionpublic void deleteKey(String name) throws IOException
KeyProviderdeleteKey in class KeyProvidername - the name of the key to deleteIOExceptionpublic KeyProvider.KeyVersion rollNewVersion(String name, byte[] material) throws IOException
KeyProviderrollNewVersion in class KeyProvidername - the basename of the keymaterial - the new key materialIOExceptionpublic KeyProvider.KeyVersion rollNewVersion(String name) throws NoSuchAlgorithmException, IOException
KeyProviderKeyProvider.rollNewVersion(String, byte[]) method.rollNewVersion in class KeyProvidername - the basename of the keyIOExceptionNoSuchAlgorithmExceptionpublic void close()
           throws IOException
KeyProviderclose in class KeyProviderIOExceptionpublic void flush()
           throws IOException
KeyProviderflush in class KeyProviderIOExceptionCopyright © 2018 Apache Software Foundation. All Rights Reserved.