PGP command line decryption --- How to decrypt a file?

A public key was sent to me to decrypt the pgp-encrypted file, as well as the passphrase. I imported the key using:

gpg --import publickey.asc

And checking it with

gpg --list-keys

Now I am trying to decrypt the file. I put the passphrase in a file called pass.txt and ran it on the command line:

gpg -d encryptedfile.txt.pgp --output encryptedfile.txt

But I get:

gpg: encrypted with ELG-E key, ID XXXXXXXXX
gpg: encrypted with 2048-bit RSA key, ID XXXXXXXXX, created 2010-03-10
      "XXXXXXXXX XXXXXXXXX (XXXXXXXXX FTP Key) <XXXXXXXXX@XXXXXXXXX.org>"
gpg: decryption failed: secret key not available

If I do gpg -list-secret-keys, it’s not there ... How do I associate a passphrase with an imported key?

+5
source share
1 answer

For decryption, you usually need a private key for the key, not a public key. With public key encryption, data is usually encrypted with a public key and decrypted using a private key.

, "" - gpg.

+10

All Articles