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)
{
in[inOff] = code;
inOff++;
}
return code;
|
public java.lang.String | getPaddingName()Return the name of the algorithm the padder implements.
return "PKCS7";
|
public void | init(java.security.SecureRandom random)Initialise the padder.
// nothing to do.
|
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");
}
for (int i = 1; i <= count; i++)
{
if (in[in.length - i] != count)
{
throw new InvalidCipherTextException("pad block corrupted");
}
}
return count;
|