Author: bct
Date: 2008-07-19 22:42:03 +0200 (Sat, 19 Jul 2008)
New Revision: 9964
Modified:
trunk/src/chat_control.py
trunk/src/common/config.py
trunk/src/common/stanza_session.py
Log:
added option for esession autonegotiation
added option for modp groups to use in a negotiation
Modified: trunk/src/chat_control.py
===================================================================
--- trunk/src/chat_control.py 2008-07-19 20:41:53 UTC (rev 9963)
+++ trunk/src/chat_control.py 2008-07-19 20:42:03 UTC (rev 9964)
@@ -1155,9 +1155,10 @@
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()
Modified: trunk/src/common/config.py
===================================================================
--- trunk/src/common/config.py 2008-07-19 20:41:53 UTC (rev 9963)
+++ trunk/src/common/config.py 2008-07-19 20:42:03 UTC (rev 9964)
@@ -191,7 +191,8 @@
'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],
Modified: trunk/src/common/stanza_session.py
===================================================================
--- trunk/src/common/stanza_session.py 2008-07-19 20:41:53 UTC (rev 9963)
+++ trunk/src/common/stanza_session.py 2008-07-19 20:42:03 UTC (rev 9964)
@@ -483,7 +483,7 @@
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)))