diff options
-rw-r--r-- | src/OpenSSL/SSL.py | 13 | ||||
-rw-r--r-- | src/OpenSSL/crypto.py | 61 |
2 files changed, 62 insertions, 12 deletions
diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py index 8bbde5b..85d6e76 100644 --- a/src/OpenSSL/SSL.py +++ b/src/OpenSSL/SSL.py @@ -5,6 +5,8 @@ from itertools import count, chain from weakref import WeakValueDictionary from errno import errorcode +from cryptography.utils import deprecated + from six import binary_type as _binary_type from six import integer_types as integer_types from six import int2byte, indexbytes @@ -1267,7 +1269,10 @@ class Context(object): self._set_ocsp_callback(helper, data) -ContextType = Context +ContextType = deprecated( + Context, __name__, + "ContextType has been deprecated, use Context instead", DeprecationWarning +) class Connection(object): @@ -2153,7 +2158,11 @@ class Connection(object): _openssl_assert(rc == 1) -ConnectionType = Connection +ConnectionType = deprecated( + Connection, __name__, + "ConnectionType has been deprecated, use Connection instead", + DeprecationWarning +) # This is similar to the initialization calls at the end of OpenSSL/crypto.py # but is exercised mostly by the Context initializer. diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index cdbcc22..ba918cc 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -12,6 +12,7 @@ from six import ( from cryptography import x509 from cryptography.hazmat.primitives.asymmetric import dsa, rsa +from cryptography.utils import deprecated from OpenSSL._util import ( ffi as _ffi, @@ -313,7 +314,11 @@ class PKey(object): return _lib.EVP_PKEY_bits(self._pkey) -PKeyType = PKey +PKeyType = deprecated( + PKey, __name__, + "PKeyType has been deprecated, use PKey instead", + DeprecationWarning +) class _EllipticCurve(object): @@ -648,7 +653,11 @@ class X509Name(object): return result -X509NameType = X509Name +X509NameType = deprecated( + X509Name, __name__, + "X509NameType has been deprecated, use X509Name instead", + DeprecationWarning +) class X509Extension(object): @@ -816,7 +825,11 @@ class X509Extension(object): return _ffi.buffer(char_result, result_length)[:] -X509ExtensionType = X509Extension +X509ExtensionType = deprecated( + X509Extension, __name__, + "X509ExtensionType has been deprecated, use X509Extension instead", + DeprecationWarning +) class X509Req(object): @@ -985,7 +998,11 @@ class X509Req(object): return result -X509ReqType = X509Req +X509ReqType = deprecated( + X509Req, __name__, + "X509ReqType has been deprecated, use X509Req instead", + DeprecationWarning +) class X509(object): @@ -1436,7 +1453,11 @@ class X509(object): return ext -X509Type = X509 +X509Type = deprecated( + X509, __name__, + "X509Type has been deprecated, use X509 instead", + DeprecationWarning +) class X509StoreFlags(object): @@ -1564,7 +1585,11 @@ class X509Store(object): _openssl_assert(_lib.X509_STORE_set1_param(self._store, param) != 0) -X509StoreType = X509Store +X509StoreType = deprecated( + X509Store, __name__, + "X509StoreType has been deprecated, use X509Store instead", + DeprecationWarning +) class X509StoreContextError(Exception): @@ -2175,7 +2200,11 @@ class CRL(object): return dump_crl(type, self) -CRLType = CRL +CRLType = deprecated( + CRL, __name__, + "CRLType has been deprecated, use CRL instead", + DeprecationWarning +) class PKCS7(object): @@ -2222,7 +2251,11 @@ class PKCS7(object): return _ffi.string(string_type) -PKCS7Type = PKCS7 +PKCS7Type = deprecated( + PKCS7, __name__, + "PKCS7Type has been deprecated, use PKCS7 instead", + DeprecationWarning +) class PKCS12(object): @@ -2399,7 +2432,11 @@ class PKCS12(object): return _bio_to_string(bio) -PKCS12Type = PKCS12 +PKCS12Type = deprecated( + PKCS12, __name__, + "PKCS12Type has been deprecated, use PKCS12 instead", + DeprecationWarning +) class NetscapeSPKI(object): @@ -2492,7 +2529,11 @@ class NetscapeSPKI(object): _openssl_assert(set_result == 1) -NetscapeSPKIType = NetscapeSPKI +NetscapeSPKIType = deprecated( + NetscapeSPKI, __name__, + "NetscapeSPKIType has been deprecated, use NetscapeSPKI instead", + DeprecationWarning +) class _PassphraseHelper(object): |