From c0a6291feae148916064ab71e13815a84008fada Mon Sep 17 00:00:00 2001 From: Brian Beggs Date: Mon, 21 Jun 2010 09:23:56 -0400 Subject: More digest-md5 changes --- sleekxmpp/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sleekxmpp/__init__.py') 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("""%s""" %base64.encodestring(response1)[:-1]) -- cgit v1.2.3