Ejemplo n.º 1
0
 public void Test_AesCbc()
 {
     byte[] key          = KeyHelper.GenerateSymetricKey();
     byte[] iv           = CryptoUtils.NextBytesSecureRandom(16);
     byte[] plainTextRef = CryptoUtils.NextBytesSecureRandom(1024);
     byte[] ciperText    = CryptoUtils.Aes256CbcEncrypt(key, iv, plainTextRef);
     byte[] plainText    = CryptoUtils.Aes256CbcDecrypt(key, iv, ciperText);
     Assert.IsTrue(plainText.SequenceEqual(plainTextRef));
 }