0
$\begingroup$

I want to know why in the CBC cipher, if we truncate the first block in the ciphertext then the corresponding plaintext block is truncated in the same way. I have an equation for the plaintext $m_i$ in terms of the ciphertexts $c_i$, $c_{i+1}$ so that the ciphertext corresponding to $m_i$ is $c_{i+1}$.

$$m_i = c_i \oplus D_k(c_{i+1})$$

Here I am skeptical about the random IV and its effect and that it may have.

$\endgroup$
2
  • 2
    $\begingroup$ Are you truncating the last block as stated, or truncating the message from it's whole last block? If removing 1 byte from the last block removes 1 byte from the deciphered plaintext (and blocks are more than 1 byte), the simplest explanation is that this is not CBC. $\endgroup$
    – fgrieu
    Commented May 2 at 18:32
  • $\begingroup$ @fgrieu Ok i realised that this is actually a flawed question the way i wrote it. I need to actually see what happens when the first block is truncated instead of the last block. I have edited it now $\endgroup$
    – revision
    Commented May 2 at 19:07

1 Answer 1

2
$\begingroup$

I want to know why in the CBC cipher, if we truncate the first block in the ciphertext then the corresponding plaintext block is truncated in the same way.

If you totally remove the first block, then the decryption will have the first block as gibberish, and the rest of the blocks will be the original third onwards of the original plaintext.

This can be seen from the decryption equation $p_i = c_{i-1} \oplus D_k(c_i)$; for the first block of the truncated decryption, the decryptor won't have the correct value for $c_{i-1}$ (that's the block you truncated), and so the first $p_i$ will be gibberish. For the rest of the blocks, you do have valid $p_{i-1}, c_i$ pairs, and so the decryption works on those blocks.

On the other hand, if you partially remove the first block (for example, trim off the first 5 bytes), then the entire decryption will be gibberish, as the intended ciphertext blocks will not align with the blocks that the decryptor actually sees.

$\endgroup$
1
  • $\begingroup$ Addition: in CBC, if the IV is considered to form the first block of ciphertext and removed (so that decryption uses as IV the first block produced by the original encryption), then decryption yields the original plaintext truncated from the first block. $\endgroup$
    – fgrieu
    Commented May 3 at 3:48

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.