Earlier quoted context omitted.
That'll make an attack significantly more time-consuming, but won't prevent it. Instead of instand feedback whether they guessed correctly, an attacker would instead need to send a bunch of requests to determine if the average request size has decreased.
What if the number of padding bytes is a function of the contents?
“Should you encrypt or compress first?”
61–70 of 249 posts
Re: “Should you encrypt or compress first?”
#62There's no compress or encrypt _first_. It's just compress or not, before encrypting. If security is important, the answer to that is no, unless you're an expert and familiar with CRIME and related attacks. Compression after encryption is useless, as there should be NO recognizable patterns to exploit after the encryption.
> If security is important, the answer to that is no It's a little more nuanced than that. Compression may cause information leaks or it can prevent them depending on the circumstances. If you're encrypting an audio stream, then compressing it first can cause leaks. If you're encrypting a document, then compressing it first may prevent leaks.
I think this is only true if you use a bad encryption algorithm where same plaintext blocks have the same ciphertext.
Re: “Should you encrypt or compress first?”
#63Earlier quoted context omitted.
I think, you mean whether to encrypt or sign first.
Good catch! Although the article talks about encrypt+sign versus sign+encrypt, the same argument goes for compress+sign versus sign+compress.
Is there a non obvious problem with sign then compress/encrypt then sign again? (overcomplicated or unnecessary?)
Re: “Should you encrypt or compress first?”
#64Earlier quoted context omitted.
> If security is important, the answer to that is no It's a little more nuanced than that. Compression may cause information leaks or it can prevent them depending on the circumstances. If you're encrypting an audio stream, then compressing it first can cause leaks. If you're encrypting a document, then compressing it first may prevent leaks.
Are you talking about compressing plain text larger than a block, then encrypting per each block of the compressed output?
Stream ciphers.
Re: “Should you encrypt or compress first?”
#65There's no compress or encrypt _first_. It's just compress or not, before encrypting. If security is important, the answer to that is no, unless you're an expert and familiar with CRIME and related attacks. Compression after encryption is useless, as there should be NO recognizable patterns to exploit after the encryption.
This is exactly what the article says.
I may be too close to the problem. I've had to explain this to project managers and customers of course, but this is hacker news.
It feels like a three page article on why you should put your socks on before your shoes and not after.
Re: “Should you encrypt or compress first?”
#66Earlier quoted context omitted.
>Compression after encryption is useless, as there should be NO recognizable patterns to exploit after the encryption. Not to nitpick, but this is incorrect. A encrypted file can very well have something like 100 X's in a row which the compression system could turn from XXXXXXXXXXXXXXXX.... into (100 x's go here) - Lousy example I know but it gets the point across. Its also easy enough to test- Just encrypt a file th…
No. If the encrypted output is randomly distributed, as it should be, then the expected number of bits cannot be reduced through compression. If it successfully compresses some files, it will make some files larger. For random data, the change will be negligible with overwhelming probability, plus there will be overhead.
That's a text file, which doesn't use the full range of a byte (0-255), so each character takes less than a byte.
Re: “Should you encrypt or compress first?”
#67Earlier quoted context omitted.
No. If the encrypted output is randomly distributed, as it should be, then the expected number of bits cannot be reduced through compression. If it successfully compresses some files, it will make some files larger. For random data, the change will be negligible with overwhelming probability, plus there will be overhead.
@DanBlake That's a text file, which doesn't use the full range of a byte (0-255), so each character takes less than a byte.
Re: “Should you encrypt or compress first?”
#68There's no compress or encrypt _first_. It's just compress or not, before encrypting. If security is important, the answer to that is no, unless you're an expert and familiar with CRIME and related attacks. Compression after encryption is useless, as there should be NO recognizable patterns to exploit after the encryption.
This is exactly what the article says.
Re: “Should you encrypt or compress first?”
#69Earlier quoted context omitted.
> If security is important, the answer to that is no It's a little more nuanced than that. Compression may cause information leaks or it can prevent them depending on the circumstances. If you're encrypting an audio stream, then compressing it first can cause leaks. If you're encrypting a document, then compressing it first may prevent leaks.
> If you're encrypting a document, then compressing it first may prevent leaks. I think this is only true if you use a bad encryption algorithm where same plaintext blocks have the same ciphertext.
Re: “Should you encrypt or compress first?”
#70Earlier quoted context omitted.
No. If the encrypted output is randomly distributed, as it should be, then the expected number of bits cannot be reduced through compression. If it successfully compresses some files, it will make some files larger. For random data, the change will be negligible with overwhelming probability, plus there will be overhead.
Using a random text generator http://pasted.co/encrypted.txt ( 10,002 bytes ) Then compressed it with winrar http://pasted.co/compressed.rar ( 7,743 bytes ) Roughly 20% compression isnt meaningless- so I fail to see why you are just giving a flat 'no' when its obvious what you are saying is untrue.