summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-12-12 10:35:27 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2018-12-11 21:35:27 -0500
commit89e1e34d977e565171329c26de6ce9c8f12340e7 (patch)
treee4a01197009f171443392a7e172e756667a86448 /src
parent4c5740a6747b78502f432b662024e5bf6a4ae8c4 (diff)
downloadcryptography-89e1e34d977e565171329c26de6ce9c8f12340e7.tar.gz
deprecate old from_encoded_point (#4640)
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/ec.py9
-rw-r--r--src/cryptography/utils.py1
2 files changed, 10 insertions, 0 deletions
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):