16

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

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
RichMo
  • 161
  • 1
  • 1
  • 3

1 Answers1

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
Michael D.
  • 928
  • 5
  • 11
  • 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 Apr 07 '17 at 15:09
  • if your user is named `mypath` the do a `chown mypath:mypath ~/.gnupg/gpg.conf` – Michael D. Apr 07 '17 at 15:35
  • Looks like I do not have permissions. Waiting on the NetAdm to provide those. – RichMo Apr 07 '17 at 18:00