Thank you! It finally works.......It appears you have to flush the BIO
before you get a pointer to it (as shown in your code below. Thanks! 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rich Salz
Sent: Monday, October 17, 2005 12:41 PM
To: Adam Jones
Cc: openssl-users@openssl.org
Subject: Re: Base64 Help

         //  Set up a base64 encoding BIO that writes to a memory BIO.
         BIO* b64 = BIO_new(BIO_f_base64());
         BIO* out = BIO_new(BIO_s_mem());
         BIO_set_flags(out, BIO_CLOSE);  // probably redundant
         b64 = BIO_push(b64, out);

         //  Send the data.
         // e.g., i2d_X509_bio(b64, mX509);
        BIO_write(b64, message, strlen(message));

         //  Collect the encoded data.
         BIO_flush(b64);
         char* temp;
         int count = BIO_get_mem_data(out, &temp);

        // ... use the data, and then:
         BIO_free_all(b64);
        //  temp is now invalid!

--
Rich Salz, Chief Security Architect
DataPower Technology                           http://www.datapower.com
XS40 XML Security Gateway   http://www.datapower.com/products/xs40.html
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]




Confidentiality Notice:

This e-mail and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
you are not the named addressee you should not disseminate, distribute or copy 
this e-mail. Please notify the sender immediately by e-mail if you have 
received this e-mail by mistake and delete this e-mail from your system.  If 
you are not the intended recipient you are notified that disclosing, copying, 
distributing or taking any action in reliance on the contents of this 
information is strictly prohibited.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to