Here's a hint:

You are creating a DER encoded RSA public Key - you are trying to read a DER 
encoded X.509 certificate. These are not the same thing.

Have fun.

Patrick.

On 2010-11-10, at 9:06 PM, furrbie wrote:

> 
> Hi,
> 
> I am trying to read in a DER encoded RSA public key using d2i_X509_fp();
> 
> I have generated an RSA key using openssl with the following commands:
> 
> 1. openssl genrsa -out privkey.pem 2048
> 2. openssl rsa -pubout -in privkey.pem -out pubkey.der -outform der
> 
> In my C++ program, I coded the following:
> FILE *fp = fopen("pubkey.der", "rb");
> X509 *x = d2i_X509_fp(fp, NULL);
> 
> However, x returns NULL after this point. How do I get a valid X509
> structure from a DER encoded cert?






______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to