diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x509.py | 9 | ||||
-rw-r--r-- | src/cryptography/utils.py | 6 | ||||
-rw-r--r-- | src/cryptography/x509/base.py | 6 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py index 71a2fb78..94a81ce6 100644 --- a/src/cryptography/hazmat/backends/openssl/x509.py +++ b/src/cryptography/hazmat/backends/openssl/x509.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function import operator +import warnings from cryptography import utils, x509 from cryptography.exceptions import UnsupportedAlgorithm @@ -58,6 +59,14 @@ class _Certificate(object): @property def serial(self): + warnings.warn( + "Certificate serial is deprecated, use serial_number instead.", + utils.DeprecatedIn10 + ) + return self.serial_number + + @property + def serial_number(self): asn1_int = self._backend._lib.X509_get_serialNumber(self._x509) self._backend.openssl_assert(asn1_int != self._backend._ffi.NULL) return _asn1_integer_to_int(self._backend, asn1_int) diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py index 4c006278..d3e845ab 100644 --- a/src/cryptography/utils.py +++ b/src/cryptography/utils.py @@ -12,9 +12,11 @@ import sys import warnings -# the functions deprecated in 1.0 are on an arbitrarily extended deprecation -# cycle and should not be removed until we agree on when that cycle ends. +# 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 def read_only_property(name): diff --git a/src/cryptography/x509/base.py b/src/cryptography/x509/base.py index 4a22ed02..8e3f9668 100644 --- a/src/cryptography/x509/base.py +++ b/src/cryptography/x509/base.py @@ -69,6 +69,12 @@ class Certificate(object): """ @abc.abstractproperty + def serial_number(self): + """ + Returns certificate serial number + """ + + @abc.abstractproperty def version(self): """ Returns the certificate version |