Re: Need your help
Joe Hildebrand <joe-bvCY4hpNeH/[email protected]> Tue, 16 Aug 2005 23:50:24 -0600
| Newsgroups | gmane.network.jabber.exodus.devel |
|---|---|
| Message-ID | <[email protected]> |
Is there a newline in the middle of the base64 string? I bet there
is, since the one that seems to be there is after character 76.
I think there are a lot of Base64 implementations that are written
against RFC 2045 (MIME), which specifies a Content-Transfer-Encoding,
with line breaks each 76 characters.
RFC 3920 calls out RFC 3548 for it's Base64, though. Section 2.1 of
3548 specifies:
Implementations MUST NOT not add line feeds to base encoded data
unless the specification referring to this document explicitly
directs base encoders to add line feeds after a specific number of
characters.
So, although crash isn't right (which I think I fixed), what you're
sending is incorrect. One could argue that according to Postel's
law, we should first strip whitespace before processing, to be
liberal in what we receive.
But you'll still need to fix your implementation in order to be
conservative in what you send. :)
On Aug 16, 2005, at 2:18 PM, Chen, Hao wrote:
> Well, I don't think there is any witespace right before </chanllenge>
> :( Here is my code for generating that chanllenge. If I'm wrong,
> please tell me.
>
> byte[] challenge = mySaslServer.evaluateResponse(new byte[0]);
> StringBuilder reply = new StringBuilder();
> reply.append("<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl
> \">");
> reply.append(Base64.encode(challenge).trim());
> reply.append("</challenge>");
>
> then, my codes will send out this reply. Messages in the debug window
> of Exodus are:
>
> RECV: <challenge
> xmlns="urn:ietf:params:xml:ns:xmpp-
> sasl">cmVhbG09Im51bnUiLG5vbmNlPSJWaitPQjEyWmtxaW10UTl6R3VGUmtxbThkMGMx
> SW5sWlRxNy90
> T2tzIixxb3A9ImF1dGgiLGNoYXJzZXQ9InV0Zi04IixhbGdvcml0aG09Im1kNS1zZXNzIg
> ==</challenge>
>
> This is exactly what my codes send out. I really have no ideas about
> what's going wrong here :(
>
> Regards,
>
> On 16/08/05, Joe Hildebrand <joe-bvCY4hpNeH/[email protected]> wrote:
>
>> Exactly. I just checked in a quick fix to catch this exception, so
>> at least we won't core in the face of not-yet-complete server
>> implementations... :)
>>
>> On Aug 15, 2005, at 2:20 PM, Tristan Stahnke wrote:
>>
>>
>>
>>> Actually I think he's referring to the carriage return right before
>>> </challenge>, that should be removed, AFAIK.
>>>
>>> On 8/15/05, Chen, Hao <[email protected]> wrote:
>>>
>>>
>>>
>>>> In the chanllenge, there is NO space between g and =. I suppose
>>>> it is
>>>> my email client adds such a space automatically. Anyway, this
>>>> time I
>>>> upload the error log as an attachment, please check it, thanks a
>>>> lot
>>>> :)
>>>>
>>>> Regards,
>>>>
>>>> On 15/08/05, Joe Hildebrand <joe-bvCY4hpNeH/[email protected]> wrote:
>>>>
>>>>
>>>>
>>>>> I'm guessing it's the extra whitespace before </challenge> that is
>>>>> the problem. Crashing is wrong, of course, so I'll take a look
>>>>> at it.
>>>>>
>>>>>
>>>>> On Aug 15, 2005, at 7:14 AM, Chen, Hao wrote:
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Exodus-dev mailing list
>>>>> [email protected]
>>>>> http://mail.jabber.org/mailman/listinfo/exodus-dev
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Chen, Hao
>>>>
>>>>
>>>> _______________________________________________
>>>> Exodus-dev mailing list
>>>> [email protected]
>>>> http://mail.jabber.org/mailman/listinfo/exodus-dev
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Exodus-dev mailing list
>>> [email protected]
>>> http://mail.jabber.org/mailman/listinfo/exodus-dev
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Exodus-dev mailing list
>> [email protected]
>> http://mail.jabber.org/mailman/listinfo/exodus-dev
>>
>>
>
>
> --
> Chen, Hao
> _______________________________________________
> Exodus-dev mailing list
> [email protected]
> http://mail.jabber.org/mailman/listinfo/exodus-dev
>