In message <[EMAIL PROTECTED]> on Fri, 23 May 2008 10:38:06 +0200, 
"delcour.pierre" <[EMAIL PROTECTED]> said:

pierre.delcour> I wrote this not working code:
pierre.delcour>     BIO *bout = BIO_new(BIO_s_mem());
pierre.delcour>     PEM_write_bio_PrivateKey(bout, key, NULL, NULL, 0, NULL, 
NULL);
pierre.delcour> key = PEM_read_bio_PrivateKey(bout, NULL, NULL, NULL);
pierre.delcour> cout << (key == NULL) << endl;
pierre.delcour>     BIO_free(bout);        //destroy the buffer
pierre.delcour>     return key;
pierre.delcour> 
pierre.delcour> Each time, the cout display 1 (key is NULL), i don't know why.

>From pem.pod:

  The read routines return either a pointer to the structure read or NULL
  if an error occurred.

So apparently, an error occured.  To display it, do the following
(requires stdio):

  ERR_print_errors_fp(stderr);

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

-- 
Richard Levitte                         [EMAIL PROTECTED]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to