public void Pad_BlockSizeAndInput_LessThanBlockSize() { var input = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 }; var expected = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x03, 0x03 }; var actual = _padding.Pad(8, input); Assert.IsTrue(expected.IsEqualTo(actual)); }
public static byte[] encode(byte[] inputByteArray) { byte[] rgbKey = Encoding.UTF8.GetBytes(ekey); byte[] rgbIV = Encoding.UTF8.GetBytes(eiv); PKCS5Padding pp = new PKCS5Padding(); byte[] pss = pp.Pad(8, inputByteArray); DesCipher cc = new DesCipher(rgbKey, new CbcCipherMode(rgbIV), null); return(cc.Encrypt(pss)); }
public void PadTest() { PKCS5Padding target = new PKCS5Padding(); // TODO: Initialize to an appropriate value int blockSize = 0; // TODO: Initialize to an appropriate value byte[] input = null; // TODO: Initialize to an appropriate value byte[] expected = null; // TODO: Initialize to an appropriate value byte[] actual; actual = target.Pad(blockSize, input); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }