I received an file encrypted with the public key I generated but I can't get it to decrypt.
Steps:
gpg --gen-key
default optionsgpg --export -a <email> > pub.key
- sent the pub.key
- received the encrypted file
cat <file> | gpg
The error:
$ cat cred.gpg | gpg
gpg: key 71980D35: secret key without public key - skipped
gpg: encrypted with RSA key, ID 0D54A10A
gpg: decryption failed: secret key not available
However, the secret key DOES exist in my keyring and the public key i generate from it matches the fingerprint of the pub.key i sent to my coworker.
$ gpg --list-secret-keys
/home/jcope/.gnupg/secring.gpg
------------------------------
sec 2048R/71980D35 2016-03-04
uid me <email>
ssb 2048R/0D54A10A 2016-03-04
Checking the fingerprint
$ gpg --with-fingerprint pub.key
pub 2048R/AF0A97C5 2016-03-04 me <email>
Key fingerprint = 17A4 63BF 5A7D D3B2 C10F 15C0 EDD6 4D8A AF0A 97C5
sub 2048R/1103CA7C 2016-03-04
$ gpg --fingerprint | grep 17a4 -i
Key fingerprint = 17A4 63BF 5A7D D3B2 C10F 15C0 EDD6 4D8A AF0A 97C5
I'm a gpg newby and at a loss for why this isn't working. It seems like the most standard operation.
Best Answer
Note the error message: it doesn't say that the secret key is missing (it isn't), it says the public key is missing.
gpg: key 71980D35:
secret key without public key- skipped
In RSA, some numbers (d, p, q, u) are private and others (n, e) are public. Only the 2 public numbers are required for encryption and signature verification while all 6 numbers are required in order to decrypt and sign. So for the latter operations, you actually need both the secret and public keys.
Did the public key get deleted from the
pubring
by accident?You can try re-importing the public key. Since the public key is the one that is distributed widely, it should be easy to re-obtain a copy of it.