failed to convert unprotected openpgp key: Checksum error

Simon Kissane skissane at
Fri Jan 19 09:57:56 CET 2018


I have written some code in Java to generate private/public keys, and
export them in OpenPGP format (using BouncyCastle's OpenPGP classes).

However, when I try to decrypt data encrypted with the private key, I
get a "failed to convert unprotected openpgp key: Checksum error"

I presume there is something about the key file that GPG doesn't like?
But can anyone tell me what it is?

I am using GnuPG 2.2.4 on macOS 10.12.6.

Here is my private key:

(This is just a test key generated for testing purposes, so it is fine
to share it publicly.)

Now, run this script against that private key file:

Like so: ./ testPrivateKey.asc

You will note the errors from gpg-agent:

gpg-agent[29270]: failed to convert unprotected openpgp key: Checksum error
gpg-agent[29270]: failed to read the secret key
gpg-agent[29270]: command 'PKDECRYPT' failed: Checksum error
gpg-agent[29270]: DBG: chan_7 -> ERR 67108874 Checksum error <GPG Agent>

What confuses me is the key imports into the GPG home fine, the error
only happens when I try to use it to perform decryption. If the key
format was wrong, I would have thought the error would have happened
when I tried to import it.


More information about the Gnupg-users mailing list