diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-06 20:58:18 -0430 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-06 20:58:18 -0430 |
commit | e3ab87d1efe5406a83c411a788f17ca4a92cd99c (patch) | |
tree | c5df800ef890ec6a185d98dd7830a8540694b559 | |
parent | a372db375a34b57fe8efba331b548247a3c42d1a (diff) | |
parent | 7a31eac16d9c00b04846d2ba2690932a9f286b18 (diff) | |
download | cryptography-e3ab87d1efe5406a83c411a788f17ca4a92cd99c.tar.gz cryptography-e3ab87d1efe5406a83c411a788f17ca4a92cd99c.tar.bz2 cryptography-e3ab87d1efe5406a83c411a788f17ca4a92cd99c.zip |
Merge pull request #2767 from alex/delete-software
We wrote a function, now use it
-rw-r--r-- | src/cryptography/hazmat/primitives/serialization.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/cryptography/hazmat/primitives/serialization.py b/src/cryptography/hazmat/primitives/serialization.py index fc50456e..5c166c89 100644 --- a/src/cryptography/hazmat/primitives/serialization.py +++ b/src/cryptography/hazmat/primitives/serialization.py @@ -117,18 +117,8 @@ def _load_ssh_ecdsa_public_key(expected_key_type, decoded_data, backend): "Compressed elliptic curve points are not supported" ) - # key_size is in bits, and sometimes it's not evenly divisible by 8, so we - # add 7 to round up the number of bytes. - if len(data) != 1 + 2 * ((curve.key_size + 7) // 8): - raise ValueError("Malformed key bytes") - - x = utils.int_from_bytes( - data[1:1 + (curve.key_size + 7) // 8], byteorder='big' - ) - y = utils.int_from_bytes( - data[1 + (curve.key_size + 7) // 8:], byteorder='big' - ) - return ec.EllipticCurvePublicNumbers(x, y, curve).public_key(backend) + numbers = ec.EllipticCurvePublicNumbers.from_encoded_point(curve, data) + return numbers.public_key(backend) def _read_next_string(data): |