added option for esession autonegotiation

added option for modp groups to use in a negotiation
This commit is contained in:
Brendan Taylor 2008-07-19 20:42:03 +00:00
parent e4b4d839da
commit f11b5dd081
3 changed files with 7 additions and 5 deletions

View File

@ -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()

View File

@ -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],

View File

@ -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)))