Methods Summary |
---|
public byte[] | doFinal()process the contents of the buffer using the underlying
cipher.
byte[] out = cipher.processBlock(buf, 0, bufOff);
reset();
return out;
|
public int | getBufferPosition()return the amount of data sitting in the buffer.
return bufOff;
|
public int | getInputBlockSize()returns the largest size an input block can be.
return cipher.getInputBlockSize();
|
public int | getOutputBlockSize()returns the maximum size of the block produced by this cipher.
return cipher.getOutputBlockSize();
|
public AsymmetricBlockCipher | getUnderlyingCipher()return the underlying cipher for the buffer.
return cipher;
|
public void | init(boolean forEncryption, CipherParameters params)initialise the buffer and the underlying cipher.
reset();
cipher.init(forEncryption, params);
buf = new byte[cipher.getInputBlockSize()];
bufOff = 0;
|
public void | processByte(byte in)add another byte for processing.
if (bufOff > buf.length)
{
throw new DataLengthException("attempt to process message to long for cipher");
}
buf[bufOff++] = in;
|
public void | processBytes(byte[] in, int inOff, int len)add len bytes to the buffer for processing.
if (len == 0)
{
return;
}
if (len < 0)
{
throw new IllegalArgumentException("Can't have a negative input length!");
}
if (bufOff + len > buf.length)
{
throw new DataLengthException("attempt to process message to long for cipher");
}
System.arraycopy(in, inOff, buf, bufOff, len);
bufOff += len;
|
public void | reset()Reset the buffer and the underlying cipher.
/*
* clean the buffer.
*/
if (buf != null)
{
for (int i = 0; i < buf.length; i++)
{
buf[0] = 0;
}
}
bufOff = 0;
|