Save This Page
Home » crypto-143 » org.bouncycastle.crypto » [javadoc | source]
org.bouncycastle.crypto
public class: BufferedBlockCipher [javadoc | source]
java.lang.Object
   org.bouncycastle.crypto.BufferedBlockCipher

Direct Known Subclasses:
    PaddedBlockCipher, CTSBlockCipher, PaddedBufferedBlockCipher

A wrapper class that allows block ciphers to be used to process data in a piecemeal fashion. The BufferedBlockCipher outputs a block only when the buffer is full and more data is being added, or on a doFinal.

Note: in the case where the underlying cipher is either a CFB cipher or an OFB one the last block may not be a multiple of the block size.
Field Summary
protected  byte[] buf     
protected  int bufOff     
protected  boolean forEncryption     
protected  BlockCipher cipher     
protected  boolean partialBlockOkay     
protected  boolean pgpCFB     
Constructor:
 protected BufferedBlockCipher() 
 public BufferedBlockCipher(BlockCipher cipher) 
    Create a buffered block cipher without padding.
    Parameters:
    cipher - the underlying block cipher this buffering object wraps.
Method from org.bouncycastle.crypto.BufferedBlockCipher Summary:
doFinal,   getBlockSize,   getOutputSize,   getUnderlyingCipher,   getUpdateOutputSize,   init,   processByte,   processBytes,   reset
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.bouncycastle.crypto.BufferedBlockCipher Detail:
 public int doFinal(byte[] out,
    int outOff) throws DataLengthException, InvalidCipherTextException, IllegalStateException 
    Process the last block in the buffer.
 public int getBlockSize() 
    return the blocksize for the underlying cipher.
 public int getOutputSize(int len) 
    return the size of the output buffer required for an update plus a doFinal with an input of len bytes.
 public BlockCipher getUnderlyingCipher() 
    return the cipher this object wraps.
 public int getUpdateOutputSize(int len) 
    return the size of the output buffer required for an update an input of len bytes.
 public  void init(boolean forEncryption,
    CipherParameters params) throws IllegalArgumentException 
    initialise the cipher.
 public int processByte(byte in,
    byte[] out,
    int outOff) throws DataLengthException, IllegalStateException 
    process a single byte, producing an output block if neccessary.
 public int processBytes(byte[] in,
    int inOff,
    int len,
    byte[] out,
    int outOff) throws DataLengthException, IllegalStateException 
    process an array of bytes, producing output if necessary.
 public  void reset() 
    Reset the buffer and cipher. After resetting the object is in the same state as it was after the last init (if there was one).