aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 11:10:32 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 11:10:32 -0500
commita39e3d165bfc3e4dd94a80d8ff17af356113d918 (patch)
tree99d764554eeb9a6d013e7f096def69306fba278f
parentdbd47de45a7dd40ea1e2d1bc941ee07ddf6b1a59 (diff)
downloadcryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.tar.gz
cryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.tar.bz2
cryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.zip
py3 int.to_bytes is dead to me
-rw-r--r--src/cryptography/utils.py14
-rw-r--r--src/cryptography/x509.py2
2 files changed, 5 insertions, 11 deletions
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index 4ca4a7a2..993571bd 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -47,16 +47,10 @@ else:
return result
-if hasattr(int, "to_bytes"):
- int_to_bytes = int.to_bytes
-else:
- def int_to_bytes(integer, byteorder, signed=False):
- assert byteorder == 'big'
- assert not signed
-
- hex_string = '%x' % integer
- n = len(hex_string)
- return binascii.unhexlify(hex_string.zfill(n + (n & 1)))
+def int_to_bytes(integer):
+ hex_string = '%x' % integer
+ n = len(hex_string)
+ return binascii.unhexlify(hex_string.zfill(n + (n & 1)))
class InterfaceNotImplemented(Exception):
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 3254f26f..82b8bd36 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -698,7 +698,7 @@ class SubjectKeyIdentifier(object):
for bit in spki.getComponentByName("subjectPublicKey"):
bits = bits << 1 | bit
- data = utils.int_to_bytes(bits, "big")
+ data = utils.int_to_bytes(bits)
return cls(hashlib.sha1(data).digest())
digest = utils.read_only_property("_digest")