diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2018-12-12 08:08:27 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2018-12-11 19:08:27 -0500 |
commit | 4c5740a6747b78502f432b662024e5bf6a4ae8c4 (patch) | |
tree | c245a60d06c205cb9c744ea03aeb1b9172abe45e /src/cryptography/hazmat/primitives/asymmetric | |
parent | 0143367da8896d4c188df390ba3fad868b770d02 (diff) | |
download | cryptography-4c5740a6747b78502f432b662024e5bf6a4ae8c4.tar.gz cryptography-4c5740a6747b78502f432b662024e5bf6a4ae8c4.tar.bz2 cryptography-4c5740a6747b78502f432b662024e5bf6a4ae8c4.zip |
Compressed point support (#4629)
* compressed point support
* refactor to use oct2point directly
* small docs change
* remove deprecation for the moment and a bit of review feedback
* no backend arg, implicitly import it
* missed a spot
* double oops
* remove superfluous call
* use refactored method
* use vector file
* one last item
Diffstat (limited to 'src/cryptography/hazmat/primitives/asymmetric')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/ec.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index 1d709d33..6b1de7c5 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -151,6 +151,18 @@ class EllipticCurvePublicKey(object): Verifies the signature of the data. """ + @classmethod + def from_encoded_point(cls, curve, data): + utils._check_bytes("data", data) + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must be an EllipticCurve instance") + + if six.indexbytes(data, 0) not in [0x02, 0x03, 0x04]: + raise ValueError("Unsupported elliptic curve point type") + + from cryptography.hazmat.backends.openssl.backend import backend + return backend.load_elliptic_curve_public_bytes(curve, data) + EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey |