Decrypting openpgp data created by gpg

Lahiru Dissanayake <[email protected]> Tue, 19 Feb 2013 18:42:38 +0800
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <CAHeAcfD+W2vDiDMLT4_f5s6qwz9Scw5-UnxmK8vrSWh=OzcXnQ@mail.gmail.com>
Hi,

I'm having a hard time decrypting openpgp public key encrypted data using
Cryptlib envelopes. The encrypted data in question was created using gpg.
All the status codes returned in the decryption process are normal, but the
data that's popped out is not equal to the plaintext. Here's the code that
I used for de-enveloping:

CRYPT_KEYSET pgpKeyset;
int status = cryptKeysetOpen(&pgpKeyset, CRYPT_UNUSED, CRYPT_KEYSET_FILE,
fileLocation, CRYPT_KEYOPT_READONLY);
status = cryptCreateEnvelope(&cryptEnvelope, CRYPT_UNUSED,
CRYPT_FORMAT_AUTO);
status = cryptSetAttribute(cryptEnvelope, CRYPT_ENVINFO_KEYSET_DECRYPT,
pgpKeyset);
status = cryptPushData(cryptEnvelope, envelopedData, envelopSize,
&bytesCopied);
status = cryptSetAttributeString(cryptEnvelope, CRYPT_ENVINFO_PASSWORD,
"password", 8);
status = cryptFlushData(cryptEnvelope);
char decryptedData[10000];
status = cryptPopData(cryptEnvelope, decryptedData, 10000, &bytesCopied);
cryptDestroyEnvelope(cryptEnvelope);

I've attached the plaintext file, keyring file and the encrypted file that
I'm trying to decrypt. Passphrase for the key is "password".
Generating/exporting the key and encryption were all done using gpg.

PS: I'm using libcl.a generated by the makefile on a Mac. When I invoke
testlib with -e flag, all tests complete successfully, so I hope it's not
an error on my end this time :)

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.
plaintext.txt (text/plain, 10 B)
plaintext
james_key.bin (application/octet-stream, 1.4 KB) - not displayed
plaintext.txt.gpg (application/octet-stream, 219 B) - not displayed