Using GPG for encrypting directories

Neil Williams
Wed Sep 17 23:52:02 2003

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Description: signed data
Content-Disposition: inline

On Wednesday 17 Sep 2003 8:51 pm, Paul Jahshan wrote:
> Hi all,
> I want to use GPG for local encryption only, and after reading the man
> file, I'm doing the following in order to encrypt a whole directory:
> I zip the directory with a password "zip -r -e foo foo", then I encrypt
> it with "gpg -c" using a passphrase.
> Is this an elegant and secure way of encrypting directories? Am I using
> GPG's full cryptographic power? Are there better alternatives?

As with all decisions like this in GnuPG, it depends on just how paranoid y=
want to be. A few pointers:

1. If, as it sounds, the data exists on the hard disc unencrypted at any ti=
then the easiest way to crack it is to ignore the archive and concentrate o=
recovering the erased data directly from the filesystem. This can be made=20
more difficult if you use the 'shred' command instead of 'rm' but if the=20
attacker is willing to simply throw more and more computing power/time/mone=
at it, the chances are that at least some of the raw data can be recovered.=
(Some would say that the only truly secure way of erasing data from a=20
harddrive involves a blowtorch and a sledgehammer.)

2. If the data only exists in memory before encryption, you still need to=20
consider swap space if you are being truly paranoid. This would be possible=
to secure fully for encryption of data entered at the gpg command line, but=
not for your purposes.

3. If the archive itself is to be attacked, you could use a longer key, tak=
extreme care with the passphrase and the secret key itself.

Overall, you need to consider just how likely an attack really is and how=20
determined an attacker is likely to be. The weakest parts of any encryption=
are the areas outside the encryption itself - preparing/collating the data =
be encrypted, storing the decryption tools and social engineering.

You say this is for local encryption only - in that case, from whence would=
the attack be made? You seem to be anticipating an attacker to already have=
login access to your home directory - that would be the first route to be=20
made secure. Secondly, anyone with physical access to your machine can eras=
the BIOS password, use a bootable device to override your OS and then use=20
data recovery tools on the original data - ignoring the archive completely.=
Only once these easier methods are secured does the method of encryption=20
become relevant.

An attacker will only attempt to force the encryption if all other methods=
have been fully secured - something that is fairly unlikely in most routine=


Neil Williams

Content-Type: application/pgp-signature
Content-Description: signature

Version: GnuPG v1.2.1 (GNU/Linux)