diff options
-rw-r--r-- | src/cryptography/hazmat/backends/__init__.py | 2 | ||||
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x509.py | 2 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/utils.py | 4 | ||||
-rw-r--r-- | src/cryptography/utils.py | 10 | ||||
-rw-r--r-- | src/cryptography/x509/extensions.py | 14 | ||||
-rw-r--r-- | tests/test_x509.py | 4 | ||||
-rw-r--r-- | tests/test_x509_ext.py | 11 |
7 files changed, 12 insertions, 35 deletions
diff --git a/src/cryptography/hazmat/backends/__init__.py b/src/cryptography/hazmat/backends/__init__.py index b191cbe6..ff8e8f0f 100644 --- a/src/cryptography/hazmat/backends/__init__.py +++ b/src/cryptography/hazmat/backends/__init__.py @@ -20,7 +20,7 @@ def _available_backends(): import pkg_resources entry_point_backends = [ - # DeprecatedIn16 + # PersistentlyDeprecated # setuptools 11.3 deprecated support for the require parameter to # load(), and introduced the new resolve() method instead. # We previously removed this fallback, but users are having issues diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py index 1f63d85f..5b3304f3 100644 --- a/src/cryptography/hazmat/backends/openssl/x509.py +++ b/src/cryptography/hazmat/backends/openssl/x509.py @@ -61,7 +61,7 @@ class _Certificate(object): def serial(self): warnings.warn( "Certificate serial is deprecated, use serial_number instead.", - utils.DeprecatedIn14, + utils.PersistentlyDeprecated, stacklevel=2 ) return self.serial_number diff --git a/src/cryptography/hazmat/primitives/asymmetric/utils.py b/src/cryptography/hazmat/primitives/asymmetric/utils.py index 4c2337bf..ef1e7eb9 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/utils.py +++ b/src/cryptography/hazmat/primitives/asymmetric/utils.py @@ -18,7 +18,7 @@ def decode_rfc6979_signature(signature): warnings.warn( "decode_rfc6979_signature is deprecated and will " "be removed in a future version, use decode_dss_signature instead.", - utils.DeprecatedIn10, + utils.PersistentlyDeprecated, stacklevel=2 ) return decode_dss_signature(signature) @@ -33,7 +33,7 @@ def encode_rfc6979_signature(r, s): warnings.warn( "encode_rfc6979_signature is deprecated and will " "be removed in a future version, use encode_dss_signature instead.", - utils.DeprecatedIn10, + utils.PersistentlyDeprecated, stacklevel=2 ) return encode_dss_signature(r, s) diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py index 8183bdaf..ab3c84e1 100644 --- a/src/cryptography/utils.py +++ b/src/cryptography/utils.py @@ -13,12 +13,10 @@ import warnings from packaging.version import parse -# the functions deprecated in 1.0 and 1.4 are on an arbitrarily extended -# deprecation cycle and should not be removed until we agree on when that cycle -# ends. -DeprecatedIn10 = DeprecationWarning -DeprecatedIn14 = DeprecationWarning -DeprecatedIn16 = DeprecationWarning +# Several APIs were deprecated with no specific end-of-life date because of the +# ubiquity of their use. They should not be removed until we agree on when that +# cycle ends. +PersistentlyDeprecated = DeprecationWarning def read_only_property(name): diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index 1a3ced7d..ba19b3a3 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -8,7 +8,6 @@ import abc import datetime import hashlib import ipaddress -import warnings from enum import Enum from asn1crypto.keys import PublicKeyInfo @@ -20,7 +19,7 @@ from cryptography.hazmat.primitives import constant_time, serialization from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePublicKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey from cryptography.x509.general_name import GeneralName, IPAddress, OtherName -from cryptography.x509.name import Name, RelativeDistinguishedName +from cryptography.x509.name import RelativeDistinguishedName from cryptography.x509.oid import ( CRLEntryExtensionOID, ExtensionOID, ObjectIdentifier ) @@ -421,16 +420,7 @@ class DistributionPoint(object): ) if relative_name: - if isinstance(relative_name, Name): - warnings.warn( - "relative_name=<Name> is deprecated and will " - "be removed in a future version; use " - "<RelativeDistinguishedName> instead.", - utils.DeprecatedIn16, - stacklevel=2 - ) - relative_name = RelativeDistinguishedName(relative_name) - elif not isinstance(relative_name, RelativeDistinguishedName): + if not isinstance(relative_name, RelativeDistinguishedName): raise TypeError( "relative_name must be a RelativeDistinguishedName" ) diff --git a/tests/test_x509.py b/tests/test_x509.py index db26f563..de19d0d3 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -521,7 +521,7 @@ class TestRSACertificate(object): ) with warnings.catch_warnings(): - warnings.simplefilter("always", utils.DeprecatedIn10) + warnings.simplefilter("always", utils.PersistentlyDeprecated) assert cert.serial == 2 assert cert.serial_number == 2 @@ -533,7 +533,7 @@ class TestRSACertificate(object): ) with warnings.catch_warnings(): - warnings.simplefilter("always", utils.DeprecatedIn10) + warnings.simplefilter("always", utils.PersistentlyDeprecated) with pytest.deprecated_call(): cert.serial diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 7104121d..8210b058 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -3003,17 +3003,6 @@ class TestDistributionPoint(object): with pytest.raises(ValueError): x509.DistributionPoint("data", "notname", None, None) - def test_relative_name_name_value_deprecated(self): - with pytest.deprecated_call(): - x509.DistributionPoint( - None, - x509.Name([ - x509.NameAttribute(NameOID.COMMON_NAME, u"myCN") - ]), - None, - None - ) - def test_crl_issuer_not_general_names(self): with pytest.raises(TypeError): x509.DistributionPoint(None, None, None, ["notgn"]) |