Archived Forum Post

Index of archived forum posts

Question:

Chilkat.Crypt2 C# SetEncodedIV

Oct 08 '13 at 08:12

I'm using Chilkat.Crypt2 with ASP.NET and C#. I'm using CipherMode as CBC, and noticed I need to set SetEncodedIV. My question is should SetEncodedIV be randomly generated ?

Because my SetEncodedKey is my secret randomly key ?


Answer

The same IV (initialization vector) would need to be used when decrypting. Therefore, if a random IV is used, then in addition to the secret key, the bytes of the IV must be provided to the counterparty doing the decryption.

One other idea is to use an IV that is computed from the secret key, such as a hash of the correct IV length. Of course, in this case the counterparty would also need to duplicate this computation to reconstruct the IV from the secret key.