IV pin for CBC chaining mode

Is there any safe way to obtain an IV value for use in CBC mode (e.g. 3DES CBC) other than IV randomization?

+2


source to share


4 answers


NIST Special Publication 800-38a discusses methods for generating an IV in Appendix C. One suggested method is to use a counter or nonce, encrypt it, and use the result as an IV. In contrast, for example, in CTR mode, it is necessary that the potential adversary cannot predict the IV.



Attacks exist if predictable IVs are used. See, for example, this document . (I will try to find a more accessible version).

+1


source


If you want to make them unpredictable (to anyone else) but make sure they don't repeat themselves, you can simply encrypt the one-block counter with a random key (generated once for each message key) to generate the IV. Make sure you keep the meter in permanent storage.



0


source


Anything that never repeats and has no structure will work (I don't understand why unpredictability should be important - if messages are also authenticated (which they should be)).

If you know you will never send more than one message per second, you can use unixtime (hash and use the first bytes).

If you are running on multiple threads / processes / machines, you may need to enable threadid / processid / machineid.

If you have access to generating the GUID, hashing that and using the first 8 bytes might also be a good option.

0


source


You might want to look in counter mode rather than CBC. Counter mode allows random access to encrypted data and can be parallelized.

0


source