0

I'm trying to decrypt a file but I get the following:

gpg <file name>
gpg: encrypted with 2048-bit RSA key, ID 4A83B612, created 2018-02-19
      "user <email>"
gpg: decryption failed: secret key not available

When I list my keys using:

gpg --list-keys

Here is the result:

    pub   2048R/0BBBBDB3 2018-02-19
    uid                  user <email>
    sub   2048R/4A83B612 2018-02-19

I understand that the sub key doesn't seem to be recognized.

2 Answers2

1

To decrypt you need the private key. Have a look at https://www.gnupg.org/gph/en/manual/x110.html:

If you want to encrypt a message to Alice, you encrypt it using Alice's public key, and she decrypts it with her private key. If Alice wants to send you a message, she encrypts it using your public key, and you decrypt it with your key.

As the documentation states, only the recipient you specify by --recipient when encrypting can decrypt the message.

So in summary:

  1. Encrypting uses the public key of the recicipient
  2. Decrypting uses the private key of the recipient
koffeinfrei
  • 1,985
  • 13
  • 19
  • Thank you for your reply. When I encrypted the file, I only used my public key since I was trying to encrypt a file for myself (no recipient). – Jean Jean Oct 13 '18 at 09:44
  • 1
    Yourself is also a recipient. You need to have the private key for "user " to decrypt. As stated in your comment above you don't seem to have the private key, which is why you can't decrypt. – koffeinfrei Oct 13 '18 at 10:19
  • I can see my private key in the GNU Privacy Assistant - Key Manager (a pair of yellow and blue keys) but the output of gpg --list-secret-keys is still blank. – Jean Jean Oct 14 '18 at 09:31
0

I managed to have an output of gpg --list-secret-keys

I still can't decrypt the file though. Here is the output of gpg --output doc --decrypt doc.gpg:

gpg: encrypted with 2048-bit RSA key, ID 4A83B612, created 2018-02-19 "user " gpg: decryption failed: secret key not available