Library/Library.Test/TestEncryption.cs
C# | Copy Code |
---|---|
byte[] original = AESCryptoKey.ProcessDefaultIV; try { Assert.AreEqual(original, new AESCryptoKey().IV); byte[] newIv = new byte[16]; new Random().NextBytes(newIv); AESCryptoKey.ProcessDefaultIV = newIv; Assert.AreEqual(newIv, AESCryptoKey.ProcessDefaultIV); Assert.AreEqual(newIv, new AESCryptoKey().IV); } finally { AESCryptoKey.ProcessDefaultIV = original; } |
VB.NET | Copy Code |
---|---|
Dim original As Byte() = AESCryptoKey.ProcessDefaultIV Try Assert.AreEqual(original, New AESCryptoKey().IV) Dim newIv As Byte() = New Byte(16) {} New Random().NextBytes(newIv) AESCryptoKey.ProcessDefaultIV = newIv Assert.AreEqual(newIv, AESCryptoKey.ProcessDefaultIV) Assert.AreEqual(newIv, New AESCryptoKey().IV) Finally AESCryptoKey.ProcessDefaultIV = original End Try |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
AESCryptoKey ClassAESCryptoKey Members