java.io.Closeable, java.lang.AutoCloseablepublic class CachingKeyProvider extends KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>
KeyProviderExtension implementation providing a short lived
cache for KeyVersions and Metadatato avoid burst
of requests to hit the underlying KeyProvider.KeyProviderExtension.ExtensionKeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.OptionsDEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME, JCEKS_KEY_SERIAL_FILTER, JCEKS_KEY_SERIALFILTER_DEFAULT| Constructor | Description |
|---|---|
CachingKeyProvider(KeyProvider keyProvider,
long keyTimeoutMillis,
long currKeyTimeoutMillis) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
deleteKey(java.lang.String name) |
Delete the given key.
|
KeyProvider.KeyVersion |
getCurrentKey(java.lang.String name) |
Get the current version of the key, which should be used for encrypting new
data.
|
KeyProvider.KeyVersion |
getKeyVersion(java.lang.String versionName) |
Get the key material for a specific version of the key.
|
KeyProvider.Metadata |
getMetadata(java.lang.String name) |
Get metadata about the key.
|
void |
invalidateCache(java.lang.String name) |
Can be used by implementing classes to invalidate the caches.
|
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.
|
createKey, createKey, flush, getExtension, getKeyProvider, getKeys, getKeysMetadata, getKeyVersions, isTransient, toStringbuildVersionName, close, findProvider, generateKey, getBaseName, getConf, needsPassword, noPasswordError, noPasswordWarning, optionspublic CachingKeyProvider(KeyProvider keyProvider, long keyTimeoutMillis, long currKeyTimeoutMillis)
public KeyProvider.KeyVersion getCurrentKey(java.lang.String name) throws java.io.IOException
KeyProvidergetCurrentKey in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - the base name of the keyjava.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion getKeyVersion(java.lang.String versionName) throws java.io.IOException
KeyProvidergetKeyVersion in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>versionName - the name of a specific version of the keyjava.io.IOException - raised on errors performing I/O.public void deleteKey(java.lang.String name)
throws java.io.IOException
KeyProviderdeleteKey in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - 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 KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - 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 KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - 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 invalidateCache(java.lang.String name)
throws java.io.IOException
KeyProviderinvalidateCache in class KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - the basename 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 KeyProviderExtension<org.apache.hadoop.crypto.key.CachingKeyProvider.CacheExtension>name - the basename of the keyjava.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.