The following code fails on Windows but works perfectly on Solaris. 
The failure is PEM_read_bio_X509 return null. FYI, I am trying to avoid 
buffered I/O (FILE *) and hence i am using low-level file operation.

Please help.
Vijay

        BIO *data;
        char buf[1024*4];
        memset(buf, 0, sizeof(buf) );
        int fd;
        X509 *cert;

        fd= open(file, O_RDONLY|O_BINARY, 0644);

        data= BIO_new_fd(fd, BIO_NOCLOSE);

        BIO *buffer = BIO_new(BIO_f_buffer() );
        BIO_push(buffer, data);

        cert= PEM_read_bio_X509(buffer, NULL,
                     
ctx->default_passwd_callback,ctx->default_passwd_callback_userdata);

        res=SSL_CTX_use_certificate(ctx,cert);
printf("Result = %d \b", res );
        if ( fd) {
           close(fd);
        }
        BIO_free_all(buffer);




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

Reply via email to