Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's right, there's no guarantee the data hasn't been tampered with after encryption. The mechanics of the tampering you could do depend on the cipher mode you use.

To give a simplified example (which doesn't match what this program does but is useful to demonstrate), ECB is the simplest mode (which really shouldn't be used for anything). Your input is split into fixed-length blocks (16 bytes for AES) and each block is encrypted separately, producing a deterministic ciphertext for each block. (e.g. a block of all "A" will always encrypt to the same thing).

So if an attacker is able to figure out what plaintext a block of encrypted data corresponds to, they could use that knowledge to build a "fake" encrypted message. They could also remove blocks from a message, or shuffle them around.

If you're interested in playing around more practically with this kind of thing, I highly recommend the https://cryptopals.com/ challenge sets.



I just finished the first 11 challenges, including detecting ECB ciphers.

Thank you for sharing these! They are very fun and interesting challenges.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: