Importing an OpenPGP keyring to Cryptlib
Lahiru Dissanayake <[email protected]> Thu, 14 Feb 2013 15:41:18 +0800
| Newsgroups | gmane.comp.encryption.cryptlib |
|---|---|
| Message-ID | <CAHeAcfBT6uL1hm52s6DeE1AANWA5QrrXy_a0OCVaYM4tFFwaOg@mail.gmail.com> |
Hi,
I'm trying to import a public/private key pair generated by GPG into
Cryptlib (exported as binary, Cryptlib doesn't seem to work with ascii)
through an OpenPGP keyset. I tried the following code:
CRYPT_KEYSET pgpKeyset;
status = cryptKeysetOpen(&pgpKeyset, CRYPT_UNUSED, CRYPT_KEYSET_FILE,
fileLocation, CRYPT_KEYOPT_READONLY);
CRYPT_CONTEXT pgpPublicKeyContext;
status = cryptGetPublicKey(pgpKeyset, &pgpPublicKeyContext, CRYPT_KEYID_NAME,
"cryptlib");
CRYPT_CONTEXT pgpPrivateKeyContext;
status = cryptGetPrivateKey(pgpKeyset, &pgpPrivateKeyContext,
CRYPT_KEYID_NAME, "cryptlib", "11111");
("11111" was the passphrase I used to protect the secret key)
When I run this, I get CRYPT_ERROR_WRONGKEY as the result of the
cryptGetPrivateKey
function. But I get CRYPT_OK from cryptGetPublicKey. Any idea what I'm
doing wrong here?
Another strange thing is that if I don't call cryptGetPublicKey first, the
return value of cryptGetPrivateKey changes to CRYPT_ERROR_NOTFOUND.
I've attached the binary file exported from GPG which is loaded into the
keyset, if you want to take a look.
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.
gpg_gen_key.gpg
(application/octet-stream, 3.6 KB) - not displayed