Top Description Fields Constructors Methods
org.bouncycastle.crypto

public Class BufferedAsymmetricBlockCipher

extends Object
Class Inheritance

a buffer wrapper for an asymmetric block cipher, allowing input to be accumulated in a piecemeal fashion until final processing.

Field Summary

Modifier and TypeField and Description
protected byte[]
protected int
private final AsymmetricBlockCipher

Constructor Summary

AccessConstructor and Description
public
BufferedAsymmetricBlockCipher(AsymmetricBlockCipher
the cipher this buffering object wraps.
cipher
)

base constructor.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the result of the encryption/decryption process on the buffer.
doFinal
()

process the contents of the buffer using the underlying cipher.

public int

Returns:

the amount of data sitting in the buffer.
getBufferPosition
()

return the amount of data sitting in the buffer.

public int

Returns:

maximum size for an input block.
getInputBlockSize
()

returns the largest size an input block can be.

public int

Returns:

maximum size of the output block produced by the cipher.
getOutputBlockSize
()

returns the maximum size of the block produced by this cipher.

public AsymmetricBlockCipher

Returns:

the underlying cipher for the buffer.
getUnderlyingCipher
()

return the underlying cipher for the buffer.

public void
init(boolean
if true the cipher is initialised for encryption, if false for decryption.
forEncryption
,
CipherParameters
the key and other data required by the cipher.
params
)

initialise the buffer and the underlying cipher.

public void
processByte(byte
the input byte.
in
)

add another byte for processing.

public void
processBytes(byte[]
the input data
in
,
int
offset into the in array where the data starts
inOff
,
int
the length of the block to be processed.
len
)

add len bytes to the buffer for processing.

public void
reset()

Reset the buffer and the underlying cipher.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
protected byte[] buf
bufOffback to summary
protected int bufOff
cipherback to summary
private final AsymmetricBlockCipher cipher

Constructor Detail

BufferedAsymmetricBlockCipherback to summary
public BufferedAsymmetricBlockCipher(AsymmetricBlockCipher cipher)

base constructor.

Parameters
cipher:AsymmetricBlockCipher

the cipher this buffering object wraps.

Method Detail

doFinalback to summary
public byte[] doFinal() throws InvalidCipherTextException

process the contents of the buffer using the underlying cipher.

Returns:byte[]

the result of the encryption/decryption process on the buffer.

Exceptions
InvalidCipherTextException:
if we are given a garbage block.
getBufferPositionback to summary
public int getBufferPosition()

return the amount of data sitting in the buffer.

Returns:int

the amount of data sitting in the buffer.

getInputBlockSizeback to summary
public int getInputBlockSize()

returns the largest size an input block can be.

Returns:int

maximum size for an input block.

getOutputBlockSizeback to summary
public int getOutputBlockSize()

returns the maximum size of the block produced by this cipher.

Returns:int

maximum size of the output block produced by the cipher.

getUnderlyingCipherback to summary
public AsymmetricBlockCipher getUnderlyingCipher()

return the underlying cipher for the buffer.

Returns:AsymmetricBlockCipher

the underlying cipher for the buffer.

initback to summary
public void init(boolean forEncryption, CipherParameters params)

initialise the buffer and the underlying cipher.

Parameters
forEncryption:boolean

if true the cipher is initialised for encryption, if false for decryption.

params:CipherParameters

the key and other data required by the cipher.

processByteback to summary
public void processByte(byte in)

add another byte for processing.

Parameters
in:byte

the input byte.

processBytesback to summary
public void processBytes(byte[] in, int inOff, int len)

add len bytes to the buffer for processing.

Parameters
in:byte[]

the input data

inOff:int

offset into the in array where the data starts

len:int

the length of the block to be processed.

resetback to summary
public void reset()

Reset the buffer and the underlying cipher.