From 197db3367ceecdbaf0adc5eaa9339b934b10acfe Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 28 Oct 2015 10:09:49 +0900 Subject: address review feedback --- src/cryptography/hazmat/primitives/asymmetric/ec.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index f25ea6de..7782133c 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -272,21 +272,18 @@ class EllipticCurvePublicNumbers(object): if not isinstance(curve, EllipticCurve): raise TypeError("curve must be an EllipticCurve instance") - if data == b'\x00': - raise ValueError("null points are not supported") - elif data.startswith(b'\x04'): + if data.startswith(b'\x04'): # key_size is in bits. Convert to bytes and round up byte_length = (curve.key_size + 7) // 8 if len(data) == 2 * byte_length + 1: x = utils.int_from_bytes(data[1:byte_length + 1], 'big') y = utils.int_from_bytes(data[byte_length + 1:], 'big') + return cls(x, y, curve) else: raise ValueError('Invalid elliptic curve point data length') else: raise ValueError('Unsupported elliptic curve point type') - return cls(x, y, curve) - curve = utils.read_only_property("_curve") x = utils.read_only_property("_x") y = utils.read_only_property("_y") -- cgit v1.2.3