I'm really stuck trying to base64 decode a string with bios.  Any help 
on what I''m doing wrong or how to work out what the problem is would be 
very much appreciated.  My code is:

    int i = 0, j = 0;
    BIO *bio, *b64;

    b64 = BIO_new(BIO_f_base64());

    bio = BIO_new(BIO_s_mem());

    BIO_set_mem_eof_return(bio, 0); // no error checking but allocations 
seem OK in debug

    i = BIO_write(bio, "SGVsbG8gd29ybGRcIQo=",20); //simple example 
"Hello World\!"

    bio = BIO_push(b64, bio);  // if I take this out I get the still 
encoded string back

    j = BIO_ctrl_pending(bio); // = 20, i.e. length of encoded srting

    i = BIO_read(bio, sbuf2, j); //  always return 0, sbuf2 is unchanged

    i = BIO_eof(bio); // = 1, i.e. EOF
    i = BIO_ctrl_pending(bio); // = 0, i.e. now empty

    BIO_free_all(bio);

This is driving me nuts (no-one can help me with that!)

Thanks

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

Reply via email to