16

How can I decrypt a .pgp file to .txt file using a key(.asc file) with the Linux command line.

1 Answer 1

18

Import your private key:

cat mykey.asc # should start with
-----BEGIN PGP PRIVATE KEY BLOCK-----
gpg --import mykey.asc

Check if it shows up:

gpg --list-secret-keys

Decrypt a message:

gpg --output ./decrypted_msg.txt --decrypt ./encrypted_msg.txt
3
  • when I do the 'gpg --import filename.asc' it returns an error: gpg: WARNING: unsafe ownership on configuration file `/home/mypath/.gnupg/gpg.conf'
    – RichMo
    Commented Apr 7, 2017 at 15:09
  • if your user is named mypath the do a chown mypath:mypath ~/.gnupg/gpg.conf
    – Michael D.
    Commented Apr 7, 2017 at 15:35
  • Looks like I do not have permissions. Waiting on the NetAdm to provide those.
    – RichMo
    Commented Apr 7, 2017 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .