Will changing 1 byte in a file encrypted by AES CBC cause it to no longer decrypt?

If I have an encrypted file encrypted using AES CBC, changing a random byte somewhere in the file will cause it to expand so that it can no longer be decrypted?

As I understand it, everything until the moment when the byte was changed will be decrypted well, but from that moment it will not be decrypted?

+6
source share
1 answer

This is not entirely correct. AES encrypts / decrypts data in blocks (in particular, 128-bit blocks). In addition, in CBC mode, the encryption / decryption of the (i + 1) th block depends on the (i) th block.

So, if a random byte falls into the i-th block (let's say for simplicity that the byte does not intersect two blocks), when you go to decrypt the i-th block, this will give you the wrong decryption (that is, a 128-bit block will be wrong). In addition, since the next block was encrypted using the i-th block, the (i + 1) -th block will also decrypt incorrectly (another 128 bits aka 16 bytes). From there, subsequent blocks will be correct (like all previous blocks).

For more information, I read about encryption modes on Wikipedia.

One more thing: changing a random byte, most likely, will not prevent decryption - it just will not give the original text (of course).

Hope this helps!

+8
source

Source: https://habr.com/ru/post/910962/


All Articles