I'm having an issue with using base64 decode.  I can encode fine,
and can decode strings just fine, but am having an issue decoding (specifically)
a sqlite database.

Here's my encode and decode:

encode:
bmem = BIO_new(BIO_s_mem());
b64 = BIO_push(b64, bmem); 
fprintf(stderr,"inbuf = %s, inlen = %d\n",inbuf,inlen);
BIO_write(b64, inbuf, inlen);
BIO_flush(b64);
BIO_get_mem_ptr(b64, &bptr);
memcpy(outbuf, bptr->data, bptr->length);
outbuf[bptr->length] = '\0';
BIO_free_all(b64);


Decode:
b64 = BIO_new(BIO_f_base64());
bmem = BIO_new_mem_buf(inbuf, inlen);
bmem = BIO_push(b64, bmem);
outlen=BIO_read(bmem,outbuf,inlen);
BIO_free_all(bmem);


As noted, encode and decode are fine on strings and some binary files, but 
if the string.  Any decode seems to stop at the first \n.

If I encode using the above routine, I can decode the file using
openssl enc -base64 -d

I know I'm just doing something (or many things) wrong and/or stupid, but 
I'm at a stand still.  Hoping someone smarter than me can see what it is 
I'm doing wrong.

R. Marc
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to