Mono Class Library: System.Security.Cryptography.DESCryptoServiceProvider Overview | MembersSystem.Security.Cryptography.DESCryptoServiceProvider.GenerateIV Method |
Generate a new random Initialization Vector (IV) required for some block cipher modes. [Edit]
|
The IV is used for most SymmetricAlgorithm.Mode of operation (except CipherMode.ECB). The value can be made public and must be available when decrypting the data.
IMPORTANT: If you reuse the same DES object for multiple encryption using the same key it is CAPITAL that you use a different IV each time.
[Edit]
C# Example DES des = DES.Create (); des.Key = new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; foreach (string file in files) { // each file MUST be encrypted with a different IV des.GenerateIV (); // encrypt the specified file with our DES key EncryptFile (file, des); }
Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0