Interface KmsOperations
- All Known Implementing Classes:
KmsTemplate
For the methods you need specify the secret from GCP KMS by resource string. The following secret resource syntax is supported:
1. Shortest form - specify the key by key ring ID, and key ID. Project is derived through
GcpProjectIdProvider
. The location is assumed to be `global`. {key-ring-id}/{key-id}
2. Short form - specify location ID, key ring ID, and key ID. Project is derived through
GcpProjectIdProvider
. {location-id}/{key-ring-id}/{key-id}
3. Full form - specify project ID, location ID, key ring ID, and key ID {project-id}/{location-id}/{key-ring-id}/{key-id}
4. Long form - specify project ID, location ID, key ring ID, and key ID (full resource name) projects/{project-id}/locations/{location-id}/keyRings/{key-ring-id}/cryptoKeys/{key-id}
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
decryptBytes
(String cryptoKey, byte[] cipherText) Decrypt the text using the specified KMS resource stringcryptoKey
decryptText
(String cryptoKey, byte[] cipherText) Decrypt the text using the specified KMS resource stringcryptoKey
byte[]
encryptBytes
(String cryptoKey, byte[] bytes) Encrypt thebytes
using the specified KMS resource stringcryptoKey
.byte[]
encryptText
(String cryptoKey, String text) Encrypt thetext
using the specified KMS resource stringcryptoKey
.
-
Method Details
-
encryptText
Encrypt thetext
using the specified KMS resource stringcryptoKey
.An encryption request will be issued using GCP KMS.
- Parameters:
cryptoKey
- The KMS resource stringtext
- UTF-8 encoded text to encrypt- Returns:
- The encrypted bytes
-
encryptBytes
Encrypt thebytes
using the specified KMS resource stringcryptoKey
.An encryption request will be issued using GCP KMS.
- Parameters:
cryptoKey
- The KMS resource stringbytes
- The bytes to encrypt- Returns:
- The encrypted bytes
-
decryptBytes
Decrypt the text using the specified KMS resource stringcryptoKey
A decryption request will be issued using GCP KMS.
- Parameters:
cryptoKey
- The KMS resource stringcipherText
- The encrypted bytes- Returns:
- The decrypted bytes
-
decryptText
Decrypt the text using the specified KMS resource stringcryptoKey
A decryption request will be issued using GCP KMS.
- Parameters:
cryptoKey
- The KMS resource stringcipherText
- The encrypted bytes- Returns:
- The decrypted bytes UTF-8 encoded
-