Class GoogleKmsSecretKey

    • Method Detail

      • 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.