Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the receiver of a cipher text know the IV used for encryption?

Tags:

encryption

If a random IV is used in encrypting plain text, how does the receiver of the cipher text know what the IV is in order to decrypt it?

This is a follow-up question to a response to the previous stackoverflow question on IVs here.

The IV allows for plaintext to be encrypted such that the encrypted text is harder to decrypt for an attacker. Each bit of IV you use will double the possibilities of encrypted text from a given plain text.

The point is that the attacker doesn't know what the IV is and therefore must compute every possible IV for a given plain text to find the matching cipher text. In this way, the IV acts like a password salt. Most commonly, an IV is used with a chaining cipher (either a stream or block cipher). ...

So, if you have a random IV used to encrypt the plain text, how do you decrypt it? Simple. Pass the IV (in plain text) along with your encrypted text.

Wait. You just said the IV is randomly generated. Then why pass it as plain text along with the encrypted text?

like image 919
PatrickL Avatar asked Jan 23 '23 10:01

PatrickL


1 Answers

The answer that you quote is wrong. So don't worry if it does not make sense to you. IVs don't make breaking a ciphertext harder. IVs are ususlly just prepended to the ciphertext and hence known to a potential attacker.

The main reason to use IVs is to randomize the ciphertext. If you encrypt the same plaintext twice with the same key, but different IVs then the ciphertext should be different. Ideally an attacker should not be able to tell if two ciphertexts correspond to the same plaintext or different plaintexts of the same length. More formally, IVs are used so that the encryption has ciphertext indistinguishability.

like image 187
Accipitridae Avatar answered Apr 28 '23 10:04

Accipitridae