1
$\begingroup$

Newbie question here but can I get the IV if I know the Key, plain text and chiper text ?

(I thought that if I encrypt 16 first bytes of clear with the key and 16 first bytes of cipher text as IV it would work to get original IV but it seems that it doesn't)

Thanks.

$\endgroup$
3
  • $\begingroup$ What's the equation relating the $i^\mathit{th}$ plaintext block $P_i$, the $i^\mathit{th}$ ciphertext block $C_i$, and cipher $E_k$ in CBC mode? Where does the initialization vector figure into it? $\endgroup$ Commented Nov 15, 2017 at 16:08
  • $\begingroup$ You mean that C0 = IV ? $\endgroup$
    – katze
    Commented Nov 15, 2017 at 16:11
  • $\begingroup$ That's part of it. How is $P_i$ related to $C_i$ for $i > 0$? $\endgroup$ Commented Nov 17, 2017 at 4:05

1 Answer 1

1
$\begingroup$

The IV is XOR'ed with the plaintext before encrypting the first block. You can get the input of the block cipher by decrypting the first block of ciphertext using the block cipher directly.

After that it is a simple operation to get the IV, of course, considering you know the plaintext and - hopefully - the mathematical properties of XOR.

$\endgroup$
3
  • $\begingroup$ @zaph Maarten is talking about a straight decryption of the first block w/o involving any modes, so you don't need an IV, BTW Maarten, you may want to add some mathy formulas to your answer for illustration $\endgroup$
    – SEJPM
    Commented Nov 15, 2017 at 19:50
  • $\begingroup$ OK, I finally see. Thx! $\endgroup$
    – zaph
    Commented Nov 15, 2017 at 19:58
  • $\begingroup$ @SEJPM This is commonly a question in crypto courses to test if the student understands the mode. This is why I left out the actual calculations and schematics. Usually there is not much use for retrieving the IV, especially if the plaintext is already known anyway. $\endgroup$
    – Maarten Bodewes
    Commented Nov 15, 2017 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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