0

When I use AES CBC, the encrypt function needs to get an input-buffer to encrypt + key + IV?

Is IV like one more key, or IV is generated by the key (so the encrypt function only needs to get the input-buffer to encrypt and the key)?

1

An IV is used to make sure that the same input (plain text) results in a different output (cipher text) even if the same encryption key is used - which can be guaranteed if a different IV is used all the time. The IV does not really be kept secret and insofar it is not comparable with the encryption key. But it should be as unpredictable as possible which means it should have uniform randomness (no IV is more probable than any other).

0

The IV must be a cryptographically random nonce of exactly 128 bits. Being a nonce, each IV must never be used more than once.

Also, please use a cryptographic library that hides this configuration stuff, because it is very easy to make mistakes.

  • You are missing the important requirement than an IV be random as well as single use. While the terms are sometimes mistakenly used interchangeably, nonces are not necessarily random, but IVs must be random. – AndrolGenhald Nov 28 '18 at 17:45
  • @AndrolGenhald You are of course right, thanks for your comment. I guess I wrote my answer too fast. I edited my answer accordingly. – A. Hersean Nov 29 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.