public abstract class LocalWrapKmsClient extends Object implements KmsClient
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.hadoop.conf.Configuration |
hadoopConfiguration |
protected String |
kmsInstanceID |
protected String |
kmsInstanceURL |
protected String |
kmsToken |
static String |
LOCAL_WRAP_NO_KEY_VERSION |
KEY_ACCESS_TOKEN_DEFAULT, KMS_INSTANCE_ID_DEFAULT, KMS_INSTANCE_URL_DEFAULT| Constructor and Description |
|---|
LocalWrapKmsClient() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract byte[] |
getMasterKeyFromServer(String masterKeyIdentifier)
Get master key from the remote KMS server.
|
void |
initialize(org.apache.hadoop.conf.Configuration configuration,
String kmsInstanceID,
String kmsInstanceURL,
String accessToken)
Pass configuration with KMS-specific parameters.
|
protected abstract void |
initializeInternal()
Pass configuration with KMS-specific parameters.
|
byte[] |
unwrapKey(String wrappedKey,
String masterKeyIdentifier)
Decrypts (unwraps) a key with the master key.
|
String |
wrapKey(byte[] key,
String masterKeyIdentifier)
Wraps a key - encrypts it with the master key, encodes the result
and potentially adds a KMS-specific metadata.
|
public static final String LOCAL_WRAP_NO_KEY_VERSION
protected String kmsInstanceID
protected String kmsInstanceURL
protected String kmsToken
protected org.apache.hadoop.conf.Configuration hadoopConfiguration
public void initialize(org.apache.hadoop.conf.Configuration configuration,
String kmsInstanceID,
String kmsInstanceURL,
String accessToken)
KmsClientinitialize in interface KmsClientconfiguration - Hadoop configurationkmsInstanceID - ID of the KMS instance handled by this KmsClient. Use the default value, for KMS systems
that don't work with multiple instances.kmsInstanceURL - URL of the KMS instance handled by this KmsClient. Use the default value, for KMS systems
that don't work with URLs.accessToken - KMS access (authorization) token. Use the default value, for KMS systems that don't work with tokens.public String wrapKey(byte[] key, String masterKeyIdentifier) throws KeyAccessDeniedException
KmsClientIf your KMS client code throws runtime exceptions related to access/permission problems (such as Hadoop AccessControlException), catch them and throw the KeyAccessDeniedException.
wrapKey in interface KmsClientKeyAccessDeniedException - unauthorized to encrypt with the given master keypublic byte[] unwrapKey(String wrappedKey, String masterKeyIdentifier) throws KeyAccessDeniedException
KmsClientIf your KMS client code throws runtime exceptions related to access/permission problems (such as Hadoop AccessControlException), catch them and throw the KeyAccessDeniedException.
unwrapKey in interface KmsClientwrappedKey - String produced by wrapKey operationKeyAccessDeniedException - unauthorized to unwrap with the given master keyprotected abstract byte[] getMasterKeyFromServer(String masterKeyIdentifier) throws KeyAccessDeniedException
If your KMS client code throws runtime exceptions related to access/permission problems (such as Hadoop AccessControlException), catch them and throw the KeyAccessDeniedException.
masterKeyIdentifier: - a string that uniquely identifies the master key in a KMS instanceKeyAccessDeniedException - unauthorized to get the master keyprotected abstract void initializeInternal()
throws KeyAccessDeniedException
KeyAccessDeniedExceptionCopyright © 2023 The Apache Software Foundation. All rights reserved.