java.io.Closeable, java.lang.AutoCloseable@Private public class JavaKeyStoreProvider extends KeyProvider
If the HADOOP_KEYSTORE_PASSWORD environment variable is set,
its value is used as the password for the keystore.
If the HADOOP_KEYSTORE_PASSWORD environment variable is not set,
the password for the keystore is read from file specified in the
KEYSTORE_PASSWORD_FILE_KEY configuration property. The password file
is looked up in Hadoop's configuration directory via the classpath.
NOTE: Make sure the password in the password file does not have an ENTER at the end, else it won't be valid for the Java KeyStore.
If the environment variable, nor the property are not set, the password used is 'none'.
It is expected for encrypted InputFormats and OutputFormats to copy the keys from the original provider into the job's Credentials object, which is accessed via the UserProvider. Therefore, this provider won't be used by MapReduce tasks.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
JavaKeyStoreProvider.Factory |
The factory to create JksProviders, which is used by the ServiceLoader.
|
static class |
JavaKeyStoreProvider.KeyMetadata |
An adapter between a KeyStore Key and our Metadata.
|
KeyProvider.KeyVersion, KeyProvider.Metadata, KeyProvider.Options| Modifier and Type | Field | Description |
|---|---|---|
static char[] |
KEYSTORE_PASSWORD_DEFAULT |
|
static java.lang.String |
KEYSTORE_PASSWORD_ENV_VAR |
|
static java.lang.String |
KEYSTORE_PASSWORD_FILE_KEY |
|
static java.lang.String |
SCHEME_NAME |
DEFAULT_BITLENGTH, DEFAULT_BITLENGTH_NAME, DEFAULT_CIPHER, DEFAULT_CIPHER_NAME, JCEKS_KEY_SERIAL_FILTER, JCEKS_KEY_SERIALFILTER_DEFAULT| Modifier and Type | Method | Description |
|---|---|---|
protected boolean |
backupToOld(Path oldPath) |
|
KeyProvider.KeyVersion |
createKey(java.lang.String name,
byte[] material,
KeyProvider.Options options) |
Create a new key.
|
void |
deleteKey(java.lang.String name) |
Delete the given key.
|
void |
flush() |
Ensures that any changes to the keys are written to persistent store.
|
java.util.List<java.lang.String> |
getKeys() |
Get the key names for all keys.
|
KeyProvider.KeyVersion |
getKeyVersion(java.lang.String versionName) |
Get the key material for a specific version of the key.
|
java.util.List<KeyProvider.KeyVersion> |
getKeyVersions(java.lang.String name) |
Get the key material for all versions of a specific key name.
|
KeyProvider.Metadata |
getMetadata(java.lang.String name) |
Get metadata about the key.
|
boolean |
needsPassword() |
Does this provider require a password? This means that a password is
required for normal operation, and it has not been found through normal
means.
|
java.lang.String |
noPasswordError() |
If a password for the provider is needed, but is not provided, this will
return an error message and instructions for supplying said password to
the provider.
|
java.lang.String |
noPasswordWarning() |
If a password for the provider is needed, but is not provided, this will
return a warning and instructions for supplying said password to the
provider.
|
KeyProvider.KeyVersion |
rollNewVersion(java.lang.String name,
byte[] material) |
Roll a new version of the given key.
|
java.lang.String |
toString() |
|
protected void |
writeToNew(Path newPath) |
buildVersionName, close, createKey, findProvider, generateKey, getBaseName, getConf, getCurrentKey, getKeysMetadata, invalidateCache, isTransient, options, rollNewVersionpublic static final java.lang.String SCHEME_NAME
public static final java.lang.String KEYSTORE_PASSWORD_FILE_KEY
public static final java.lang.String KEYSTORE_PASSWORD_ENV_VAR
public static final char[] KEYSTORE_PASSWORD_DEFAULT
public boolean needsPassword()
throws java.io.IOException
KeyProviderneedsPassword in class KeyProviderjava.io.IOException - raised on errors performing I/O.public java.lang.String noPasswordWarning()
KeyProvidernoPasswordWarning in class KeyProviderpublic java.lang.String noPasswordError()
KeyProvidernoPasswordError in class KeyProviderpublic KeyProvider.KeyVersion getKeyVersion(java.lang.String versionName) throws java.io.IOException
KeyProvidergetKeyVersion in class KeyProviderversionName - the name of a specific version of the keyjava.io.IOException - raised on errors performing I/O.public java.util.List<java.lang.String> getKeys()
throws java.io.IOException
KeyProvidergetKeys in class KeyProviderjava.io.IOException - raised on errors performing I/O.public java.util.List<KeyProvider.KeyVersion> getKeyVersions(java.lang.String name) throws java.io.IOException
KeyProvidergetKeyVersions in class KeyProvidername - the base name of the key.java.io.IOException - raised on errors performing I/O.public KeyProvider.Metadata getMetadata(java.lang.String name) throws java.io.IOException
KeyProvidergetMetadata in class KeyProvidername - the basename of the keyjava.io.IOException - raised on errors performing I/O.public KeyProvider.KeyVersion createKey(java.lang.String name, byte[] material, KeyProvider.Options options) throws java.io.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.java.io.IOException - raised on errors performing I/O.public void deleteKey(java.lang.String name)
throws java.io.IOException
KeyProviderdeleteKey in class KeyProvidername - 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 KeyProvidername - the basename of the keymaterial - the new key materialjava.io.IOException - raised on errors performing I/O.public void flush()
throws java.io.IOException
KeyProviderflush in class KeyProviderjava.io.IOException - raised on errors performing I/O.protected void writeToNew(Path newPath) throws java.io.IOException
java.io.IOExceptionprotected boolean backupToOld(Path oldPath) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.