Ejemplo n.º 1
0
        public void SelfTestCbc()
        {
            var r     = new Random(42);
            var plain = new byte[DataSize];
            var key   = new byte[16];
            var iv    = new byte[16];

            r.NextBytes(plain);
            r.NextBytes(key);
            r.NextBytes(iv);

            var cipher     = new byte[DataSize];
            var plainAgain = new byte[DataSize];
            var k          = new Aes128Key(key);

            Aes.EncryptCbc(plain, cipher, iv, k, PaddingMode.None);
            Aes.DecryptCbc(cipher, plainAgain, iv, k, PaddingMode.None);

            Assert.Equal(plain, plainAgain);
        }