failed to convert unprotected openpgp key: Checksum error

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


Hi

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:
https://gist.github.com/skissane/3d1109708be0d4167d8cf16db5fa2e3c

(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:
https://gist.github.com/skissane/d8291e9719d43bfb5eee58ee579c76fb

Like so: ./testGpg.sh 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.

Thanks
Simon



More information about the Gnupg-users mailing list