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))
{
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 "ISO10126-2";
|
public void | init(java.security.SecureRandom random)Initialise the padder.
if (random != null)
{
this.random = random;
}
else
{
this.random = new SecureRandom();
}
|
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;
|