I am trying to encrypt a file locally and I get an error. me@example.com is a placeholder for my email address, a public key exists for that in my keyring and also on key servers. My private key is located on a hardware key (Yubikey). I can decrypt previously encrypted files with no problem. Here is the error:

➜  ~ gpg -e -r me@example.com somefile.txt 
gpg: error retrieving 'me@example.com' via WKD: General error
gpg: me@example.com: skipped: General error
gpg: somefile.txt encryption failed: General error

What does this error mean and how can I solve it?

P.S. There is only one more thing that might be related. My public key is expired.

  • 3
    WKD is the web key directory. Is adding the -vv option providing more insight what's going wrong? – Jens Erat Nov 19 '17 at 13:48
  • Adding -vv prints four more lines, three of them being gpg: Note: signature key ... expired and the last one gpg: <ke_id> skipped: Unusable public key. Apparently everything boils down to the key being expired. – Mehdi Sadeghi Nov 19 '17 at 21:16
  • Extending the key solved the problem. – Mehdi Sadeghi Nov 19 '17 at 21:23
  • Glad you figured it out on your own. Feel free to add this as an answer -- this seems a rather new combination of weird error message and actual issue. – Jens Erat Nov 19 '17 at 21:55

Extending key expiration date fixed the problem. The error message was misleading. However adding -vv as Jens Erat suggested produced some useful error messages such as gpg: Note: signature key ... expired and gpg: ... skipped: Unusable public key that helped finding the actual error.

| improve this answer | |

I had the same error but slightly in a different situation (and on Windows :P).

I had an SSIS package with EXEC task with a command to execute gpg.exe. Everything was working fine in the cmd.exe. However, I had the above error when I was trying to run a job with this package in the SQL Server job.

The solution was to run the GPA program as db_agent user and then I saw that there was no related public key for this user. So adding key for another user helped.

| improve this answer | |

The other answer to this is there could be an expired sub-key as well. Just renew the expiration date on that one.

| improve this answer | |

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.