> From: owner-openssl-us...@openssl.org On Behalf Of Harakiri
> Sent: Thursday, 28 October, 2010 07:52

> I'm getting alot of wrongly encoding mails lately from 
> different sources, they have base64 lines which exceeds the 
> standard. I.e. in between one line
> is 4 characters longer, then the next lines are all shifted 
> by these 4 characters.
> 
> However, it would be easy to fix i guess - the base64 reader 
> simply must ignore the rule that each line has to be a certain length.
> 
BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL)

Output doesn't generate (any) linebreaks. Input doesn't 
REQUIRE them every <80, but does ALLOW them anywhere.

> So anyone already done the task on modifying the base64 
> reader for smime messages? I tracked it to 
> crypto/pkcs7/pk7_mime.c function *B64_read_PKCS7
> 
No idea if anyone has. I see this area (SMIME/CMS) has changed 
substantially in 1.0.0 and it looks like this functionality is 
now in asn1/asn_mime.c but still using default NL setting.

Alternatively, instead of using a BIO directly on the message 
as received, you could first correct it by just breaking any 
overlong base64 line(s); instead of actually parsing MIME 
maybe you can assume nonheader nonmarker is base64 body.
If it fits in memory you can just read it in and fix it, 
then point to that in a memBIO you give to SIME_read_.
If not you probably have to make a BIO_pair and a thread 
that feeds your end with corrected data while OpenSSL 
consumes the other end.


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

Reply via email to