Package org.forgerock.secrets.gcpkms
Class GoogleKmsEncryptedPropertyFormat
java.lang.Object
org.forgerock.secrets.gcpkms.GoogleKmsEncryptedPropertyFormat
- All Implemented Interfaces:
SecretPropertyFormat,SecretDecoder
A
SecretPropertyFormat for the PropertyResolverSecretStore
that can decrypt secrets using a Google KMS decryption key. Supports either symmetric or asymmetric decryption
algorithms.
Note: the output of gcloud kms encrypt is a binary file. As Commons Config properties must be strings,
this property format class assumes that the data is base64-encoded. To create a compatible file you should
therefore use a two step process:
gcloud kms encrypt --plaintext-file=plaintext.txt --ciphertext-file=ciphertext.enc
base64 < ciphertext.enc > ciphertext.txt
-
Field Summary
Fields inherited from interface org.forgerock.secrets.SecretDecoder
RAWFields inherited from interface org.forgerock.secrets.propertyresolver.SecretPropertyFormat
PLAIN -
Constructor Summary
ConstructorsConstructorDescriptionGoogleKmsEncryptedPropertyFormat(GoogleKmsSecretStore secretStore, Purpose<DataDecryptionKey> purpose) Initializes the property format with the given secret store and purpose. -
Method Summary
Modifier and TypeMethodDescriptionDecodes the input property value, setting relevant properties on aSecretBuilderobject.decodeToPromise(String propertyValue) Decodes the input property value, setting relevant properties on aSecretBuilderobject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.forgerock.secrets.propertyresolver.SecretPropertyFormat
decodeToPromise
-
Constructor Details
-
GoogleKmsEncryptedPropertyFormat
public GoogleKmsEncryptedPropertyFormat(GoogleKmsSecretStore secretStore, Purpose<DataDecryptionKey> purpose) Initializes the property format with the given secret store and purpose. All valid keys for the given purpose will be tried for decryption.- Parameters:
secretStore- the secret store.purpose- the purpose for decryption.
-
-
Method Details
-
decode
Description copied from interface:SecretPropertyFormatDecodes the input property value, setting relevant properties on aSecretBuilderobject.- Specified by:
decodein interfaceSecretPropertyFormat- Parameters:
propertyValue- the value of the secret property.- Returns:
- the decoded secret information.
- Throws:
NoSuchSecretException- If the property value does not contain a value that can be decoded.
-
decodeToPromise
Description copied from interface:SecretPropertyFormatDecodes the input property value, setting relevant properties on aSecretBuilderobject.- Specified by:
decodeToPromisein interfaceSecretPropertyFormat- Parameters:
propertyValue- the value of the secret property.- Returns:
- a promise of the decoded secret information.
-