On Thu, Jul 21, 2005, Edward Chan wrote: > The code is basically like this: > > int len = i2d_RSAPublicKey(rsa, 0); > > // allocate buffer > unsigned char* buf = new unsigned char[len]; > > // now call again to DER encode the public key > if (i2d_RSAPublicKey(rsa, &buf) == len) > { > > I've also tried creating the RSA object first, and passing it into > d2i_RSAPublicKey() for it to fill in. It also returns me null back. > Does the code look right? >
No, this code is wrong for the reasons mentioned in the FAQ. After this call 'buf' points to garbage and that's why d2i_RSAPublicKey() is failing. 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]