Interface KmsClient
- All Known Implementing Classes:
LocalWrapKmsClient
public interface KmsClient
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(org.apache.hadoop.conf.Configuration configuration, String kmsInstanceID, String kmsInstanceURL, String accessToken) Pass configuration with KMS-specific parameters.byte[]Decrypts (unwraps) a key with the master key.Wraps a key - encrypts it with the master key, encodes the result and potentially adds a KMS-specific metadata.
-
Field Details
-
KMS_INSTANCE_ID_DEFAULT
- See Also:
-
KMS_INSTANCE_URL_DEFAULT
- See Also:
-
KEY_ACCESS_TOKEN_DEFAULT
- See Also:
-
-
Method Details
-
initialize
void initialize(org.apache.hadoop.conf.Configuration configuration, String kmsInstanceID, String kmsInstanceURL, String accessToken) throws KeyAccessDeniedException Pass configuration with KMS-specific parameters.- Parameters:
configuration- 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.- Throws:
KeyAccessDeniedException- unauthorized to initialize the KMS client
-
wrapKey
Wraps a key - encrypts it with the master key, encodes the result and potentially adds a KMS-specific metadata.If your KMS client code throws runtime exceptions related to access/permission problems (such as Hadoop AccessControlException), catch them and throw the KeyAccessDeniedException.
- Parameters:
keyBytes- : key bytes to be wrappedmasterKeyIdentifier- : a string that uniquely identifies the master key in a KMS instance- Returns:
- wrapped key
- Throws:
KeyAccessDeniedException- unauthorized to encrypt with the given master key
-
unwrapKey
Decrypts (unwraps) a key with the master key.If your KMS client code throws runtime exceptions related to access/permission problems (such as Hadoop AccessControlException), catch them and throw the KeyAccessDeniedException.
- Parameters:
wrappedKey- String produced by wrapKey operationmasterKeyIdentifier- : a string that uniquely identifies the master key in a KMS instance- Returns:
- unwrapped key bytes
- Throws:
KeyAccessDeniedException- unauthorized to unwrap with the given master key
-