Cryptlib fails to load a private key from an openpgp keyset

Lahiru Dissanayake <[email protected]> Tue, 2 Jul 2013 13:52:50 +0800
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <CAHeAcfB0TK3z-1omr56_KqpnZiXpoF2WLw2K=ef2KkLvVPx3fg@mail.gmail.com>
Hi Peter,

I've been using Cryptlib for various openpgp operations for a while now and
it's been working great. However, every once in a while I come across a pgp
keyring from which Cryptlib cannot load a private key. I've attached such a
file to this email.

I can load the file to a keyset using:

CRYPT_KEYSET pgpKeyset;
int status = cryptKeysetOpen(&pgpKeyset, CRYPT_UNUSED, CRYPT_KEYSET_FILE,
fileLocation, CRYPT_KEYOPT_READONLY);

And I can load the public key with:
CRYPT_CONTEXT pgpPublicKeyContext;
status = cryptGetPublicKey(pgpKeyset, &pgpPublicKeyContext, CRYPT_KEYID_NAME,
"[email protected]");

But when I try to get the private key using:
CRYPT_CONTEXT pgpPrivateKeyContext;
status = cryptGetPrivateKey(pgpKeyset, &pgpPrivateKeyContext,
CRYPT_KEYID_NAME, "[email protected]", "uR}=hu:MIn7!bvqrW0Y$Xa~e&=B5T`3u");

the returned status is -26 (CRYPT_ERROR_INVALID).

However gpg can import this and use it to decrypt a file without any
issues. As mentioned in the code, the username is "[email protected]" and the
passphrase is "uR}=hu:MIn7!bvqrW0Y$Xa~e&=B5T`3u".

Could you please run it through Cryptlib and see what the problem is? I'm
using Cryptlib version 3.4.2 with the fixes you've mentioned in reply to my
bug reports.

By the way, are you planning to release a new version of Cryptlib anytime
soon? Will you be posting it on the mailing list when you do?
Thanks,
Lahiru

_______________________________________________
Cryptlib mailing list
[email protected] via Mail: [email protected]
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.
user5secretkey (application/octet-stream, 1.2 KB) - not displayed