interface for SAS

This commit is contained in:
Brendan Taylor 2007-07-04 18:55:53 +00:00
parent 2bed6a522a
commit 29c44d8a5e
3 changed files with 17 additions and 5 deletions

View file

@ -561,7 +561,7 @@ class EncryptedStanzaSession(StanzaSession):
# check for a retained secret
# if none exists, prompt the user with the SAS
if self.sas_algs == 'sas28x5':
print "sas: %s" % self.sas_28x5(m_a, self.form_b)
self.sas = self.sas_28x5(m_a, self.form_b)
result.addChild(node=xmpp.DataField(name='identity', value=base64.b64encode(id_a)))
result.addChild(node=xmpp.DataField(name='mac', value=base64.b64encode(m_a)))
@ -629,7 +629,7 @@ class EncryptedStanzaSession(StanzaSession):
# check for a retained secret
# if none exists, prompt the user with the SAS
if self.sas_algs == 'sas28x5':
print "sas: %s" % self.sas_28x5(m_a, self.form_b)
self.sas = self.sas_28x5(m_a, self.form_b)
k = self.sha256(k + self.srs + oss)

View file

@ -1699,10 +1699,12 @@ class Interface:
if ask_user:
def accept_nondefault_options(widget):
dialog.destroy()
negotiated.update(ask_user)
session.accept_e2e_alice(form, negotiated)
dialog.destroy()
negotiation.show_sas_dialog(jid, session.sas)
def reject_nondefault_options(widget):
session.reject_negotiation()
@ -1714,10 +1716,13 @@ class Interface:
on_response_no = reject_nondefault_options)
else:
session.accept_e2e_alice(form, negotiated)
negotiation.show_sas_dialog(jid, session.sas)
return
elif session.status == 'responded-e2e' and form.getType() == 'result':
session.accept_e2e_bob(form)
negotiation.show_sas_dialog(jid, session.sas)
return
elif session.status == 'identified-alice' and form.getType() == 'result':
session.final_steps_alice(form)

View file

@ -1,6 +1,8 @@
import gtkgui_helpers
import dataforms_widget
import dialogs
from common import dataforms
from common import gajim
from common import xmpp
@ -8,9 +10,14 @@ from common import xmpp
def describe_features(features):
'''a human-readable description of the features that have been negotiated'''
if features['logging'] == 'may':
return '- messages will be logged'
return _('- messages will be logged')
elif features['logging'] == 'mustnot':
return '- messages will not be logged'
return _('- messages will not be logged')
def show_sas_dialog(jid, sas):
dialogs.InformationDialog(_('''Verify the remote client's identity'''), _('''You've begun an encrypted session with %s, but it can't be guaranteed that you're talking directly to the person you think you are.
You should speak with them directly (in person or on the phone) and confirm that their Short Authentication String is identical to this one: %s''') % (jid, sas))
class FeatureNegotiationWindow:
'''FeatureNegotiotionWindow class'''