> From: owner-openssl-us...@openssl.org On Behalf Of Bruno Vetel
> Sent: Thursday, 20 May, 2010 13:44

> Doug Kehn <rdk...@yahoo.com> writes:

> \n is not base64. Try with echo -n

> > I'm trying to decode a base64 encoded string.  The problem 
> I'm running in to is that BIO_read() always returns 0.  
> [...] If the base64 encoded string is shortened [it works]

Other way. The base64 concept allows linebreaks, and other 
whitespace -- that's exactly one of the 'transport damage' 
it was created to cope with. Original PEM required linebreaks 
at *exactly* 64 characters, and MIME requires *up to* 76. 
BIO_f_base64() output=encode does 64, and it appears to me 
input accepts up to 76 and maybe 80. For 'no limit'
use BIO_FLAGS_BASE64_NO_NULL as per the man page.

Or for all-in-memory, just call EVP_DecodeBlock directly.
You don't really need all the BIO framework stuff.

(Or you can write your own b64decode in about 10-20 lines.)



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

Reply via email to