Re: Cryptlib fails to load a private key from an openpgp keyset

Peter Gutmann <[email protected]> Sun, 07 Jul 2013 18:12:42 +1200
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <[email protected]>
Lahiru Dissanayake <[email protected]> writes:

>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).

It's an invalid RSA key.  cryptlib performs validity checks when it loads a
key, in this case for u = q^-1 mod p, u must be less than p, however for this
key it isn't.  What application generated the key?

If you need to use the key you can comment out the check:

  /* Verify that u < p, where u was calculated as q^-1 mod p ...

around line 380 of context/kg_rsa.c.

Peter.

_______________________________________________
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.