c# - Jabber server doesn't reply to Client Final Message -


i'm working on own jabber client (mostly learn both xmpp , c#) , i'm trying connect server using scaram-sha-1 on tls. tls negotiation goes fine first client/server messages exchange, server challenge , generating client final message following code:

//following block generates client final message //---step 1. creating salted password--- byte[] saltbytes = encoding.utf8.getbytes(salt); byte[] saltedpasswordbytes = getsaltedpassword(userpassword, convert.frombase64string(salt), iterations);  //---step 2. creating client key--- byte[] clientkeybytes = gethash("client key", saltedpasswordbytes); string clientkey = bitconverter.tostring(clientkeybytes);  //---step 3. creating stored key--- sha1 storedkeysha = sha1.create(); byte[] storedkeybytes = storedkeysha.computehash(clientkeybytes); string storedkey = bitconverter.tostring(storedkeybytes); //---step 4. creating auth message--- string authmessage = "n=test_guy,r=" + clientnonce + "," + serverchallenge + "," + "c=" + stringtobase64("n,,") + ",r=" + clientandservernonces; //concern: authmessage might start "n=<username>" or "n,,n=<username>" - 1 right? logrtb.text += "authmessage is:\n" + authmessage + "\n";  //---step 5. creating client signature---                     byte[] clientsignaturebytes = gethash(authmessage, storedkeybytes); string clientsignature = bitconverter.tostring(clientsignaturebytes);  //---step 6. creating client proof--- logrtb.text += "---step 6. calculating client proof---\n" + "client key is: " + clientkey + "\nclientsignature is: " + clientsignature; byte[] clientproofbytes = new byte[clientkeybytes.length]; (int = 0; < clientkeybytes.length; ++i) {     clientproofbytes[i] = (byte)(clientkeybytes[i] ^ clientsignaturebytes[i]); } logrtb.text += "\nclient proof (string) is: " + clientproof + "\n";  //---step 7. creating server key---                     byte[] serverkeybytes = gethash("server key", saltedpasswordbytes); string serverkey = bitconverter.tostring(serverkeybytes); logrtb.text += "server key is: " + serverkey + "\n";  //---step 8. creating server signature---                     byte[] serversignaturebytes = gethash(authmessage, serverkeybytes); string serversignature = convert.tobase64string(serversignaturebytes); //done! clientproof = stringtobase64(clientproof); string clientresponse = "c=biws,r=" + clientandservernonces +",p=" + clientproof; //putting client response (most important part of client final message) //clientresponse.replace("==",""); //no! no! logrtb.text += "client response is:\n" + clientresponse + "\n"; //debug! string clientresponsebase64 = stringtobase64(clientresponse);                     if (isbase64string(clientresponsebase64)) {     string clientfinalmessage = "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" + clientresponsebase64 + "</response>";     logrtb.text += "--> client response (client final message) is:\n" + clientfinalmessage + "\n";     logrtb.text += "--> sending now!\n";     serverreply = sendxmppqueryovertls(serversocket, secureconnection, clientfinalmessage); //sending client final message                             logrtb.text += serverreply; } 

problem - don't reply server, when according rfc6120 (xmpp core) server supposed reply failure or success message. also, if deliberately send wrong message (for instance omitting client proof) reply bad-protocol message. server ejabberd default settings.

i spent couple of days trying figure out what's wrong , getting bit desperate. hope here able me.

(if needed can provide logs app generates during connection process)

thanks in advance!

i have tested agsxmpp scram implementation , works ejabberd. try compare code - https://github.com/meebey/agsxmpp/blob/master/agsxmpp/sasl/scram/scramsha1mechanism.cs


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -