I have had issues with this before using windows. Add

CRYPTO_malloc_init();

the the begining of your code I have an IntOpenssl function I do this and the other OpenSSL stuff in.

Then switch your file pointers to BIO's I found this makes windows.

Perry



[EMAIL PROTECTED] wrote:

Hi,

I'm using windows  VC++ and I´m  having problems filling in an x509
structure from a DER encoded binary
certificate.  The execution of the program bellow stop when I call
d2i_X509_fp(fp,&x509Cert).

Please help.

Thanks,
  Geiza


#include <stdio.h>
#include <openssl/x509.h>

void main(void)
{
   X509 * x509Cert = NULL;
   FILE *fp;
   EVP_PKEY *      pkey;

   long version;
   char * s;

   if ((fp=fopen("C:\\SuperUsu.cer","rb")) != NULL)
   {

     d2i_X509_fp(fp, &x509Cert);

     if (x509Cert!=NULL)
        printf("\nReading success!\n");
     else
     {
        printf ("\nError reading certificate!");
        exit (1);
    }

}


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to