Package org.apache.hadoop.crypto.key
Class UserProvider
java.lang.Object
org.apache.hadoop.crypto.key.KeyProvider
org.apache.hadoop.crypto.key.UserProvider
- All Implemented Interfaces:
Closeable,AutoCloseable
A KeyProvider factory for UGIs. It uses the credentials object associated
with the current user to find keys. This provider is created using a
URI of "user:///".
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.hadoop.crypto.key.KeyProvider
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options -
Field Summary
FieldsFields inherited from class org.apache.hadoop.crypto.key.KeyProvider
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME, JCEKS_KEY_SERIAL_FILTER, JCEKS_KEY_SERIALFILTER_DEFAULT -
Method Summary
Modifier and TypeMethodDescriptioncreateKey(String name, byte[] material, KeyProvider.Options options) Create a new key.voidDelete the given key.voidflush()Ensures that any changes to the keys are written to persistent store.getKeys()Get the key names for all keys.getKeyVersion(String versionName) Get the key material for a specific version of the key.getKeyVersions(String name) Get the key material for all versions of a specific key name.getMetadata(String name) Get metadata about the key.booleanIndicates whether this provider represents a store that is intended for transient use - such as the UserProvider is.rollNewVersion(String name, byte[] material) Roll a new version of the given key.toString()Methods inherited from class org.apache.hadoop.crypto.key.KeyProvider
buildVersionName, close, createKey, findProvider, generateKey, getBaseName, getConf, getCurrentKey, getKeysMetadata, invalidateCache, needsPassword, noPasswordError, noPasswordWarning, options, rollNewVersion
-
Field Details
-
SCHEME_NAME
- See Also:
-
-
Method Details
-
isTransient
public boolean isTransient()Description copied from class:KeyProviderIndicates whether this provider represents a store that is intended for transient use - such as the UserProvider is. These providers are generally used to provide access to keying material rather than for long term storage.- Overrides:
isTransientin classKeyProvider- Returns:
- true if transient, false otherwise
-
getKeyVersion
Description copied from class:KeyProviderGet the key material for a specific version of the key. This method is used when decrypting data.- Specified by:
getKeyVersionin classKeyProvider- Parameters:
versionName- the name of a specific version of the key- Returns:
- the key material
- Throws:
IOException- raised on errors performing I/O.
-
getMetadata
Description copied from class:KeyProviderGet metadata about the key.- Specified by:
getMetadatain classKeyProvider- Parameters:
name- the basename of the key- Returns:
- the key's metadata or null if the key doesn't exist
- Throws:
IOException- raised on errors performing I/O.
-
createKey
public KeyProvider.KeyVersion createKey(String name, byte[] material, KeyProvider.Options options) throws IOException Description copied from class:KeyProviderCreate a new key. The given key must not already exist.- Specified by:
createKeyin classKeyProvider- Parameters:
name- the base name of the keymaterial- the key material for the first version of the key.options- the options for the new key.- Returns:
- the version name of the first version of the key.
- Throws:
IOException- raised on errors performing I/O.
-
deleteKey
Description copied from class:KeyProviderDelete the given key.- Specified by:
deleteKeyin classKeyProvider- Parameters:
name- the name of the key to delete- Throws:
IOException- raised on errors performing I/O.
-
rollNewVersion
Description copied from class:KeyProviderRoll a new version of the given key.- Specified by:
rollNewVersionin classKeyProvider- Parameters:
name- the basename of the keymaterial- the new key material- Returns:
- the name of the new version of the key
- Throws:
IOException- raised on errors performing I/O.
-
toString
-
flush
public void flush()Description copied from class:KeyProviderEnsures that any changes to the keys are written to persistent store.- Specified by:
flushin classKeyProvider
-
getKeys
Description copied from class:KeyProviderGet the key names for all keys.- Specified by:
getKeysin classKeyProvider- Returns:
- the list of key names
- Throws:
IOException- raised on errors performing I/O.
-
getKeyVersions
Description copied from class:KeyProviderGet the key material for all versions of a specific key name.- Specified by:
getKeyVersionsin classKeyProvider- Parameters:
name- the base name of the key.- Returns:
- the list of key material
- Throws:
IOException- raised on errors performing I/O.
-