Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#2324 closed bug (Fixed)

deluge and crypto_provide

Reported by: tristen Owned by:
Priority: minor Milestone: 1.3.7
Component: GTK UI Version: 1.3.6
Keywords: Cc:


deluge gtk appears to be requesting libtorrent to send an incorrect bitfield for crypto_provide on outbound connections.

original forum post:

libtorrent ticket:

in a nutshell, deluge gtk is sending via libtorrent:

bitfield 0x00 instead of 0x01 when requesting handshake/plaintext encryption from the outbound peer.

bitfield 0x01 instead of 0x02 when requesting fullstream encryption from the outbound peer.

bitfield 0x02 instead of 0x03 when requesting the outbound peer choose their preferred encryption method.

the implications of this vary depending on which encryption method the user has selected in the gui.

worst case scenario is no outbound peering occurs if the user has selected handshake/plaintext encryption as their encryption method.

outbound peering appears to occur for "fullstream" and "choose" but i suspect the encryption level selected by the peer is actually always "handshake/plaintext" and "fullstream" respectively. however i'm not 100% sure of this, it's a suspicion.

regards tristen

Change History (3)

comment:1 Changed 4 years ago by Cas

Ok I understand the issue now, it is due to an assumption that the enc_level options are in the range 0,1,2 and that is how the clients pass the value to core and then onto libtorrent.

Can you verify this will fix it:

diff --git a/deluge/core/ b/deluge/core/
index 7a3cc2c..b2953f3 100644
--- a/deluge/core/
+++ b/deluge/core/
@@ -345,11 +345,12 @@ def _on_set_utpex(self, key, value):
     def _on_set_encryption(self, key, value):
         log.debug("encryption value %s set to %s..", key, value)
+        pe_enc_level = {0:lt.enc_level.plaintext, 1:lt.enc_level.rc4, 2:lt.enc_level.both}
         pe_settings = lt.pe_settings()
         pe_settings.out_enc_policy = \
         pe_settings.in_enc_policy = lt.enc_policy(self.config["enc_in_policy"])
-        pe_settings.allowed_enc_level = lt.enc_level(self.config["enc_level"])
+        pe_settings.allowed_enc_level = lt.enc_level(pe_enc_level[self.config["enc_level"]])
         pe_settings.prefer_rc4 = self.config["enc_prefer_rc4"]
         set = self.session.get_pe_settings()

comment:2 follow-up: Changed 4 years ago by Cas

  • Resolution set to fixed
  • Status changed from new to closed

Fixed 1.3-stable: 03d5654a1

comment:3 in reply to: ↑ 2 Changed 4 years ago by tristen

Replying to Cas:

Fixed 1.3-stable: 03d5654a1

heya cas

ok, i've built deluge from source and i can confirm your fix works just fine.

good job!

Note: See TracTickets for help on using tickets.