summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorBrian Beggs <macdiesel@gmail.com>2010-06-21 09:23:56 -0400
committerBrian Beggs <macdiesel@gmail.com>2010-06-21 09:23:56 -0400
commitc0a6291feae148916064ab71e13815a84008fada (patch)
treeb01e7c9c79e9badbc26de15fc41cbd4c1887318e /sleekxmpp
parentf5d04664627b28f9439d9ed5214a0060a77a2bf2 (diff)
downloadslixmpp-c0a6291feae148916064ab71e13815a84008fada.tar.gz
slixmpp-c0a6291feae148916064ab71e13815a84008fada.tar.bz2
slixmpp-c0a6291feae148916064ab71e13815a84008fada.tar.xz
slixmpp-c0a6291feae148916064ab71e13815a84008fada.zip
More digest-md5 changes
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 1cf6eac3..848fae26 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -270,22 +270,22 @@ class ClientXMPP(basexmpp, XMLStream):
#z = hashlib.md5(kd).hexdigest()
#take 3
- cnonce = "dfajoiqewoivnoeiw"
+ cnonce = ""
for i in range(12):
cnonce = cnonce + chr(random.randint(0,0xff)).decode("utf-8", "replace")
cnonce = base64.encodestring(cnonce)[0:-1]
- urp = hashlib.md5("%s:%s:%s" % (self.username, challenge["realm"], self.password) ).digest()
- a1 = "%s:%s:%s" % (urp.decode("utf-8", "replace"), challenge["nonce"], cnonce)
+ urp = md5("%s:%s:%s" % (self.username, self.domain, self.password) )
+ a1 = "%s:%s:%s" % (urp.encode, challenge["nonce"].encode(), cnonce.encode())
a2 = "AUTHENTICATE:xmpp/%s" % self.domain
responseHash = hexlify(md5("%s:%s:00000001:%s:%s:%s"
% (hexlify(md5(a1)), challenge["nonce"], cnonce, challenge["qop"], hexlify(md5(a2))) ))
print responseHash
- responseHash1 = resp(self.username, challenge["realm"], self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
- responseHash2 = resp(self.username, challenge["realm"], self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
+ responseHash1 = resp(self.username, self.domain, self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
+ responseHash2 = resp(self.username, self.domain, self.password, challenge["nonce"], cnonce, "AUTHENTICATE:xmpp/%s" % self.domain)
print responseHash1
print responseHash2
- response1 = 'username="%s"%s,nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s' %(self.username, ',realm="%s"' % challenge['realm'], challenge["nonce"], cnonce, 'AUTHENTICATE:xmpp/%s' % self.domain, responseHash1)
- response = '''username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s''' %(self.username, challenge["realm"], challenge["nonce"], cnonce, challenge["qop"], "AUTHENTICATE:xmpp/%s" % self.domain, responseHash1)
+ response1 = 'username="%s"%s,nonce="%s",cnonce="%s",nc=00000001,qop=auth,digest-uri="%s",response=%s' %(self.username, ',realm="%s"' % self.domain, challenge["nonce"], cnonce, 'AUTHENTICATE:xmpp/%s' % self.domain, responseHash1)
+ response = '''username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s''' %(self.username, self.domain, challenge["nonce"], cnonce, challenge["qop"], "AUTHENTICATE:xmpp/%s" % self.domain, responseHash1)
print response
print response1
self.sendPriorityRaw("""<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>""" %base64.encodestring(response1)[:-1])