On 31-03-2013 08:49, Dave Thompson wrote:
From: [email protected] On Behalf Of Jakob Bohm
Sent: Thursday, 28 March, 2013 20:53
Look up the documentation of the following OpenSSL functions
(Yes this
is a bit roundabout for encoding a single string, but this is all
OpenSSL exposes):
BIO_f_base64
BIO_s_mem
A better way is to use a non-OpenSSL library to Base64 (or Base32 or
Base85 or Base16 or whatever you like) the binary data
directly, without
the gratuitous insertion of newlines and "=" sign padding done
by the file-oriented BIO_f_base64.
The newlines and padding are required by PEM, and MIME,
and even today sometimes useful for their intended use cases.
You can suppress the newlines with BIO_FLAGS_BASE64_NO_NL .
(But not in PEM_read/write_xxx which manages its own b64BIO.)
Yes, it is useful for e-mail (MIME, S/MIME and PEM), but nothing but
problems for
many other uses, such as XML attribute values, tab/space/CSV files, SQL
databases,
URL parameters, cookie values etc. Unfortunately these concerns were not
sufficiently dealt with in the standalone Base64/Base32/Base16 RFC,
which blindly
repeats the padding rules from MIME.
EVP_{Encode,Decode}Block aren't documented but are external-linkage
in evp.h (not evp_locl.h) and have been stable for a long time,
and straightforward to use.
That is really badly hidden then. No mention in the BIO_f_base64
manpage, no
nearby "base64" grep result in evp.h., and no base64 substring in the
function names
themselves.
Enjoy
Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]