Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Would changing 1 byte in a file encrypted by AES CBC cause it to not be able to decrypt anymore?

If I have an encrypted file that is encrypted with AES CBC, would changing a random byte somewhere in the file cause it so that it would no longer be able to be decrypted?

Is my understanding correct that everything up to the point where the byte was changed would decrypt okay, but from then on afterwards it wouldn't decrypt?

like image 576
Kyle Avatar asked Mar 17 '12 00:03

Kyle


People also ask

Does AES encryption change file size?

AES does not expand data. Moreover, the output will not generally be compressible; if you intend to compress your data, do so before encrypting it. However, note that AES encryption is usually combined with padding, which will increase the size of the data (though only by a few bytes).

Can AES encryption be broken?

AES 256 is virtually impenetrable using brute-force methods. While a 56-bit DES key can be cracked in less than a day, AES would take billions of years to break using current computing technology. Hackers would be foolish to even attempt this type of attack. Nevertheless, no encryption system is entirely secure.

Can AES encryption be decrypted?

Only those who have the special key can decrypt it. AES uses symmetric key encryption, which involves the use of only one secret key to cipher and decipher information.


1 Answers

That is not quite correct. AES encrypts/decrypts data in blocks (128-bit blocks, specifically). Additionally, in CBC mode, the encryption/decryption of the (i+1)th block depends on the (i)th block.

So if the random byte falls within the ith block (let's assume for simplicity that the byte doesn't cross between two blocks), when you go to decrypt the ith block, it will give you the wrong decryption (i.e. a block of 128 bits will be incorrect). Additionally, since the next block was encrypted using the ith block, the (i+1)th block will also decrypt incorrectly (another 128 bits aka 16 bytes). From there, the subsequent blocks will be correct (as will all of the previous blocks).

For more info, I'd read about Modes of Encryption on wikipedia.

One more thing: changing the random byte will likely not prevent decryption from happening - it will just not yield the original plaintext (of course).

Hope that helps!

like image 120
mfsiega Avatar answered Sep 29 '22 00:09

mfsiega