Subject: [BEEPwg] Base64 and line breaks

From: "Paul Andrews" <[email-masked]>
Date: Mon, 19 May 2003 15:33:45 -0400

Hi,

I'm running into an interoperability problem regarding the base64
encoding of blob data during a SASL profile exchange. One side (the Java
side) is using the mime encoding rules and inserting a line break after
every 76 characters of base64 encoded data. The other side (the C side)
is expecting a continuous stream of base64 data with no line breaks.

Which side is right (the BEEP RFC simply states that blob data must be
base64 encoded for SASL exchanges, it doesn't say whether the blob
should follow mime rules for that data or not)?

Thanks - Paul.

_______________________________________________
BEEPwg mailing list
[email-masked]
http://lists.beepcore.org/mailman/listinfo/beepwg

---

From: Tony Hansen <[email-masked]>
Date: Mon, 19 May 2003 15:55:58 -0400

The base64 spec requires that any characters that are not in the base64 
alphabet are to be ignored and allows such characters to be inserted 
anywhere in the stream. That includes line breaks. (Your C side is wrong.)

	Tony Hansen
	[email-masked]

---

From: Chris Newman <[email-masked]>
Date: Mon, 19 May 2003 17:57:09 -0700

Actually most of the SASL profiles which use base64 encoding do not permit line
breaks in the format.

This includes RFC 3501, 1734, 2554, etc.

For example, RFC 3501 has this ABNF:

-----
authenticate    = "AUTHENTICATE" SP auth-type *(CRLF base64)

auth-type       = atom
                    ; Defined by [SASL]

base64          = *(4base64-char) [base64-terminal]

base64-char     = ALPHA / DIGIT / "+" / "/"
                    ; Case-sensitive

base64-terminal = (2base64-char "==") / (3base64-char "=")
-----

So I could argue that the failure to explicitly include the ABNF for the base64
left the specification ambiguous and it should be clarified to be consistent
with other protocols that base64 encode the SASL exchange.

But if there's deployed Java code which generates unnecessary characters in the
base64 stream, perhaps it's too late to make it consistent with other protocols
and we just need to document the more permissive syntax for BEEP...

                - Chris

begin  quotation by Tony Hansen on 2003/5/19 15:55 -0400:

> alphabet are to be ignored and allows such characters to be inserted anywhere
> in the stream. That includes line breaks. (Your C side is wrong.)
> 
> 	Tony Hansen
> 	[email-masked]
> 
> Paul Andrews wrote:
>> Hi,
>>

---

From: "Paul Andrews" <[email-masked]>
Date: Tue, 20 May 2003 08:55:01 -0400

Well, this leaves an interop issue between beepcore-c+cyrus and
beepcore-java. The cyrus libraries do not accept extraneous characters,
whilst the java libraries insert line-breaks every 76 characters.

I agree, though, that the RFC needs to be clarified.

> -----Original Message-----
> From: Chris Newman [mailto:[email-masked]] 
> Sent: Monday, May 19, 2003 8:57 PM
> To: Tony Hansen; Paul Andrews
> Cc: Beepwg
> Subject: Re: [BEEPwg] Base64 and line breaks
> 
>

---

From: Marshall Rose <[email-masked]>
Date: Tue, 20 May 2003 08:13:57 -0700

> whilst the java libraries insert line-breaks every 76 characters.

this probably falls under the "be liberal in what you accept, conservative in
what you generate" rubic.

> I agree, though, that the RFC needs to be clarified.

agreed.

/mtr