commit b4bf0499a4fd048526ebbd89ad5d9c21cec70676 Author: Damian Johnson atagar@torproject.org Date: Sun Feb 25 17:33:38 2018 -0800
Don't validate crosscert without cryptography module
Oops, we shouldn't exercise this validation when the cryptography module isn't present.
====================================================================== FAIL: test_cached_descriptor ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 150, in <lambda> self.method = lambda test: self.result(test) # method that can be mixed into TestCases File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 220, in result test.fail(self._result.msg) AssertionError: Traceback (most recent call last): File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 168, in _wrapper runner(*args) if args else runner() File "/home/atagar/Desktop/stem/test/integ/descriptor/server_descriptor.py", line 34, in test_cached_descriptor for desc in stem.descriptor.parse_file(descriptor_file, 'server-descriptor 1.0', validate = True): File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 274, in parse_file for desc in parse(descriptor_file): File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 321, in _parse_metrics_file for desc in stem.descriptor.server_descriptor._parse_file(descriptor_file, is_bridge = False, validate = validate, **kwargs): File "/home/atagar/Desktop/stem/stem/descriptor/server_descriptor.py", line 221, in _parse_file yield RelayDescriptor(descriptor_text, validate, annotations, **kwargs) File "/home/atagar/Desktop/stem/stem/descriptor/server_descriptor.py", line 833, in __init__ onion_key_crosscert_digest = self._digest_for_signature(self.onion_key, self.onion_key_crosscert) File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 734, in _digest_for_signature raise ValueError('Generating the signed digest requires the cryptography module') ValueError: Generating the signed digest requires the cryptography module --- stem/descriptor/server_descriptor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py index eef507a5..8aed42c6 100644 --- a/stem/descriptor/server_descriptor.py +++ b/stem/descriptor/server_descriptor.py @@ -829,7 +829,7 @@ class RelayDescriptor(ServerDescriptor): if signed_digest != self.digest(): raise ValueError('Decrypted digest does not match local digest (calculated: %s, local: %s)' % (signed_digest, self.digest()))
- if self.onion_key_crosscert: + if self.onion_key_crosscert and stem.prereq.is_crypto_available(): onion_key_crosscert_digest = self._digest_for_signature(self.onion_key, self.onion_key_crosscert)
if onion_key_crosscert_digest != self._onion_key_crosscert_digest():