13

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

11

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.