diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/utils.py | 14 | ||||
-rw-r--r-- | src/cryptography/x509.py | 2 |
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") |