Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/stanza_session.py')
-rw-r--r--src/common/stanza_session.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 289ed5d89..cb1d7fb7f 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -28,7 +28,6 @@ from common import gajim
from common import xmpp
from common import exceptions
-import itertools
import random
import string
@@ -92,8 +91,8 @@ class StanzaSession(object):
return any_removed
def generate_thread_id(self):
- return ''.join([f(string.ascii_letters) for f in itertools.repeat(
- random.choice, 32)])
+ return ''.join([random.choice(string.ascii_letters) for x in xrange(0,
+ 32)])
def send(self, msg):
if self.thread_id:
@@ -284,7 +283,7 @@ class EncryptedStanzaSession(StanzaSession):
return stanza
def is_xep_200_encrypted(self, msg):
- msg.getTag('c', namespace=xmpp.NS_STANZA_CRYPTO)
+ msg.getTag('c', namespace=common.xmpp.NS_STANZA_CRYPTO)
def hmac(self, key, content):
return HMAC.new(key, content, self.hash_alg).digest()
@@ -387,9 +386,10 @@ class EncryptedStanzaSession(StanzaSession):
parsed = xmpp.Node(node='<node>' + plaintext + '</node>')
if self.negotiated['recv_pubkey'] == 'hash':
- # fingerprint = parsed.getTagData('fingerprint')
+ fingerprint = parsed.getTagData('fingerprint')
+
# XXX find stored pubkey or terminate session
- raise NotImplementedError()
+ raise 'unimplemented'
else:
if self.negotiated['sign_algs'] == (XmlDsig + 'rsa-sha256'):
keyvalue = parsed.getTag(name='RSAKeyValue', namespace=XmlDsig)
@@ -771,7 +771,7 @@ class EncryptedStanzaSession(StanzaSession):
else:
srses = secrets.secrets().retained_secrets(self.conn.name,
self.jid.getStripped())
- rshashes = [self.hmac(self.n_s, rs[0]) for rs in srses]
+ rshashes = [self.hmac(self.n_s, rs) for (rs,v) in srses]
if not rshashes:
# we've never spoken before, but we'll pretend we have
@@ -838,7 +838,7 @@ class EncryptedStanzaSession(StanzaSession):
rshashes = [base64.b64decode(rshash) for rshash in form.getField(
'rshashes').getValues()]
- for secret in (s[0] for s in srses):
+ for (secret, verified) in srses:
if self.hmac(self.n_o, secret) in rshashes:
srs = secret
break
@@ -889,7 +889,7 @@ class EncryptedStanzaSession(StanzaSession):
srshash = base64.b64decode(form['srshash'])
- for secret in (s[0] for s in srses):
+ for (secret, verified) in srses:
if self.hmac(secret, 'Shared Retained Secret') == srshash:
srs = secret
break