Interface CipherAdapter

All Known Subinterfaces:
BlockCipherAdapter
All Known Implementing Classes:
AEADBlockCipherAdapter, BufferedBlockCipherAdapter

public interface CipherAdapter
Provides a consistent interface for cipher operations against dissimilar BC cipher types.
Author:
Middleware Services
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • Method Details

    • init

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

      int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws CryptoException
      Process an array of bytes, producing output if necessary.
      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.
    • reset

      void reset()
      Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).