-1
$\begingroup$

please help me with this

What are the differences between Encrypt+Compress and Compress+Encrypt

When and where do we use them, explain it in a scenario

Thanks & regards Pavan

$\endgroup$
  • 3
    $\begingroup$ One is ineffective, the other one is insecure. $\endgroup$ – Maeher Aug 21 '17 at 16:15
4
$\begingroup$

Attempting to compress encrypted data will generally fail: It's impossible to compress high-entropy (random) data, and encrypted data is typically indistinguishable from random data. (The actual security guarantees may not include indistinguishability from randomness, but often still result in that property being satisfied). So Encrypt then Compress is the ineffective one.

Compress + Encrypt will work and reduce the size of the ciphertext, but ruins security. The compression ratio of the plaintext can leak, which reveals information to the attacker about the content of the plaintext. This is what lead to the CRIME and BREACH attacks on TLS. So Compress then Encrypt is the insecure one. Compress + Encrypt can be secure for storage of data at rest, eg full-disk encryption won't be compromised just because the disk contains compressed data.

$\endgroup$
  • 1
    $\begingroup$ May ruin security. You can for instance have constant bitrate compression, e.g. of the sort used in MP3. That would probably not leak data (if other side channel attacks are also taken care of, of course). $\endgroup$ – Maarten Bodewes Aug 21 '17 at 21:12
  • 1
    $\begingroup$ @MaartenBodewes: May be worth emphasizing that constant-bitrate compression makes sense only for lossy compression; otherwise the only constant-bitrate ‘compression’ functions are permutations which never actually compress. $\endgroup$ – Squeamish Ossifrage Aug 21 '17 at 21:15

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.