org.bouncycastle.crypto
Class BufferedAsymmetricBlockCipher
java.lang.Object
org.bouncycastle.crypto.BufferedAsymmetricBlockCipher
public class BufferedAsymmetricBlockCipher
extends java.lang.Object
a buffer wrapper for an asymmetric block cipher, allowing input
to be accumulated in a piecemeal fashion until final processing.
bufOff
protected int bufOff
BufferedAsymmetricBlockCipher
public BufferedAsymmetricBlockCipher(AsymmetricBlockCipher cipher)
base constructor.
cipher
- the cipher this buffering object wraps.
doFinal
public byte[] doFinal()
throws InvalidCipherTextException
process the contents of the buffer using the underlying
cipher.
- the result of the encryption/decryption process on the
buffer.
getBufferPosition
public int getBufferPosition()
return the amount of data sitting in the buffer.
- the amount of data sitting in the buffer.
getInputBlockSize
public int getInputBlockSize()
returns the largest size an input block can be.
- maximum size for an input block.
getOutputBlockSize
public int getOutputBlockSize()
returns the maximum size of the block produced by this cipher.
- maximum size of the output block produced by the cipher.
getUnderlyingCipher
public AsymmetricBlockCipher getUnderlyingCipher()
return the underlying cipher for the buffer.
- the underlying cipher for the buffer.
init
public void init(boolean forEncryption,
CipherParameters params)
initialise the buffer and the underlying cipher.
forEncryption
- if true the cipher is initialised for
encryption, if false for decryption.params
- the key and other data required by the cipher.
processByte
public void processByte(byte in)
add another byte for processing.
processBytes
public void processBytes(byte[] in,
int inOff,
int len)
add len bytes to the buffer for processing.
in
- the input datainOff
- offset into the in array where the data startslen
- the length of the block to be processed.
reset
public void reset()
Reset the buffer and the underlying cipher.