Re:“Should you encrypt or compress first?”
by IncRnd on Tuesday June 28, 2016 @12:10PM
(#11994905)
Are you talking about compressing plain text larger than a block, then encrypting per each block of the compressed output?
[ Parent
| on HN ]
Yes, of course. What would be the alternative?
Thank you. Your comment wasn’t clear for several reasons. Stream ciphers are regularly blocked in TLS, compression can occur per block. Compression may be done per block, not just against a file larger than a single block.
Re:“Should you encrypt or compress first?”
by witty_username on Tuesday June 28, 2016 @12:22PM
(#11995028)
@lisper
Stream ciphers.
Why would you use a stream cipher to encrypt a document?
In GCM, the 'C' is for counter, and hence turning AES into a stream cipher. This part is usually known as 'AES-CTR'. The 'G' is Galois for 'Galois field multiplication', which allows for a parallelizable way of computing a MAC. AES-GCM packages AES-CTR (a stream cipher made from a block cipher) and GMAC (the Galois MAC) together into a primitive. This type of scheme, which combines confidentiality, integrity, and authenticity is called 'authenticated encryption with associated data' (AEAD) [1]. A stream cipher is the easiest way of accomplishing that the cipherstream will safely expand to cover all the plaintext.
Other famous AEAD schemes are:
- CCM (Counter with CBC-MAC), packages AES-CTR and CBC-MAC together in an authenticate-then-encrypt regime
- ChaCha20-Poly1305, which packages together the stream cipher ChaCha20 and the MAC Poly1305.
The AES-GCM mode of operation turns the AES block cipher into a stream cipher. Doing this makes it possible to add authentication on top for relatively cheap. The ChaCha20-poly1305 has a similar construction. These are the two most secure and efficient ciphers available in TLS, so they get a lot of use. If you are sending documents over HTTPS, you definitely want them encrypted with one of these two.
Fair enough, I concede the point.
Re:“Should you encrypt or compress first?”
by StavrosK on Tuesday June 28, 2016 @01:21PM
(#11995590)
Why wouldn't you?
http://security.stackexchange.com/questions/334/advantages-a...
Not that this really matters. The advantages/disadvantages of compression are the same in both cases.