commit d66e8da88feaaec4875a3845fe3ef03bc79d1f3c
Author: Damian Johnson <[email protected]>
Date: Thu Oct 3 12:53:07 2019 -0700
Drop cryptography usage from _public_key_from_address()
The following converts bytes to a key, then key back into bytes...
return Ed25519PublicKey.from_public_bytes(pubkey).public_bytes(
encoding = serialization.Encoding.Raw,
format = serialization.PublicFormat.Raw
)
The end result is the same as simply returning 'pubkey' so dropping the
added
complexity.
---
stem/descriptor/hidden_service.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/stem/descriptor/hidden_service.py
b/stem/descriptor/hidden_service.py
index bf11c685..e162079b 100644
--- a/stem/descriptor/hidden_service.py
+++ b/stem/descriptor/hidden_service.py
@@ -564,7 +564,7 @@ class
HiddenServiceDescriptorV3(BaseHiddenServiceDescriptor):
blinded_key = self.signing_cert.signing_key()
if not blinded_key:
- raise ValueError('No signing key extension present')
+ raise ValueError('No signing key is present')
identity_public_key =
HiddenServiceDescriptorV3._public_key_from_address(onion_address)
@@ -595,9 +595,6 @@ class
HiddenServiceDescriptorV3(BaseHiddenServiceDescriptor):
if not stem.util.tor_tools.is_valid_hidden_service_address(onion_address,
version = 3):
raise ValueError("'%s.onion' isn't a valid hidden service v3 address" %
onion_address)
- from cryptography.hazmat.primitives import serialization
- from cryptography.hazmat.primitives.asymmetric.ed25519 import
Ed25519PublicKey
-
# onion_address = base32(PUBKEY | CHECKSUM | VERSION) + '.onion'
# CHECKSUM = H('.onion checksum' | PUBKEY | VERSION)[:2]
@@ -615,10 +612,7 @@ class
HiddenServiceDescriptorV3(BaseHiddenServiceDescriptor):
if (checksum != my_checksum):
raise ValueError('Bad checksum (expected %s but was %s)' %
(binascii.hexlify(checksum), binascii.hexlify(my_checksum)))
- return Ed25519PublicKey.from_public_bytes(pubkey).public_bytes(
- encoding = serialization.Encoding.Raw,
- format = serialization.PublicFormat.Raw
- )
+ return pubkey
# TODO: drop this alias in stem 2.x
_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits