Hi,

Does anyone know if there is a difference between PEM_read_PrivateKey() and
PEM_read_bio_PrivateKey() function? I tried the following:

        char *keyfile = "key.pem";
        char *password = "xxxx";
        BIO *bio;
        bio = BIO_new( BIO_s_file() );
        BIO_read_filename( bio, keyfile );

        pkey = PEM_read_bio_PrivateKey( bio, NULL, NULL, password );

PEM_read_bio_PrivateKey() is working fine. If I use

        char *keyfile = "key.pem";
        char *password = "xxxx";
        fp = fopen (keyfile, "r"); if (fp == NULL) return;
        pkey = PEM_read_PrivateKey(fp, NULL, NULL, "my secret");

PEM_read_PrivateKey() will give me the errors

1364:error:20068078:BIO
routines:BIO_gets:uninitialized:.\crypto\bio\bio_lib.c:2
63:
1364:error:0906D06C:PEM routines:PEM_read_bio:no start
line:.\crypto\pem\pem_lib
.c:625:

Okay, I could use the bio function... Maybe I am doing something wrong?

Thanks,

Sascha

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

Reply via email to