Class StreamBlockCipher

java.lang.Object
org.bouncycastle.crypto.DefaultMultiBlockCipher
org.bouncycastle.crypto.StreamBlockCipher
All Implemented Interfaces:
BlockCipher, MultiBlockCipher, StreamCipher
Direct Known Subclasses:
CFBBlockCipher, G3413CFBBlockCipher, G3413CTRBlockCipher, G3413OFBBlockCipher, GCFBBlockCipher, GOFBBlockCipher, KCTRBlockCipher, OFBBlockCipher, SICBlockCipher

public abstract class StreamBlockCipher extends DefaultMultiBlockCipher implements StreamCipher
A parent class for block cipher modes that do not require block aligned data to be processed, but can function in a streaming mode.
  • Constructor Details

    • StreamBlockCipher

      protected StreamBlockCipher(BlockCipher cipher)
  • Method Details

    • getUnderlyingCipher

      public BlockCipher getUnderlyingCipher()
      return the underlying block cipher that we are wrapping.
      Returns:
      the underlying block cipher that we are wrapping.
    • returnByte

      public final byte returnByte(byte in)
      Description copied from interface: StreamCipher
      encrypt/decrypt a single byte returning the result.
      Specified by:
      returnByte in interface StreamCipher
      Parameters:
      in - the byte to be processed.
      Returns:
      the result of processing the input byte.
    • processBytes

      public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthException
      Description copied from interface: StreamCipher
      process a block of bytes from in putting the result into out.
      Specified by:
      processBytes in interface StreamCipher
      Parameters:
      in - the input byte array.
      inOff - the offset into the in array where the data to be processed starts.
      len - the number of bytes to be processed.
      out - the output buffer the processed bytes go into.
      outOff - the offset into the output byte array the processed data starts at.
      Returns:
      the number of bytes produced - should always be len.
      Throws:
      DataLengthException - if the output buffer is too small.
    • calculateByte

      protected abstract byte calculateByte(byte b)