5
$\begingroup$

When changing a (small) part of the plaintext of a CBC-encrypted file, how much of the file will have to be rewritten?

My suspicion is that everything after the modified block will have to be decrypted and reencrypted as well, due to the changes of the ciphertext blocks cascading through the rest of the file.

$\endgroup$
8
$\begingroup$

If you could use the same IV, then yes, you would need to rewrite everything after the modified block.

But you shouldn't do that; every time the contents change, you should generate a new IV, which would require the whole file to be rewritten. Otherwise an attacker can learn more information than it should about how the file changed (precisely by checking which blocks of the file have changed).

$\endgroup$
1
$\begingroup$

As @Conrado stated this should not be done as it leaks some information that can be used by an attacker in order to make some statistical analysis. According to theory this is the diffusion property that a cryptosystems must hold: One bit flipping in the plaintext must change as much as possible the the bits on the ciphertext. The linear parts of a block cipher as AES achieve this.

$\endgroup$

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.