public void TestEncryptNoIv() { var key = AesCrypto.CreateKey(); String encryptBody = AesCrypto.Encrypt(body, Encoding.UTF8.GetBytes(key)); Assert.IsTrue(encryptBody.Length > 0); Console.WriteLine(encryptBody); }
public void TestCreateKey() { var key = AesCrypto.CreateKey(); Assert.IsNotNull(key); Assert.IsTrue(key.Length > 0); Console.WriteLine("Key:{0}", key); }
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)); }