CSharpTest.Net
IV Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > AESCryptoKey Class : IV Property

Glossary Item Box

Returns the AES 256 bit key this object was created with

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property IV As Byte()
C# 
public byte[] IV {get;}

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.NETCopy 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

Generated with Document! X 2011 by Innovasys