Thursday, September 13, 2012

gpg: decryption failed: No secret key


I installed gpg2 on my Mac. I encrypted my file and then tested and was able to decrypt my file just fine. So, I deleted the original file after I created my encrypted file. Two days later, I go to decrypt my file and what do I get? I get the below error message. I can't believe this. Why can't it find my private key?

Mac-mini:~ user$ gpg2 -d myfile.gpg

You need a passphrase to unlock the secret key for
user: "user <user@hotmail.com>"
2048-bit RSA key, ID 4E4D9FAB, created 2012-09-12 (main key ID D3C64D14)

gpg: problem with the agent: End of file
gpg: encrypted with 2048-bit RSA key, ID 4E4D9FAB, created 2012-09-12
      "user <user@hotmail.com>"
gpg: public key decryption failed: Operation cancelled
gpg: decryption failed: No secret ke
y

I did a little googling and realized that the problem is the agent.

So, I figure, I will just look for the gpg-agent process and kill it. Here are the steps

Mac-mini:~ user$ ps -eaf | grep gpg
  501  3501     1   0 Wed04PM ??         0:02.62 gpg-agent --daemon --use-standard-socket
  501  7833  7603   0  7:12PM ttys000    0:00.00 grep gpg


and then...

Mac-mini:~ user$ sudo kill 3501

and then...

everything started working again!

No comments:

Post a Comment