Monday 4 October 2010

GnuPG: “decryption failed: secret key not available”

I just tried importing GnuPG keys from one account to another on my system. After that I was unable to encrypt or decrypt any messages. Here is the error which was found to be bailing out:
GnuPG: “decryption failed: secret key not available”

It is resulted because I just imported only the public keys from backup. Private keys are very much essential in-case you want GPG keys to work for encrypting and decrypting messages.

To ensure private keys are also copied into your existing account, use –allow-secret-key-import option along with –import as shown below.
gpg –allow-secret-key-import –import

Once this is done, you will be able to smoothly encrypt and decrypt the messages just like earlier. While taking backups of GnuPG keys etc, you must keep this point in mind.

No comments:

Post a Comment