Class AEADBlockCipherAdapter

java.lang.Object
org.cryptacular.adapter.AEADBlockCipherAdapter
All Implemented Interfaces:
BlockCipherAdapter, CipherAdapter

public class AEADBlockCipherAdapter extends Object implements BlockCipherAdapter
Author:
Middleware Services
  • Constructor Summary

    Constructors
    Constructor
    Description
    AEADBlockCipherAdapter(org.bouncycastle.crypto.modes.AEADBlockCipher delegate)
    Creates a new instance that delegates to the given cipher.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    doFinal(byte[] out, int outOff)
    Finish the encryption/decryption operation (e.g.
    int
    getOutputSize(int len)
    Gets the size of the output buffer required to hold the output of an input buffer of the given size.
    void
    init(boolean forEncryption, org.bouncycastle.crypto.CipherParameters params)
    Initialize the underlying cipher.
    int
    processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
    Process an array of bytes, producing output if necessary.
    void
    Reset the cipher.

    Methods inherited from class java.lang.Object

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

    • AEADBlockCipherAdapter

      public AEADBlockCipherAdapter(org.bouncycastle.crypto.modes.AEADBlockCipher delegate)
      Creates a new instance that delegates to the given cipher.
      Parameters:
      delegate - Adapted cipher.
  • Method Details

    • getOutputSize

      public int getOutputSize(int len)
      Description copied from interface: BlockCipherAdapter
      Gets the size of the output buffer required to hold the output of an input buffer of the given size.
      Specified by:
      getOutputSize in interface BlockCipherAdapter
      Parameters:
      len - Length of input buffer.
      Returns:
      Size of output buffer.
    • init

      public void init(boolean forEncryption, org.bouncycastle.crypto.CipherParameters params) throws CryptoException
      Description copied from interface: CipherAdapter
      Initialize the underlying cipher.
      Specified by:
      init in interface CipherAdapter
      Parameters:
      forEncryption - True for encryption mode, false for decryption mode.
      params - Cipher initialization parameters.
      Throws:
      CryptoException - on underlying cipher initialization errors.
    • processBytes

      public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws CryptoException
      Description copied from interface: CipherAdapter
      Process an array of bytes, producing output if necessary.
      Specified by:
      processBytes in interface CipherAdapter
      Parameters:
      in - Input data.
      inOff - Offset at which the input data starts.
      len - The number of bytes in the input data to process.
      out - Array to receive any data produced by cipher.
      outOff - Offset into output array.
      Returns:
      The number of bytes produced by the cipher.
      Throws:
      CryptoException - on underlying cipher data handling errors.
    • doFinal

      public int doFinal(byte[] out, int outOff) throws CryptoException
      Description copied from interface: BlockCipherAdapter
      Finish the encryption/decryption operation (e.g. apply padding).
      Specified by:
      doFinal in interface BlockCipherAdapter
      Parameters:
      out - Output buffer to receive final processing output.
      outOff - Offset into output buffer where processed data should start.
      Returns:
      Number of bytes written to output buffer.
      Throws:
      CryptoException - on underlying cipher finalization errors.
    • reset

      public void reset()
      Description copied from interface: CipherAdapter
      Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).
      Specified by:
      reset in interface CipherAdapter