0

I read this blog which explains why this isn't possible but I can't seem to figure out the reason. I find the blog a little difficult to understand.

Can someone please explain why it's not possible to compress and encrypt the same folder or file ? A simple example would really go a long way in understanding the reasoning behind this.

Does encrypting a compressed file/folder increase it's size and hence defeat the purpose of compression ?
Similarly, does compressing an encrypted file/folder compromise the security of the file ?

If yes, how ?

4

Technically, you can run data both through an encryption operation and through a compression operation; however, this will usually not result in actually smaller data, which is probably why Microsoft designed NTFS to make the mutually exclusive and Windows blocks you from doing both (this is speculation, only Microsoft can really answer why they designed the NTFS filesystem to treat compression and encryption as mutually exclusive).

Lossless Compression (the kind used here, or in .zip or .rar or .7z archives) only works well when there is non-random data that it can simplify. Good encryption on the other hand intentionally tries to make the data appear random, so compressing encrypted data doesn't really make sense.

On the other hand, encrypting compressed data does make sense, and I'm not sure if there is some technical limitation on how EFS and compressed files are implemented in NTFS which prevents the compression from happening before the encryption. (As a general rule of thumb, encryption increases the size of the original data by about 50%)

0

NTFS file compression and file encryption are mutually exclusive because of the way NTFS compression is performed. You can use only one of these options at a time on a file.

http://support2.microsoft.com/default.aspx?scid=kb;en-us;Q223093

I'm guessing more specific details are not public.

0

Darth Android's answer is correct. But to answer your last question, you can compress encrypted files without compromising security. Compression is a form of encryption, so a compressed encrypted file is technically more secure. However, it is inefficient - which is probably why MS doesnt allow it.

  • Compression is form of security? Did not know. – Griffin May 28 '15 at 16:25
  • 1
    Compression is definitely not encryption. The compressed file is self-contained and can be unpacked without additional knowledge. Encryption, on the other hand, provides security by requiring additional information to derive a key. – Daniel B May 28 '15 at 16:28
  • @DanielB Compression by definition is encryption. If you were to compress a text file, would it read just like the original? No. It itsnt necessarily secure encryption, but most definitely is encryption. – Keltari May 28 '15 at 16:30
  • 1
    @Keltari "In cryptography, encryption is the process of encoding messages or information in such a way that only authorized parties can read it." (from wiki) Compression does nothing to restrict access to authorized parties, and therefore is not encryption. Encoding, perhaps, but not encryption. – Darth Android May 28 '15 at 16:33
  • @DarthAndroid It depends on your definition of encryption. There are plenty of resources out there that call compression a form of encryption. – Keltari May 28 '15 at 16:38
0

You can encrypt a compressed file but compressing an encrypted file should be useless. I'm going to give you an insanely oversimplified version but you should be able to get the idea.

I have the text:

Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever. Griffin is the coolest ever.

For simplicity purposes it'll we'll say the compression software does the following. It'll recognize there is a pattern in the text in this case "Griffin is the coolest ever." It'll take that patter and assign a numeric value to it we'll say 0. Then to compress it it goes "Griffin is the coolest ever." = 0. Text = [0][0][0][0][0][0][0][0][0][0]. This works because in language we use a lot of the same words / phrases / patterns. The actual software is far more advanced.

The problem comes if you try to compress encrypted information because of how seemingly random encrypted information should appear. If we encrypted the earlier text we should get something along the lines of

quhjio43huiot3rnswyj4hrtis;g4wrjhtpiomnkgq;eht89jiognkwusjnehtn;oiw354yjthineajqnh54y689uio6895uuyio32ujwuywun279y8uhwtjin2hywa9p88h3uj7py;huniysbjkr.5yh75o.ui4jn;jsrujio;hjmngkfukop;'jsmneklrtjhsgiodghnbgfdsjh;sklr65uij9ynrio;eiuyjyphiro;uj6;9ios5uy76895y9auy9htsuy7

Compression can't do much here because there aren't any patterns ... or at least shouldn't be considering I just ran my hands over the keyboard.

Also it's important to note that the compression should be loseless. Some compression methods, especially those that involve sound will cut out unwanted information such as sounds that are too high or too low for humans to hear. This is fine for sound but if you're compressing a report you probably don't want random sentences missing.

It's also worth noting that the current understanding is that compression weakens the security of encrypted information although it seems that there is a debate about this to be had.

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.