2
$\begingroup$

This question already has an answer here:

What's the difference between encrypting a file and packing it?

Can I encrypt a file that is already packed? Can I pack a file that is already encrypted, or does packing already do both?

If I pack a .exe file will it be considered as encrypted?

$\endgroup$

marked as duplicate by otus, e-sushi Sep 16 '16 at 21:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ That's not an exact duplicate, but if it leaves some question unanswered, please edit your post to specifically ask that. (And try to avoid asking many things in one question.) $\endgroup$ – otus Sep 13 '16 at 10:01
2
$\begingroup$

No, packing an executable is not just like encrypting it. The difference is that to use an encrypted executable, a secret key/passphrase is necessary, beyond the method/program to do the decryption (typically public, sometime embedded). By contrast, no key is required to run a packed executable, and how to use it often reduces to: just run it as usual; a clever piece of built-in code (a self-decompressing header) will do the rest.

Yes, you can (and it is common to) encrypt a file that is already packed/compressed, including an executable, including a self-decompressing executable, perhaps even producing a self-decrypting-then-decompressing executable; however the latter is not recommendable: it works in a world of fairy where executable file format is clearly defined, is respected by the self-decompressing header, and does not trigger a bug in the self-decrypting header.

There's nothing to prevent you from trying to pack/compress a file that is already encrypted (except if you want the result directly executable and the fairy did not bless, see above). However, that will often increase the size. There are exceptions: for example, if the encryption used ASCII armor, and the packing does not, there will likely be a moderate size gain.

Some programs pack/compress, some encrypt, some do both in one use (these are typically encryption programs happening to use compression; e.g. PGP/GPG). That's true both for general files, and when it comes to executables that remain directly executable (typically, after entering a passphrase/key if encryption was performed).

From the standpoint of cryptography, packing/compression is not encryption. A virus checker, security auditor, or perhaps customs officer, might nevertheless treat a packed file or executable as if it was encrypted, on the grounds that it is not as easily amenable to scrutiny as if it was not packed, or just as the result of some poor choice.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.