[tor-commits] [stem] 02/20: Removal of int_from_bytes
gitolite role
git at cupani.torproject.org
Thu Jun 1 19:24:10 UTC 2023
This is an automated email from the git hooks/post-receive script.
atagar pushed a commit to branch maint
in repository stem.
commit 9844b4f103b37f3f6b62c9d2c1f0abb643ed1814
Author: juga <juga at riseup.net>
AuthorDate: Tue May 30 08:44:42 2023 +0000
Removal of int_from_bytes
Apply patch https://salsa.debian.org/debian/python-stem/-/commit/dd1b86f174e948b04821d7d897cdd15bbb79b6f4
Author: Federico Ceratto <federico at debian.org> 2023-01-14 11:49:58
Patch 56f3daa4c124dae3e050b76d531480f8e233cc59 isn't applicable as it is in maint branch.
Closes #105
---
stem/descriptor/__init__.py | 4 ++--
stem/prereq.py | 2 +-
test/settings.cfg | 1 -
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 49a4d4b5..070b8684 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -1052,14 +1052,14 @@ class Descriptor(object):
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import load_der_public_key
- from cryptography.utils import int_to_bytes, int_from_bytes
+ from cryptography.utils import int_to_bytes
key = load_der_public_key(_bytes_for_block(signing_key), default_backend())
modulus = key.public_numbers().n
public_exponent = key.public_numbers().e
sig_as_bytes = _bytes_for_block(signature)
- sig_as_long = int_from_bytes(sig_as_bytes, byteorder='big') # convert signature to an int
+ sig_as_long = int.from_bytes(sig_as_bytes, byteorder='big') # convert signature to an int
blocksize = len(sig_as_bytes) # 256B for NetworkStatusDocuments, 128B for others
# use the public exponent[e] & the modulus[n] to decrypt the int
diff --git a/stem/prereq.py b/stem/prereq.py
index 4af6c093..d0963c3f 100644
--- a/stem/prereq.py
+++ b/stem/prereq.py
@@ -139,7 +139,7 @@ def is_crypto_available(ed25519 = False):
from stem.util import log
try:
- from cryptography.utils import int_from_bytes, int_to_bytes
+ from cryptography.utils import int_to_bytes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.backends.openssl.backend import backend
from cryptography.hazmat.primitives.asymmetric import rsa
diff --git a/test/settings.cfg b/test/settings.cfg
index 2c18110f..684fd6a2 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -190,7 +190,6 @@ pyflakes.ignore run_tests.py => 'unittest' imported but unused
pyflakes.ignore stem/control.py => undefined name 'controller'
pyflakes.ignore stem/manual.py => undefined name 'unichr'
pyflakes.ignore stem/prereq.py => 'int_to_bytes' imported but unused
-pyflakes.ignore stem/prereq.py => 'int_from_bytes' imported but unused
pyflakes.ignore stem/prereq.py => 'default_backend' imported but unused
pyflakes.ignore stem/prereq.py => 'load_der_public_key' imported but unused
pyflakes.ignore stem/prereq.py => 'modes' imported but unused
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list