diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-28 10:09:49 +0900 | 
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-28 10:09:49 +0900 | 
| commit | 197db3367ceecdbaf0adc5eaa9339b934b10acfe (patch) | |
| tree | a7d0e14dbd38662462973702e0f72805d2293ebb /src | |
| parent | 1a1b1157a2d393b314f3e1303f2f724118d2cae2 (diff) | |
| download | cryptography-197db3367ceecdbaf0adc5eaa9339b934b10acfe.tar.gz cryptography-197db3367ceecdbaf0adc5eaa9339b934b10acfe.tar.bz2 cryptography-197db3367ceecdbaf0adc5eaa9339b934b10acfe.zip  | |
address review feedback
Diffstat (limited to 'src')
| -rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/ec.py | 7 | 
1 files changed, 2 insertions, 5 deletions
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")  | 
