[tor-bugs] #21558 [Core Tor/Stem]: Add Ed25519 support

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Feb 28 00:35:44 UTC 2017


#21558: Add Ed25519 support
---------------------------+------------------------------
 Reporter:  patrickod      |          Owner:  atagar
     Type:  enhancement    |         Status:  needs_review
 Priority:  Medium         |      Milestone:
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:                 |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------

Comment (by atagar):

 Hi Patrick. Sorry about that, as discussed on irc figured out what I was
 doing wrong. Made a few small changes to this branch but then realized it
 lacks python 3.x support. Running our unit tests fails with...

 {{{
 % python3 run_tests.py --unit
 ...
 ======================================================================
 ERROR: test_ed25519_key_certificate_without_extensions
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 86, in test_ed25519_key_certificate_without_extensions
     validate = True
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 66, in _parse_certificate
     return Ed25519KeyCertificate(raw_contents, master_key_bytes, validate
 = validate)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 148, in __init__
     super(Ed25519KeyCertificate, self).__init__(raw_contents,
 identity_key, validate = False)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 132, in __init__
     self.__set_certificate_entries(raw_contents)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 136, in __set_certificate_entries
     for key, func in Certificate.ATTRIBUTES.iteritems():
 AttributeError: 'dict' object has no attribute 'iteritems'

 ======================================================================
 ERROR: test_parse_extensions_invalid_certificate_extension_type
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 57, in test_parse_extensions_invalid_certificate_extension_type
     cert_bytes
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 80, in _parse_extensions
     n_extensions = _bytes_to_long(raw_contents[39:40])
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 44, in _bytes_to_long
     return long(b.encode('hex'), 16)
 NameError: global name 'long' is not defined

 ======================================================================
 ERROR: test_parse_extensions_invalid_n_extensions_count
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 72, in test_parse_extensions_invalid_n_extensions_count
     cert_bytes
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 80, in _parse_extensions
     n_extensions = _bytes_to_long(raw_contents[39:40])
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 44, in _bytes_to_long
     return long(b.encode('hex'), 16)
 NameError: global name 'long' is not defined

 ======================================================================
 ERROR: test_parse_extensions_truncated_extension
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 43, in test_parse_extensions_truncated_extension
     cert_bytes
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 80, in _parse_extensions
     n_extensions = _bytes_to_long(raw_contents[39:40])
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 44, in _bytes_to_long
     return long(b.encode('hex'), 16)
 NameError: global name 'long' is not defined

 ======================================================================
 ERROR: test_with_invalid_type
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 30, in test_with_invalid_type
     None
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 74, in _parse_certificate
     raise ValueError("Unknown Certificate type %s" %
 cert_type.encode('hex'))
 LookupError: unknown encoding: hex

 ======================================================================
 ERROR: test_with_invalid_version
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/atagar/Desktop/stem/test/unit/descriptor/certificate.py",
 line 20, in test_with_invalid_version
     None
   File "/usr/lib/python3.2/unittest/case.py", line 1170, in
 deprecated_func
     return original_func(*args, **kwargs)
   File "/usr/lib/python3.2/unittest/case.py", line 1117, in
 assertRaisesRegex
     callable_obj(*args, **kwargs)
   File "/home/atagar/Desktop/stem/stem/descriptor/certificate.py", line
 76, in _parse_certificate
     raise ValueError("Unknown Certificate version %s" %
 version.encode('hex'))
 LookupError: unknown encoding: hex

 ----------------------------------------------------------------------
 Ran 7 tests in 0.015s

 FAILED (errors=6, skipped=1)
 }}}

 Mind taking a peek? To build on the work I've been doing please fetch from
 the ed25519 branch of my personal repo
 (https://git.torproject.org/user/atagar/stem.git)...

 https://gitweb.torproject.org/user/atagar/stem.git/log/?h=ed25519

 Cheers! -Damian

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21558#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list