How do I use gpg to decrypt encrypted files????

Morten Gulbrandsen classpath at
Sat Sep 12 00:12:04 CEST 2009

Hash: SHA1

BosseB wrote:
> I have a number of encrypted files, which I need to decrypt. I have
> installed GPG 1.4.9 on my Windows XP-Pro SP3 PC. I have the necessary
> keyrings and they work with Thunderbird and Enigmail.
> But as I said I need to decrypt files that are on my hard disk, not in
> an email....

like this  symmetric only  to any password  to any key, if the
passphrase is known

bash-3.00$ ls -l   filename.txt
- -rw-r--r--   1 morten   other         12 Sep 11 19:31 filename.txt
bash-3.00$ cat  filename.txt
hello world
bash-3.00$ file  filename.txt
filename.txt:   ascii text
bash-3.00$ gpg  -c filename.txt
bash-3.00$ ls -l  filename.txt*
- -rw-r--r--   1 morten   other         12 Sep 11 19:31 filename.txt
- -rw-r--r--   1 morten   other         63 Sep 11 23:59 filename.txt.gpg
bash-3.00$ gpg  --decrypt  filename.txt.gpg
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
hello world
gpg: WARNING: message was not integrity protected

this is the easiest way and gives some security. There are options to
enforce   --cipher-algo AES256

- --cipher-algo oid
    Use the cipher algorithm with the ASN.1 object identifier oid for
encryption. For convenience the strings 3DES, AES and AES256 may be used
instead of their OIDs. The default is 3DES (1.2.840.113549.3.7).

like this

 gpg  -c  --cipher-algo  aes256  filename.txt

However decrypting a binary or ascii file to a certain key the result
may be binarty or ascii armored  like this

gpg --encrypt --armor   --recipient  AAA651B  filename.txt
#  AAA651B is example for the target key ID

or if you are happy with a binary result,  like this

gpg --encrypt   --recipient  AAA651B  filename.txt

On my system it works  easy, there are some videos on facebook and
perhaps youtube also explaining this more,

you will also need to sign it.

sincerely yours,


Version: GnuPG v1.4.9 (SunOS)
Comment: For keyID and its URL see the OpenPGP message header


More information about the Gnupg-users mailing list