Used to define the IV for AES keys created in this process, by default this is MD5(UTF8(Name)) where Name is the short-name of either the entry-point assembly, or "CSharpTest.Net.Library" if undefined.
Syntax
Visual Basic (Declaration) | |
---|
Public Shared Property ProcessDefaultIV As Byte() |
C# | |
---|
public static byte[] ProcessDefaultIV {get; set;} |
Remarks
Example
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 |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also