System.Security.Cryptography.SymmetricAlgorithm.IV Property

Gets or sets the initialization vector (SymmetricAlgorithm.IV) for the symmetric algorithm.

Syntax

public virtual byte[] IV { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

The SymmetricAlgorithm.IV property is automatically set to a new random value whenever you create a new instance of one of the System.Security.Cryptography.SymmetricAlgorithm classes or when you manually call the SymmetricAlgorithm.GenerateIV method. The size of the SymmetricAlgorithm.IV property must be the same as the SymmetricAlgorithm.BlockSize property divided by 8.

The classes that derive from the System.Security.Cryptography.SymmetricAlgorithm class use a chaining mode called cipher block chaining (CBC), which requires a key and an initialization vector to perform cryptographic transformations on data. To decrypt data that was encrypted using one of the System.Security.Cryptography.SymmetricAlgorithm classes, you must set the SymmetricAlgorithm.Key property and SymmetricAlgorithm.IV property to the same values that were used for encryption.

For a given secret key k, a simple block cipher that does not use an initialization vector will encrypt the same input block of plain text into the same output block of cipher text. If you have duplicate blocks within your plain text stream, you will have duplicate blocks within your cipher text stream. If unauthorized users know anything about the structure of a block of your plain text, they can use that information to decipher the known cipher text block and possibly recover your key. To combat this problem, information from the previous block is mixed into the process of encrypting the next block. Thus, the output of two identical plain text blocks is different. Because this technique uses the previous block to encrypt the next block, an initialization vector is needed to encrypt the first block of data.

Requirements

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0