Does PGP work like Zip sometimes?

1

1

Can you put multiple files in a GPG/PGP encrypted file?

Just wondering.

Daniel

Posted 2009-11-30T16:48:15.217

Reputation: 1 365

Answers

5

On Linux, I'd tarball and compress the files first, then encrypt them. I do not believe GPG can encrypt multiple files in one go.

Broam

Posted 2009-11-30T16:48:15.217

Reputation: 3 831

Nothing wrong with tarballing first, but actually you can encrypt and decrypt multiple files in one go with the --encrypt-files and --decrypt-files options. For example: gpg -a --encrypt-files -r 0xDEADBEEF *.txt # this will result in a .txt.asc file for each .txt file which is encrypted to 0xDEADBEEF – Ben – 2015-06-19T10:00:14.290

3

Spot-on. PGP/GPG does encryption. In order to encrypt multiple files, you'd need to archive them in something like tar, zip, rar, etc. The newfangled commercial Windows versions of PGP may be able to do such thing (see the PGP-Zip). I do know that GPG and "classic" command line PGP does not.

– Geoff Fritz – 2009-11-30T17:13:13.920

1GPG probably never will; the idea is that you can simply encrypt a tarball instead. tar is a lot better at concatenating files than gpg is; if something replaces tar you can still use gpg to encrypt the new program's output rather than having to fix gpg to support that new file format.

Notably there are exceptions to this (tar will automatically handle gzip/bzip2 files) but it's been important to Unix, Linux, GNU et al. to swap out parts of the toolchain when needed. – Broam – 2009-11-30T18:22:54.870

2GPG and PGP do compression (to increase security) - so encrypting a .tar is enough, no need to gzip it. – user1686 – 2009-11-30T20:14:17.330