コード例 #1
0
        public void TestEncryptNoIv()
        {
            var    key         = AesCrypto.CreateKey();
            String encryptBody = AesCrypto.Encrypt(body, Encoding.UTF8.GetBytes(key));

            Assert.IsTrue(encryptBody.Length > 0);
            Console.WriteLine(encryptBody);
        }
コード例 #2
0
        public void TestCreateKey()
        {
            var key = AesCrypto.CreateKey();

            Assert.IsNotNull(key);
            Assert.IsTrue(key.Length > 0);
            Console.WriteLine("Key:{0}", key);
        }
コード例 #3
0
        public void TestDecryptNoIv()
        {
            var    key         = AesCrypto.CreateKey();
            String encryptBody = AesCrypto.Encrypt(body, Encoding.UTF8.GetBytes(key));

            Console.WriteLine("密文:{0}", encryptBody);

            String decryptBody = AesCrypto.Decrypt(encryptBody, Encoding.UTF8.GetBytes(key));

            Assert.IsNotNull(decryptBody);
            Assert.IsTrue(decryptBody.Length > 0);
            Console.WriteLine("明文:{0}", decryptBody);
            Assert.IsTrue(decryptBody.Equals(body));
        }