Search code examples
.netvb.netencryption-symmetricrijndael

Is that OK to use static IV value in Rijndael encryption for many files?


I have a question about IV in Rijndael encryption.

My current approach of using Rijndael is to use a pair of static Key and Iv for all encryption operations (I mean I use this pair of Key and Iv for all protected files in my computer).

I heard that IV must be unique for each Rijndael encryption. Is that true? What is the problem (if any) for my current approach of using single static Key and Iv pair?


Solution

  • The initialization vector initializes the AES engine to a specific state. The main goal of using a dynamic IV is that two consecutive encryptions of the same file won't result in the same encrypted value. To decrypt the file, you also need to initialize the AES engine with this same IV. As a consequence, the IV has to be stored with your encrypted file.

    I don't think that the initialization vector will offer much additional security in your use case. It's nice to have it when you're encrypting data that can be subject to dictionnary attacks (passwords on the wire, card numbers, PIN code). For files, it will hardly be possible..