Package org.apache.iceberg.gcp
Class GcpKeyManagementClient
java.lang.Object
org.apache.iceberg.gcp.GcpKeyManagementClient
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,KeyManagementClient
Key management client implementation that uses Google Cloud Key Management. To be used for
encrypting/decrypting keys with a KMS-managed master key (by referencing its key ID)
Uses GcpKeyManagementClient.ByteStringShim
to ensure this class works with and without iceberg-gcp-bundle.
Since the bundle relocates ByteString
, all related methods need to be
loaded dynamically. During runtime if the relocated class is observed, it will be preferred over
the original one.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.iceberg.encryption.KeyManagementClient
KeyManagementClient.KeyGenerationResult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close KMS Client to release underlying resources, this could be triggered in different threads when KmsClient is shared by multiple encryption managers.void
initialize
(Map<String, String> properties) Initialize the KMS client with given properties.unwrapKey
(ByteBuffer wrappedKey, String wrappingKeyId) Unwrap a secret key, using a wrapping/master key which is stored in KMS and referenced by an ID.wrapKey
(ByteBuffer key, String wrappingKeyId) Wrap a secret key, using a wrapping/master key which is stored in KMS and referenced by an ID.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.iceberg.encryption.KeyManagementClient
generateKey, supportsKeyGeneration
-
Constructor Details
-
GcpKeyManagementClient
public GcpKeyManagementClient()
-
-
Method Details
-
initialize
Description copied from interface:KeyManagementClient
Initialize the KMS client with given properties.- Specified by:
initialize
in interfaceKeyManagementClient
- Parameters:
properties
- kms client properties
-
wrapKey
Description copied from interface:KeyManagementClient
Wrap a secret key, using a wrapping/master key which is stored in KMS and referenced by an ID. Wrapping means encryption of the secret key with the master key, and adding optional KMS-specific metadata that allows the KMS to decrypt the secret key in an unwrapping call.- Specified by:
wrapKey
in interfaceKeyManagementClient
- Parameters:
key
- a secret key being wrappedwrappingKeyId
- a key ID that represents a wrapping key stored in KMS- Returns:
- wrapped key material
-
unwrapKey
Description copied from interface:KeyManagementClient
Unwrap a secret key, using a wrapping/master key which is stored in KMS and referenced by an ID.- Specified by:
unwrapKey
in interfaceKeyManagementClient
- Parameters:
wrappedKey
- wrapped key material (encrypted key and optional KMS metadata, returned by the wrapKey method)wrappingKeyId
- a key ID that represents a wrapping key stored in KMS- Returns:
- raw key bytes
-
close
public void close()Description copied from interface:KeyManagementClient
Close KMS Client to release underlying resources, this could be triggered in different threads when KmsClient is shared by multiple encryption managers.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceKeyManagementClient
-