From f11b5dd0819bdcc64d000118988c55c16736cacf Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sat, 19 Jul 2008 20:42:03 +0000 Subject: [PATCH] added option for esession autonegotiation added option for modp groups to use in a negotiation --- src/chat_control.py | 7 ++++--- src/common/config.py | 3 ++- src/common/stanza_session.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 34e347dd5..7ea8ee0bb 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1155,9 +1155,10 @@ class ChatControl(ChatControlBase): self.session and self.session.is_loggable(), True) # then try E2E # XXX: Once we have fallback to disco, remove notexistant check - elif not e2e_is_active and \ - gajim.capscache.is_supported(contact, NS_ESESSION) and \ - not gajim.capscache.is_supported(contact, 'notexistant'): + elif not e2e_is_active and gajim.HAVE_PYCRYPTO \ + and gajim.config.get('autonegotiate_esessions') \ + and gajim.capscache.is_supported(contact, NS_ESESSION) \ + and not gajim.capscache.is_supported(contact, 'notexistant'): self.begin_e2e_negotiation() self.status_tooltip = gtk.Tooltips() diff --git a/src/common/config.py b/src/common/config.py index eba219f93..4ace8ca16 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -191,7 +191,8 @@ class Config: 'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')], 'tabs_close_button': [opt_bool, True, _('Show close button in tab?')], 'log_encrypted_sessions': [opt_bool, True, _('When negotiating an encrypted session, should Gajim assume you want your messages to be logged?')], - 'e2e_public_key': [opt_bool, False, _('When negotiating an encrypted session, should Gajim prefer to use public keys for identification?')], + 'autonegotiate_esessions': [opt_bool, True, _('Should Gajim automatically start an encrypted session when possible?')], + 'esession_modp': [opt_str, '5,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')], 'chat_avatar_width': [opt_int, 52], 'chat_avatar_height': [opt_int, 52], 'roster_avatar_width': [opt_int, 32], diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py index 1f500d80c..b061f7fd5 100644 --- a/src/common/stanza_session.py +++ b/src/common/stanza_session.py @@ -483,7 +483,7 @@ class EncryptedStanzaSession(StanzaSession): x.addChild(node=xmpp.DataField(name='my_nonce', value=base64.b64encode(self.n_s), typ='hidden')) - modp_options = [ 5, 14, 2, 1 ] + modp_options = [ int(g) for g in gajim.config.get('esession_modp').split(',') ] x.addChild(node=xmpp.DataField(name='modp', typ='list-single', options=map(lambda x: [ None, x ], modp_options)))