----- Original Message -----
From: "Paul Brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 10, 2002 10:00 PM
Subject: RE: Bas64 encoding performance


>
> > From: John Wilson [mailto:[EMAIL PROTECTED]]
> > Subject: Re: Bas64 encoding performance
> > +      if (sixBit < 64) {
> > +        if (gotEquals) throw new Error("= character not at end of
base64
> > value");
>
> Technically, if you look at the RFC (which is probably the correct
yardstick
> for a cross-system base64 implementation), you'll see that this isn't
quite
> the correct behavior.  Among other things, whitespace and illegal
characters
> are to be ignored.
>
> RFC 2045, S6.8:
>   http://www.ietf.org/rfc/rfc2045.txt

Paul,

    the code ignores whitespace.

RFC2045 says (page 24) :

"In base64 data, characters other than those in Table 1, line breaks, and
other
   white space probably indicate a transmission error, about which a
   warning message or even a message rejection might be appropriate
   under some circumstances."

Which, in my view, allows decoding software to reject a message containing
odd characters (as mine does).

The RFC also says (page 24):

"Because it is used only for padding at the end of the data, the
   occurrence of any "=" characters may be taken as evidence that the
   end of the data has been reached (without truncation in transit).  "

Which I take to mean that "=" or "==" should not be followed by non
whitespace characters. So I think I'm justified in flagging this as an
error.


John Wilson
The Wilson Partnership
http://www.wilson.co.uk



Reply via email to