Exemplo n.º 1
0
        public void AesCryptoToFromEncrypted()
        {
            var expected = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";

            using (var crypto = new AesCrypto("Passphrase", new byte[8] {
                0, 0, 0, 0, 0, 0, 0, 0
            }))
            {
                string encrypted = crypto.AesEncrypt(expected);
                string actual    = crypto.AesDecrypt(encrypted, true);

                Assert.AreEqual(expected, actual);
            }
        }