fp is not NULL;

But perhaps my certificate has special contents, I can't imagine another
origin for that problem.
I can't post the certificate because it's a private one, sorry.

So can anyone explain me how to process whith specials content?

On an other hand, I've tried another solution:

    string certificateFile = "cert.pem";
    X509* cert;
    BIO* bio_cert = BIO_new_file(certificateFile.c_str(), "rb");
    PEM_read_bio_X509(bio_cert, &cert, NULL, NULL); 

At this time, I've not yet error. But my goal is to catch information on it,
so I try to read the name like that:

    X509_NAME * name=NULL;
    name=X509_get_subject_name(cert);

And....error!!!
:confused:


Moribius wrote:
> 
> Hi every body.
> 
> I need some help because I'm trying to read a PEM file using PEM_read_X509
> function,
> it's compiling but crash on this function when I execute the code.
> 
> This code is very simple and I don't understand what is the problem! 
> 
> int main (int argc, char * * argv)   
> {   
>    FILE *fp;   
>    X509 *x;   
> 
>    fp=fopen("cert.pem","r");
> 
>    x=X509_new();
>    PEM_read_X509(fp,&x,NULL,NULL);
>    //x=PEM_read_X509(fp,NULL,NULL,NULL);
>    fclose(fp);   
>    X509_free(x);   
>    return 0;
> }    
> 
> I really need some help, I'm so desesperate :,(
> Thanks a lot.
> 

-- 
View this message in context: 
http://www.nabble.com/Read-a-PEM-tp21056958p21072351.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to