public abstract class KeyProviderExtension<E extends KeyProviderExtension.Extension> extends KeyProvider
Modifier and Type | Class and Description |
---|---|
static interface |
KeyProviderExtension.Extension
A marker interface for the KeyProviderExtension subclass implement.
|
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME
Constructor and Description |
---|
KeyProviderExtension(KeyProvider keyProvider,
E extensions) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
deleteKey(String name)
Delete the given key.
|
void |
flush()
Ensures that any changes to the keys are written to persistent store.
|
KeyProvider.KeyVersion |
getCurrentKey(String name)
Get the current version of the key, which should be used for encrypting new
data.
|
protected E |
getExtension() |
protected KeyProvider |
getKeyProvider() |
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.
|
boolean |
isTransient()
Indicates whether this provider represents a store
that is intended for transient use - such as the UserProvider
is.
|
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.
|
String |
toString() |
buildVersionName, close, findProvider, generateKey, getBaseName, getConf, needsPassword, noPasswordError, noPasswordWarning, options
public KeyProviderExtension(KeyProvider keyProvider, E extensions)
protected E getExtension()
protected KeyProvider getKeyProvider()
public boolean isTransient()
KeyProvider
isTransient
in class KeyProvider
public KeyProvider.Metadata[] getKeysMetadata(String... names) throws IOException
KeyProvider
getKeysMetadata
in class KeyProvider
names
- the names of the keys to getIOException
public KeyProvider.KeyVersion getCurrentKey(String name) throws IOException
KeyProvider
getCurrentKey
in class KeyProvider
name
- the base name of the keyIOException
public KeyProvider.KeyVersion createKey(String name, KeyProvider.Options options) throws NoSuchAlgorithmException, IOException
KeyProvider
KeyProvider.createKey(String, byte[], Options)
method.createKey
in class KeyProvider
name
- the base name of the keyoptions
- the options for the new key.NoSuchAlgorithmException
IOException
public KeyProvider.KeyVersion rollNewVersion(String name) throws NoSuchAlgorithmException, IOException
KeyProvider
KeyProvider.rollNewVersion(String, byte[])
method.rollNewVersion
in class KeyProvider
name
- the basename of the keyIOException
NoSuchAlgorithmException
public KeyProvider.KeyVersion getKeyVersion(String versionName) throws IOException
KeyProvider
getKeyVersion
in class KeyProvider
versionName
- the name of a specific version of the keyIOException
public List<String> getKeys() throws IOException
KeyProvider
getKeys
in class KeyProvider
IOException
public List<KeyProvider.KeyVersion> getKeyVersions(String name) throws IOException
KeyProvider
getKeyVersions
in class KeyProvider
IOException
public KeyProvider.Metadata getMetadata(String name) throws IOException
KeyProvider
getMetadata
in class KeyProvider
name
- the basename of the keyIOException
public KeyProvider.KeyVersion createKey(String name, byte[] material, KeyProvider.Options options) throws IOException
KeyProvider
createKey
in class KeyProvider
name
- the base name of the keymaterial
- the key material for the first version of the key.options
- the options for the new key.IOException
public void deleteKey(String name) throws IOException
KeyProvider
deleteKey
in class KeyProvider
name
- the name of the key to deleteIOException
public KeyProvider.KeyVersion rollNewVersion(String name, byte[] material) throws IOException
KeyProvider
rollNewVersion
in class KeyProvider
name
- the basename of the keymaterial
- the new key materialIOException
public void flush() throws IOException
KeyProvider
flush
in class KeyProvider
IOException
Copyright © 2017 Apache Software Foundation. All Rights Reserved.