From 89e1e34d977e565171329c26de6ce9c8f12340e7 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 12 Dec 2018 10:35:27 +0800 Subject: deprecate old from_encoded_point (#4640) --- src/cryptography/hazmat/primitives/asymmetric/ec.py | 9 +++++++++ src/cryptography/utils.py | 1 + 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index 6b1de7c5b..125235f8b 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function import abc +import warnings import six @@ -366,6 +367,14 @@ class EllipticCurvePublicNumbers(object): if not isinstance(curve, EllipticCurve): raise TypeError("curve must be an EllipticCurve instance") + warnings.warn( + "Support for unsafe construction of public numbers from " + "encoded data will be removed in a future version. " + "Please use EllipticCurvePublicKey.from_encoded_point", + utils.DeprecatedIn25, + stacklevel=2, + ) + if data.startswith(b'\x04'): # key_size is in bits. Convert to bytes and round up byte_length = (curve.key_size + 7) // 8 diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py index 65a4ee71b..cbbae3a79 100644 --- a/src/cryptography/utils.py +++ b/src/cryptography/utils.py @@ -23,6 +23,7 @@ class CryptographyDeprecationWarning(UserWarning): PersistentlyDeprecated = CryptographyDeprecationWarning DeprecatedIn21 = CryptographyDeprecationWarning DeprecatedIn23 = CryptographyDeprecationWarning +DeprecatedIn25 = CryptographyDeprecationWarning def _check_bytes(name, value): -- cgit v1.2.3