public override void PerformTest()
{
SecureRandom rand = new SecureRandom(new byte[20]);
rand.SetSeed(DateTime.Now.Ticks);
doTestPadding(new Pkcs7Padding(), rand,
Hex.Decode("ffffff0505050505"),
Hex.Decode("0000000004040404"));
Pkcs7Padding padder = new Pkcs7Padding();
try
{
padder.PadCount(new byte[8]);
Fail("invalid padding not detected");
}
catch (InvalidCipherTextException e)
{
if (!"pad block corrupted".Equals(e.Message))
{
Fail("wrong exception for corrupt padding: " + e);
}
}
doTestPadding(new ISO10126d2Padding(), rand,
null,
null);
doTestPadding(new X923Padding(), rand,
null,
null);
doTestPadding(new TbcPadding(), rand,
Hex.Decode("ffffff0000000000"),
Hex.Decode("00000000ffffffff"));
doTestPadding(new ZeroBytePadding(), rand,
Hex.Decode("ffffff0000000000"),
null);
doTestPadding(new ISO7816d4Padding(), rand,
Hex.Decode("ffffff8000000000"),
Hex.Decode("0000000080000000"));
}