diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-09-22 21:29:36 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2017-09-22 09:29:36 -0400 |
commit | 5e3cc98473ad54db390736ac81bb74210e85056d (patch) | |
tree | d8e0d5e03aee005dc0205661e55d785625b9a71f /src/cryptography/x509 | |
parent | 2fc5849960032a246f869ed1a5d7597d64169cfa (diff) | |
download | cryptography-5e3cc98473ad54db390736ac81bb74210e85056d.tar.gz cryptography-5e3cc98473ad54db390736ac81bb74210e85056d.tar.bz2 cryptography-5e3cc98473ad54db390736ac81bb74210e85056d.zip |
support delta crl indicator extension (#3936)
This is an extension for CRLs
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r-- | src/cryptography/x509/__init__.py | 5 | ||||
-rw-r--r-- | src/cryptography/x509/extensions.py | 28 | ||||
-rw-r--r-- | src/cryptography/x509/oid.py | 2 |
3 files changed, 33 insertions, 2 deletions
diff --git a/src/cryptography/x509/__init__.py b/src/cryptography/x509/__init__.py index 176ed8ca..e168adb7 100644 --- a/src/cryptography/x509/__init__.py +++ b/src/cryptography/x509/__init__.py @@ -18,8 +18,8 @@ from cryptography.x509.extensions import ( AccessDescription, AuthorityInformationAccess, AuthorityKeyIdentifier, BasicConstraints, CRLDistributionPoints, CRLNumber, CRLReason, CertificateIssuer, CertificatePolicies, - DistributionPoint, DuplicateExtension, ExtendedKeyUsage, Extension, - ExtensionNotFound, ExtensionType, Extensions, GeneralNames, + DeltaCRLIndicator, DistributionPoint, DuplicateExtension, ExtendedKeyUsage, + Extension, ExtensionNotFound, ExtensionType, Extensions, GeneralNames, InhibitAnyPolicy, InvalidityDate, IssuerAlternativeName, KeyUsage, NameConstraints, NoticeReference, OCSPNoCheck, PolicyConstraints, PolicyInformation, PrecertificateSignedCertificateTimestamps, ReasonFlags, @@ -119,6 +119,7 @@ __all__ = [ "load_der_x509_crl", "random_serial_number", "InvalidVersion", + "DeltaCRLIndicator", "DuplicateExtension", "ExtensionNotFound", "UnsupportedGeneralNameType", diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py index 442000e3..beb20bad 100644 --- a/src/cryptography/x509/extensions.py +++ b/src/cryptography/x509/extensions.py @@ -376,6 +376,34 @@ class BasicConstraints(object): @utils.register_interface(ExtensionType) +class DeltaCRLIndicator(object): + oid = ExtensionOID.DELTA_CRL_INDICATOR + + def __init__(self, crl_number): + if not isinstance(crl_number, six.integer_types): + raise TypeError("crl_number must be an integer") + + self._crl_number = crl_number + + crl_number = utils.read_only_property("_crl_number") + + def __eq__(self, other): + if not isinstance(other, DeltaCRLIndicator): + return NotImplemented + + return self.crl_number == other.crl_number + + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash(self.crl_number) + + def __repr__(self): + return "<DeltaCRLIndicator(crl_number={0.crl_number})>".format(self) + + +@utils.register_interface(ExtensionType) class CRLDistributionPoints(object): oid = ExtensionOID.CRL_DISTRIBUTION_POINTS diff --git a/src/cryptography/x509/oid.py b/src/cryptography/x509/oid.py index 7f8c9031..fedea310 100644 --- a/src/cryptography/x509/oid.py +++ b/src/cryptography/x509/oid.py @@ -87,6 +87,7 @@ class ExtensionOID(object): OCSP_NO_CHECK = ObjectIdentifier("1.3.6.1.5.5.7.48.1.5") TLS_FEATURE = ObjectIdentifier("1.3.6.1.5.5.7.1.24") CRL_NUMBER = ObjectIdentifier("2.5.29.20") + DELTA_CRL_INDICATOR = ObjectIdentifier("2.5.29.27") PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS = ( ObjectIdentifier("1.3.6.1.4.1.11129.2.4.2") ) @@ -256,6 +257,7 @@ _OID_NAMES = { ExtensionOID.SUBJECT_INFORMATION_ACCESS: "subjectInfoAccess", ExtensionOID.OCSP_NO_CHECK: "OCSPNoCheck", ExtensionOID.CRL_NUMBER: "cRLNumber", + ExtensionOID.DELTA_CRL_INDICATOR: "deltaCRLIndicator", ExtensionOID.TLS_FEATURE: "TLSFeature", AuthorityInformationAccessOID.OCSP: "OCSP", AuthorityInformationAccessOID.CA_ISSUERS: "caIssuers", |