On Tue, Jul 19, 2005, Edward Chan wrote: > That part of the code remains the same, and continues to work fine. By > the way, my last code snippet should have been: > > U8* tmp = buf; > RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp, len); > > I mistakenly typed *len instead of len. > > Anyways, after I call i2d_RSAPublicKey, calling d2i_RSAPublicKey does > not seem to work. It always returns me a null ptr. But I know the RSA > object is fine. I can use it in RSA_public_encrypt() and > RSA_private_decrypt(). >
What makes you think the way i2d_RSAPublicKey is being called is producing valid data? Try dumping the data in 'tmp' to a file and using: openssl asn1parse -inform DER -in whatever if the result is an error message or what looks like garbage then its a problem with the usage of i2d_RSAPublicKey. If it looks like the public key components then it is OK. BTW is there some reason you are using the RSAPublicKey functions? If you use the RSA_PUBKEY versions instead the OpenSSL utilities will be able to check the format directly. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]