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.
i.e.
3/BExiJWU6pKjH8JFebBYjHyYYbVYdIqpm6HeKJd2QdGIWXqaUacDXdEZ582wBvtpiqd/IsP9zwn
DhBgOxHXEhy/CzkNjQysNxJQ492WCybahjBwpRfJRU3i0qwW1SBG+7XL4lEZ2CfaOdheE2yM3OooAAAA
AAAA
this can happend at either the end of the message or somewhere in the middle.
I know openssl is not to blame of creating invalid base64 blocks for mime
messages.
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.
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
static PKCS7 *B64_read_PKCS7(BIO *bio)
{
BIO *b64;
PKCS7 *p7;
if(!(b64 = BIO_new(BIO_f_base64()))) {
PKCS7err(PKCS7_F_B64_READ_PKCS7,ERR_R_MALLOC_FAILURE);
return 0;
}
bio = BIO_push(b64, bio);
if(!(p7 = d2i_PKCS7_bio(bio, NULL)))
PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR);
BIO_flush(bio);
bio = BIO_pop(bio);
BIO_free(b64);
return p7;
}
im not certain at which point i have todo the change tho.
BTW: One "popular" offender of invalid base64 encodings is blackberry clients,
messages which are signed AND encrypted are very funny. The original encrypted
message has the correct base64 encoding, however after decrypting and seeing
the signed messages - there are no newlines in the base64 block - the base64 is
just one freaking long line.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]