Class GoogleKmsSecretKey

java.lang.Object
org.forgerock.secrets.gcpkms.GoogleKmsKey
org.forgerock.secrets.gcpkms.GoogleKmsSecretKey
All Implemented Interfaces:
Serializable, Key, SecretKey, Destroyable

public class GoogleKmsSecretKey extends GoogleKmsKey implements SecretKey
A symmetric secret key stored in Google KMS.
See Also:
  • Method Details

    • encrypt

      public byte[] encrypt(byte[] plaintext)
      Encrypts the given plaintext with this key.
      Parameters:
      plaintext - the plaintext to encrypt.
      Returns:
      the encrypted data.
      Throws:
      com.google.api.gax.rpc.ApiException - if an error occurs.
    • encryptWithAssociatedData

      public byte[] encryptWithAssociatedData(byte[] plaintext, byte[] associatedData)
      Encrypts the given plaintext with this key. The associated data will be included in the authentication tag calculation but not encrypted and not included in the resulting ciphertext. The same associated data must be provided
      Parameters:
      plaintext - the plaintext to encrypt.
      associatedData - the associated data to include in the authentication tag (may be null).
      Returns:
      the encrypted data.
      Throws:
      com.google.api.gax.rpc.ApiException - if an error occurs.