Jean Jean
Jean Jean

Reputation: 1

Gnupg - Decrypt file

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.

Upvotes: 0

Views: 923

Answers (2)

Jean Jean
Jean Jean

Reputation: 1

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

Upvotes: 0

koffeinfrei
koffeinfrei

Reputation: 2045

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

Upvotes: 1

Related Questions