0
$\begingroup$

I've been given a ciphertext message, encrypted using CBC. I know that the block size is 12 bytes and I know the plaintext value of the first block.

I also know that the encryption function is a simple XOR:

$$C_i = K \oplus (M_i \oplus C_{i-1})$$

where $C_0 = IV$.

Now I supposedly should be able to deduce the complete plain text message, but I'm lost. What sort of XOR'ing magic should I perform here to get hold of the plain text?

$\endgroup$
2
  • $\begingroup$ If you're doing this for a university assignment (removed that part from the question) then I would strongly recommend you to learn some $\TeX$ so you can format your formulas. It will come in handy later. Hit the edit button above to see the changes I made. $\endgroup$
    – Maarten Bodewes
    Commented Dec 11, 2016 at 13:41
  • $\begingroup$ Yes of course, you are right. I was in a bit of hurry when typing the question and intended on cleaning it up as soon as I had the chance. Thanks for doing it for me. $\endgroup$
    – mimos
    Commented Dec 11, 2016 at 13:50

1 Answer 1

0
$\begingroup$

That's easy: $C_1 = K \oplus (M_1 \oplus C_0)$. You know $C_1$, $M_1$ and of course $C_0$, the IV. You can easily rewrite this as $K = C_0 \oplus C_1 \oplus M_1$.

What is left is simply decryption with $K$. In case of XOR encryption, decryption is the same as encryption, so $M_i = (K \oplus C_i) \oplus C_{i-1}$.


Notes:

  • XOR is associative and commutative, so you can leave out the parentheses in the formulas and rewrite the formulas like I did above.
  • this will obviously not work with secure block ciphers since retrieving $K$ is not supposed to be possible, even when given a known plaintext / ciphertext pair.
$\endgroup$

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.