Methods Summary |
---|
public int | addPadding(byte[] in, int inOff)add the pad bytes to the passed in block, returning the
number of bytes added.
byte code = (byte)(in.length - inOff);
while (inOff < in.length - 1)
{
if (random == null)
{
in[inOff] = 0;
}
else
{
in[inOff] = (byte)random.nextInt();
}
inOff++;
}
in[inOff] = code;
return code;
|
public java.lang.String | getPaddingName()Return the name of the algorithm the padder implements.
return "X9.23";
|
public void | init(java.security.SecureRandom random)Initialise the padder.
this.random = random;
|
public int | padCount(byte[] in)return the number of pad bytes present in the block.
int count = in[in.length - 1] & 0xff;
if (count > in.length)
{
throw new InvalidCipherTextException("pad block corrupted");
}
return count;
|