Package com.google.cloud.spring.kms
Class KmsTemplate
java.lang.Object
com.google.cloud.spring.kms.KmsTemplate
- All Implemented Interfaces:
KmsOperations
Offers convenience methods for performing common operations on KMS including encrypting and
decrypting text.
-
Constructor Summary
ConstructorsConstructorDescriptionKmsTemplate(com.google.cloud.kms.v1.KeyManagementServiceClient keyManagementServiceClient, GcpProjectIdProvider projectIdProvider) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decryptBytes(String cryptoKey, byte[] cipherText) Decrypt the text using the specified KMS resource stringcryptoKeydecryptText(String cryptoKey, byte[] cipherText) Decrypt the text using the specified KMS resource stringcryptoKeybyte[]encryptBytes(String cryptoKey, byte[] bytes) Encrypt thebytesusing the specified KMS resource stringcryptoKey.byte[]encryptText(String cryptoKey, String text) Encrypt thetextusing the specified KMS resource stringcryptoKey.
-
Constructor Details
-
KmsTemplate
public KmsTemplate(com.google.cloud.kms.v1.KeyManagementServiceClient keyManagementServiceClient, GcpProjectIdProvider projectIdProvider)
-
-
Method Details
-
encryptText
Description copied from interface:KmsOperationsEncrypt thetextusing the specified KMS resource stringcryptoKey.An encryption request will be issued using GCP KMS.
- Specified by:
encryptTextin interfaceKmsOperations- Parameters:
cryptoKey- The KMS resource stringtext- UTF-8 encoded text to encrypt- Returns:
- The encrypted bytes
-
encryptBytes
Description copied from interface:KmsOperationsEncrypt thebytesusing the specified KMS resource stringcryptoKey.An encryption request will be issued using GCP KMS.
- Specified by:
encryptBytesin interfaceKmsOperations- Parameters:
cryptoKey- The KMS resource stringbytes- The bytes to encrypt- Returns:
- The encrypted bytes
-
decryptText
Description copied from interface:KmsOperationsDecrypt the text using the specified KMS resource stringcryptoKeyA decryption request will be issued using GCP KMS.
- Specified by:
decryptTextin interfaceKmsOperations- Parameters:
cryptoKey- The KMS resource stringcipherText- The encrypted bytes- Returns:
- The decrypted bytes UTF-8 encoded
-
decryptBytes
Description copied from interface:KmsOperationsDecrypt the text using the specified KMS resource stringcryptoKeyA decryption request will be issued using GCP KMS.
- Specified by:
decryptBytesin interfaceKmsOperations- Parameters:
cryptoKey- The KMS resource stringcipherText- The encrypted bytes- Returns:
- The decrypted bytes
-