[jdev] How to do SASL authentication in C/C++

ashiraz ashiraz.3iptin at no-mx.jabberforum.org
Tue Nov 11 08:34:14 CST 2008


Justin Karneges;4900 Wrote: 
> On Monday 10 November 2008 21:39:06 ashiraz wrote:
> > I have started to write socket level code for interaction with a
> jabber
> > server like gtalk.
> >
> > I am sending this thing xml strings but in the authentication phase
> it
> > requires SASL encryption. Is there an expeditious way of encrypting
> > authentication code?
> 
> It's common to use libraries for SASL, but we've already had a
> discussion 
> about libraries.  That said, it's also very common to not use libraries
> for 
> SASL.  Lots of people write their own code for one reason or another.
> 
> You need to decide what mechanisms to implement.  Probably you'd do
> PLAIN 
> and/or DIGEST-MD5.  Consult the RFCs.  You should only do PLAIN if you
> plan 
> to protect the stream with TLS.
> 
> Long ago, somebody wrote the smallest tutorial ever for DIGEST-MD5, and
> it's 
> even written in the context of XMPP:
> http://tinyurl.com/5whlpf
> 
> -Justin
> 



Thanks a lot for this help :) 

This is how far I have gotten  (c1 means client 1 and s1 means server
response1): 


c1: 

<stream:stream xmlns:stream='http://etherx.jabber.org/streams'
to='gmail.com' xmlns='jabber:client'>


s1: 

<stream:stream from="gmail.com" id="8D1371CDDC4B97F9"
xmlns:stream="http://ether
x.jabber.org/streams" xmlns="jabber:client">

c2: 

<iq type='get' to='gmail.com' id='auth1'>
<query xmlns='jabber:iq:auth'>
<username>atharshiraz</username>
</query>
</iq>




s2:       
<iq type="error" id="auth1" from="gmail.com">
<query xmlns=" jabber:iq:auth">
<username>atharshiraz</username>
</query>

<error code="405" type="cancel">
<not-allowed xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Connection
must
be encrypted.
</text>
</error>
</iq>
</stream:stream>


-- 
ashiraz
------------------------------------------------------------------------
ashiraz's Profile: http://www.jabberforum.org/member.php?userid=17305
View this thread: http://www.jabberforum.org/showthread.php?t=1061




More information about the JDev mailing list