public void Test16_32_Expect16Padding()
        {
            string expected = string.Format("{0}\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10", input16bytes);

            string output = PKCS7PaddingHelper.PadStringToBytes(input16bytes, 32);

            Assert.AreEqual(expected, output);
        }
        public void Test16_24_Expect8Padding()
        {
            string expected = string.Format("{0}\x08\x08\x08\x08\x08\x08\x08\x08", input16bytes);

            string output = PKCS7PaddingHelper.PadStringToBytes(input16bytes, 24);

            Assert.AreEqual(expected, output);
        }
 public void TestTooLong_ExpectException()
 {
     PKCS7PaddingHelper.PadStringToBytes("aaaa", 2);
 }
        public void Test16_16_ExpectNoPadding()
        {
            string output = PKCS7PaddingHelper.PadStringToBytes(input16bytes, 16);

            Assert.AreEqual(input16bytes, output);
        }
Example #5
0
        /// <summary>
        /// See PKCS7PaddingHelper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="desiredLength"></param>
        /// <returns></returns>
        public string DoChallenge09(string input, string desiredLength)
        {
            int length = int.Parse(desiredLength);

            return PKCS7PaddingHelper.PadStringToBytes(input, length);
        }