Class AESGCMCipher


  • public class AESGCMCipher
    extends java.lang.Object
    Creates an Advanced Encryption Standard-Galois/Counter Mode (AES-GCM) Cipher.
    • Constructor Summary

      Constructors 
      Constructor Description
      AESGCMCipher​(boolean forEncryption, byte[] key, byte[] iv)
      Creates a new instance of AESGCMCipher.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] doFinal()
      Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized and resets underlying cipher object to the state it was in when previously initialized via a call to init.
      byte[] update​(byte[] b, int off, int len)
      Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AESGCMCipher

        public AESGCMCipher​(boolean forEncryption,
                            byte[] key,
                            byte[] iv)
        Creates a new instance of AESGCMCipher.
        Parameters:
        forEncryption - if true the cipher is initialised for encryption, if false for decryption
        key - the key to be used in the cipher
        iv - initialization vector to be used in cipher
    • Method Detail

      • update

        public byte[] update​(byte[] b,
                             int off,
                             int len)
        Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.

        The first len bytes in the b input buffer, starting at off offset inclusive, are processed, and the result is stored in a new buffer.

        Parameters:
        b - the input buffer
        off - the offset in b where the input starts
        len - the input length
        Returns:
        the new buffer with the result
      • doFinal

        public byte[] doFinal()
        Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized and resets underlying cipher object to the state it was in when previously initialized via a call to init.
        Returns:
        final bytes array