aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2019-11-03 01:47:13 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2019-11-03 13:47:13 +0800
commit9668b000326585339267a42176facd9ff81481ee (patch)
treed9b57ace202f397461f9cb8aca436a24a68f699a /src
parent6d450f7fdc6be790443d82aa5aff8572ba3965bf (diff)
downloadcryptography-9668b000326585339267a42176facd9ff81481ee.tar.gz
cryptography-9668b000326585339267a42176facd9ff81481ee.tar.bz2
cryptography-9668b000326585339267a42176facd9ff81481ee.zip
Deal with the 2.5 deprecations (#5048)
* Deal with the 2.5 deprecations * pep8 + test fixes * docs typo * Why did I do this? * typo
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/x25519.py16
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/ec.py4
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/x25519.py2
-rw-r--r--src/cryptography/utils.py2
4 files changed, 5 insertions, 19 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x25519.py b/src/cryptography/hazmat/backends/openssl/x25519.py
index 9aab25b8..8708834e 100644
--- a/src/cryptography/hazmat/backends/openssl/x25519.py
+++ b/src/cryptography/hazmat/backends/openssl/x25519.py
@@ -4,8 +4,6 @@
from __future__ import absolute_import, division, print_function
-import warnings
-
from cryptography import utils
from cryptography.hazmat.backends.openssl.utils import _evp_pkey_derive
from cryptography.hazmat.primitives import serialization
@@ -23,19 +21,7 @@ class _X25519PublicKey(object):
self._backend = backend
self._evp_pkey = evp_pkey
- def public_bytes(self, encoding=None, format=None):
- if encoding is None or format is None:
- if encoding is not None or format is not None:
- raise ValueError("Both encoding and format are required")
- else:
- warnings.warn(
- "public_bytes now requires encoding and format arguments. "
- "Support for calling without arguments will be removed in "
- "cryptography 2.7",
- utils.DeprecatedIn25,
- )
- encoding = serialization.Encoding.Raw
- format = serialization.PublicFormat.Raw
+ def public_bytes(self, encoding, format):
if (
encoding is serialization.Encoding.Raw or
format is serialization.PublicFormat.Raw
diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py
index 529391f9..eef922dc 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/ec.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py
@@ -364,7 +364,7 @@ class EllipticCurvePublicNumbers(object):
" and will be removed in a future version. Please use "
"EllipticCurvePublicKey.public_bytes to obtain both "
"compressed and uncompressed point encoding.",
- utils.DeprecatedIn25,
+ utils.PersistentlyDeprecated2019,
stacklevel=2,
)
# key_size is in bits. Convert to bytes and round up
@@ -383,7 +383,7 @@ class EllipticCurvePublicNumbers(object):
"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,
+ utils.PersistentlyDeprecated2019,
stacklevel=2,
)
diff --git a/src/cryptography/hazmat/primitives/asymmetric/x25519.py b/src/cryptography/hazmat/primitives/asymmetric/x25519.py
index 4e8badf4..61a95ffa 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/x25519.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/x25519.py
@@ -25,7 +25,7 @@ class X25519PublicKey(object):
return backend.x25519_load_public_bytes(data)
@abc.abstractmethod
- def public_bytes(self, encoding=None, format=None):
+ def public_bytes(self, encoding, format):
"""
The serialized bytes of the public key.
"""
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index 0b36f637..e895aa05 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -22,7 +22,7 @@ class CryptographyDeprecationWarning(UserWarning):
# cycle ends.
PersistentlyDeprecated2017 = CryptographyDeprecationWarning
PersistentlyDeprecated2018 = CryptographyDeprecationWarning
-DeprecatedIn25 = CryptographyDeprecationWarning
+PersistentlyDeprecated2019 = CryptographyDeprecationWarning
DeprecatedIn27 = CryptographyDeprecationWarning