Merge pull request #2768 from reaperhulk/changelog-is-signature-valid
add changelog entry for is_signature_valid
diff --git a/src/cryptography/hazmat/primitives/serialization.py b/src/cryptography/hazmat/primitives/serialization.py
index fc50456..5c166c8 100644
--- a/src/cryptography/hazmat/primitives/serialization.py
+++ b/src/cryptography/hazmat/primitives/serialization.py
@@ -117,18 +117,8 @@
"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):