For AES CBC encryption, whats the importance of the IV?

前端 未结 4 2137
有刺的猬
有刺的猬 2020-12-17 19:33

What is the security threat of always using all zeroes for the IV? If it allows the encrypted text to be deciphered, how could an attacker do that?

UPDATE: So then,

4条回答
  •  孤城傲影
    2020-12-17 20:04

    The point of CBC is to randomize input blocks, because a given input block always gets encrypted the same with a given key (AES is deterministic). An input block is randomized by XORing it with the previous output block. The first block having no previous block, it is randomized by XORing it with the IV.

    Thus, using a non-random IV means that you do not randomize the first block. If you never use the same key twice, i.e. you use a new key whenever you encrypt a new message, then an all-zero IV is not a problem. Issues with non-randomized input blocks are relevant only when there are two non-randomized input blocks which are encrypted with the same key. If you use a given key for a single message, then only the single first block of that message will be non-randomized, so no problem. But that is a big "if". In particular, if you can generate a new key for every message, then you probably can also generate a new IV for every message. It would take a quite specific scenario to justify using an all-zero IV with CBC.

提交回复
热议问题