public class CachingKeyProvider extends KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
KeyProviderExtension
implementation providing a short lived
cache for KeyVersions
and Metadata
to avoid burst
of requests to hit the underlying KeyProvider
.KeyProviderExtension.Extension
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME
Constructor and Description |
---|
CachingKeyProvider(KeyProvider keyProvider,
long keyTimeoutMillis,
long currKeyTimeoutMillis) |
Modifier and Type | Method and Description |
---|---|
void |
deleteKey(String name)
Delete the given key.
|
KeyProvider.KeyVersion |
getCurrentKey(String name)
Get the current version of the key, which should be used for encrypting new
data.
|
KeyProvider.KeyVersion |
getKeyVersion(String versionName)
Get the key material for a specific version of the key.
|
KeyProvider.Metadata |
getMetadata(String name)
Get metadata about the key.
|
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.
|
createKey, createKey, flush, getExtension, getKeyProvider, getKeys, getKeysMetadata, getKeyVersions, isTransient, toString
buildVersionName, close, findProvider, generateKey, getBaseName, getConf, needsPassword, noPasswordError, noPasswordWarning, options
public CachingKeyProvider(KeyProvider keyProvider, long keyTimeoutMillis, long currKeyTimeoutMillis)
public KeyProvider.KeyVersion getCurrentKey(String name) throws IOException
KeyProvider
getCurrentKey
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
name
- the base name of the keyIOException
public KeyProvider.KeyVersion getKeyVersion(String versionName) throws IOException
KeyProvider
getKeyVersion
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
versionName
- the name of a specific version of the keyIOException
public void deleteKey(String name) throws IOException
KeyProvider
deleteKey
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
name
- the name of the key to deleteIOException
public KeyProvider.KeyVersion rollNewVersion(String name, byte[] material) throws IOException
KeyProvider
rollNewVersion
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
name
- the basename of the keymaterial
- the new key materialIOException
public KeyProvider.KeyVersion rollNewVersion(String name) throws NoSuchAlgorithmException, IOException
KeyProvider
KeyProvider.rollNewVersion(String, byte[])
method.rollNewVersion
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
name
- the basename of the keyIOException
NoSuchAlgorithmException
public KeyProvider.Metadata getMetadata(String name) throws IOException
KeyProvider
getMetadata
in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
name
- the basename of the keyIOException
Copyright © 2017 Apache Software Foundation. All Rights Reserved.