Class CipherTypes.AesGcmCipher

java.lang.Object
org.symbol.sdk.CipherTypes.AesGcmCipher
All Implemented Interfaces:

CipherTypes.SymmetricCipher

Enclosing class:

CipherTypes


public static final class CipherTypes.AesGcmCipher extends Object implements CipherTypes.SymmetricCipher
AesGcmCipher

Performs AES GCM encryption and decryption with a given key.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Byte size of GCM tag.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a cipher around an AES shared key.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decrypt(byte[] cipherText, byte[] iv)
    Decrypts cipher text with appended tag.
    byte[]
    encrypt(byte[] clearText, byte[] iv)
    Encrypts clear text and appends the authentication tag to the encrypted payload.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AesGcmCipher

      public AesGcmCipher(CryptoTypes.SharedKey256 aesKey)
      Creates a cipher around an AES shared key.
      Parameters:

      aesKey - AES shared key.

  • Method Details

    • encrypt

      public byte[] encrypt(byte[] clearText, byte[] iv)
      AesGcmCipher.encrypt

      Encrypts clear text and appends the authentication tag to the encrypted payload.

      Specified by:

      encrypt in interface CipherTypes.SymmetricCipher

      Parameters:

      clearText - Clear text to encrypt.

      iv - IV bytes.

      Returns:

      Cipher text with appended tag.

    • decrypt

      public byte[] decrypt(byte[] cipherText, byte[] iv)
      AesGcmCipher.decrypt

      Decrypts cipher text with appended tag.

      Specified by:

      decrypt in interface CipherTypes.SymmetricCipher

      Parameters:

      cipherText - Cipher text with appended tag to decrypt.

      iv - IV bytes.

      Returns:

      Clear text.