public class KmsTemplate extends Object implements KmsOperations
Constructor and Description |
---|
KmsTemplate(KeyManagementServiceClient keyManagementServiceClient,
GcpProjectIdProvider projectIdProvider) |
Modifier and Type | Method and Description |
---|---|
byte[] |
decryptBytes(String cryptoKey,
byte[] cipherText)
Decrypt the text using the specified KMS resource string
cryptoKey |
String |
decryptText(String cryptoKey,
byte[] cipherText)
Decrypt the text using the specified KMS resource string
cryptoKey |
byte[] |
encryptBytes(String cryptoKey,
byte[] bytes)
Encrypt the
bytes using the specified KMS resource string cryptoKey . |
byte[] |
encryptText(String cryptoKey,
String text)
Encrypt the
text using the specified KMS resource string cryptoKey . |
public KmsTemplate(KeyManagementServiceClient keyManagementServiceClient, GcpProjectIdProvider projectIdProvider)
public byte[] encryptText(String cryptoKey, String text)
KmsOperations
text
using the specified KMS resource string cryptoKey
.
An encryption request will be issued using GCP KMS.
encryptText
in interface KmsOperations
cryptoKey
- The KMS resource stringtext
- UTF-8 encoded text to encryptpublic byte[] encryptBytes(String cryptoKey, byte[] bytes)
KmsOperations
bytes
using the specified KMS resource string cryptoKey
.
An encryption request will be issued using GCP KMS.
encryptBytes
in interface KmsOperations
cryptoKey
- The KMS resource stringbytes
- The bytes to encryptpublic String decryptText(String cryptoKey, byte[] cipherText)
KmsOperations
cryptoKey
A decryption request will be issued using GCP KMS.
decryptText
in interface KmsOperations
cryptoKey
- The KMS resource stringcipherText
- The encrypted bytespublic byte[] decryptBytes(String cryptoKey, byte[] cipherText)
KmsOperations
cryptoKey
A decryption request will be issued using GCP KMS.
decryptBytes
in interface KmsOperations
cryptoKey
- The KMS resource stringcipherText
- The encrypted bytesCopyright © 2021. All rights reserved.