public int processBlock(byte[] in,
int inOff,
byte[] out,
int outOff) {
if (workingKey == null)
{
throw new IllegalStateException("Rijndael engine not initialised");
}
if ((inOff + (BC / 2)) > in.length)
{
throw new DataLengthException("input buffer too short");
}
if ((outOff + (BC / 2)) > out.length)
{
throw new DataLengthException("output buffer too short");
}
if (forEncryption)
{
unpackBlock(in, inOff);
encryptBlock(workingKey);
packBlock(out, outOff);
}
else
{
unpackBlock(in, inOff);
decryptBlock(workingKey);
packBlock(out, outOff);
}
return BC / 2;
}
|