//  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                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to