Library/Library.Test/TestEncryption.cs
C# | Copy Code |
---|---|
byte[] ivrandom = new byte[16]; new Random().NextBytes(ivrandom); using (AESCryptoKey k1 = new AESCryptoKey()) using (AESCryptoKey k2 = AESCryptoKey.FromBytes(k1.ToArray())) { Assert.AreEqual(k1.Key, k2.Key); Assert.AreEqual(k1.IV, k2.IV); } |
VB.NET | Copy Code |
---|---|
Dim ivrandom As Byte() = New Byte(16) {} New Random().NextBytes(ivrandom) Using k1 As New AESCryptoKey() Using k2 As AESCryptoKey = AESCryptoKey.FromBytes(k1.ToArray()) Assert.AreEqual(k1.Key, k2.Key) Assert.AreEqual(k1.IV, k2.IV) End Using End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
AESCryptoKey ClassAESCryptoKey Members