[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #8755 [Stem]: Python 3 Compatibility



#8755: Python 3 Compatibility
---------------------+------------------------------------------------------
 Reporter:  aj00200  |          Owner:  atagar
     Type:  defect   |         Status:  new   
 Priority:  normal   |      Milestone:        
Component:  Stem     |        Version:        
 Keywords:           |         Parent:        
   Points:           |   Actualpoints:        
---------------------+------------------------------------------------------
 I am getting some errors when using Stem with Python 3 when iterating
 though all values return from controller.get_server_descriptors(). The
 error happens in /usr/local/lib/python3.2/dist-
 packages/stem/descriptor/server_descriptor.py . I have fixed some of these
 errors (see attached file) but I think there are more problems with the
 way the "digest" variable is created. For example, if self.digest()
 returns 0222F10950D2177B99288E9D133FAB1B0848AE70, the digest variable is
 given the value

 {{{
 b'{q#a3l\xb9\xa7,\xb5\xf0EX\xa9\xca\xd6\xe1\xae!\x10'
 }}}
 but the proper encoding would be

 {{{
 b'\x02"\xf1\tP\xd2\x17{\x99(\x8e\x9d\x13?\xab\x1b\x08H\xaep'
 }}}
 I should also note that I have not tested this patch with Python 2.x yet.

 This is the error which still happens with some digests:

 > Traceback (most recent call last):
 > File "./xxx.py", line 32, in <module>
 > for each in server_descriptors:
 > File "/usr/local/lib/python3.2/dist-packages/stem/control.py", line
 1121, in get_server_descriptors
 > raise exc
 > File "/usr/local/lib/python3.2/dist-packages/stem/control.py", line
 1117, in get_server_descriptors
 > for desc in
 stem.descriptor.server_descriptor._parse_file(io.BytesIO(str_tools._to_bytes(desc_content))):
 > File "/usr/local/lib/python3.2/dist-
 packages/stem/descriptor/server_descriptor.py", line 137, in _parse_file
 > yield !RelayDescriptor(descriptor_text, validate, annotations)
 > File "/usr/local/lib/python3.2/dist-
 packages/stem/descriptor/server_descriptor.py", line 646, in !__init!__
 > self._validate_content()
 > File "/usr/local/lib/python3.2/dist-
 packages/stem/descriptor/server_descriptor.py", line 697, in
 _validate_content
 > self._verify_digest(key_as_bytes)
 > File "/usr/local/lib/python3.2/dist-
 packages/stem/descriptor/server_descriptor.py", line 768, in
 _verify_digest
 > raise !ValueError("Decrypted digest does not match local digest")
 > !ValueError: Decrypted digest does not match local digest

 Feel free to contact me if you have any questions.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8755>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs