• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
5from __future__ import absolute_import, division, print_function
6
7from cryptography.x509 import certificate_transparency
8from cryptography.x509.base import (
9    Certificate, CertificateBuilder, CertificateRevocationList,
10    CertificateRevocationListBuilder,
11    CertificateSigningRequest, CertificateSigningRequestBuilder,
12    InvalidVersion, RevokedCertificate, RevokedCertificateBuilder,
13    Version, load_der_x509_certificate, load_der_x509_crl, load_der_x509_csr,
14    load_pem_x509_certificate, load_pem_x509_crl, load_pem_x509_csr,
15    random_serial_number,
16)
17from cryptography.x509.extensions import (
18    AccessDescription, AuthorityInformationAccess,
19    AuthorityKeyIdentifier, BasicConstraints, CRLDistributionPoints,
20    CRLNumber, CRLReason, CertificateIssuer, CertificatePolicies,
21    DeltaCRLIndicator, DistributionPoint, DuplicateExtension, ExtendedKeyUsage,
22    Extension, ExtensionNotFound, ExtensionType, Extensions, FreshestCRL,
23    GeneralNames, InhibitAnyPolicy, InvalidityDate, IssuerAlternativeName,
24    IssuingDistributionPoint, KeyUsage, NameConstraints, NoticeReference,
25    OCSPNoCheck, OCSPNonce, PolicyConstraints, PolicyInformation,
26    PrecertPoison, PrecertificateSignedCertificateTimestamps, ReasonFlags,
27    SubjectAlternativeName, SubjectKeyIdentifier, TLSFeature, TLSFeatureType,
28    UnrecognizedExtension, UserNotice
29)
30from cryptography.x509.general_name import (
31    DNSName, DirectoryName, GeneralName, IPAddress, OtherName, RFC822Name,
32    RegisteredID, UniformResourceIdentifier, UnsupportedGeneralNameType,
33    _GENERAL_NAMES
34)
35from cryptography.x509.name import (
36    Name, NameAttribute, RelativeDistinguishedName
37)
38from cryptography.x509.oid import (
39    AuthorityInformationAccessOID, CRLEntryExtensionOID,
40    CertificatePoliciesOID, ExtendedKeyUsageOID, ExtensionOID, NameOID,
41    ObjectIdentifier, SignatureAlgorithmOID, _SIG_OIDS_TO_HASH
42)
43
44
45OID_AUTHORITY_INFORMATION_ACCESS = ExtensionOID.AUTHORITY_INFORMATION_ACCESS
46OID_AUTHORITY_KEY_IDENTIFIER = ExtensionOID.AUTHORITY_KEY_IDENTIFIER
47OID_BASIC_CONSTRAINTS = ExtensionOID.BASIC_CONSTRAINTS
48OID_CERTIFICATE_POLICIES = ExtensionOID.CERTIFICATE_POLICIES
49OID_CRL_DISTRIBUTION_POINTS = ExtensionOID.CRL_DISTRIBUTION_POINTS
50OID_EXTENDED_KEY_USAGE = ExtensionOID.EXTENDED_KEY_USAGE
51OID_FRESHEST_CRL = ExtensionOID.FRESHEST_CRL
52OID_INHIBIT_ANY_POLICY = ExtensionOID.INHIBIT_ANY_POLICY
53OID_ISSUER_ALTERNATIVE_NAME = ExtensionOID.ISSUER_ALTERNATIVE_NAME
54OID_KEY_USAGE = ExtensionOID.KEY_USAGE
55OID_NAME_CONSTRAINTS = ExtensionOID.NAME_CONSTRAINTS
56OID_OCSP_NO_CHECK = ExtensionOID.OCSP_NO_CHECK
57OID_POLICY_CONSTRAINTS = ExtensionOID.POLICY_CONSTRAINTS
58OID_POLICY_MAPPINGS = ExtensionOID.POLICY_MAPPINGS
59OID_SUBJECT_ALTERNATIVE_NAME = ExtensionOID.SUBJECT_ALTERNATIVE_NAME
60OID_SUBJECT_DIRECTORY_ATTRIBUTES = ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES
61OID_SUBJECT_INFORMATION_ACCESS = ExtensionOID.SUBJECT_INFORMATION_ACCESS
62OID_SUBJECT_KEY_IDENTIFIER = ExtensionOID.SUBJECT_KEY_IDENTIFIER
63
64OID_DSA_WITH_SHA1 = SignatureAlgorithmOID.DSA_WITH_SHA1
65OID_DSA_WITH_SHA224 = SignatureAlgorithmOID.DSA_WITH_SHA224
66OID_DSA_WITH_SHA256 = SignatureAlgorithmOID.DSA_WITH_SHA256
67OID_ECDSA_WITH_SHA1 = SignatureAlgorithmOID.ECDSA_WITH_SHA1
68OID_ECDSA_WITH_SHA224 = SignatureAlgorithmOID.ECDSA_WITH_SHA224
69OID_ECDSA_WITH_SHA256 = SignatureAlgorithmOID.ECDSA_WITH_SHA256
70OID_ECDSA_WITH_SHA384 = SignatureAlgorithmOID.ECDSA_WITH_SHA384
71OID_ECDSA_WITH_SHA512 = SignatureAlgorithmOID.ECDSA_WITH_SHA512
72OID_RSA_WITH_MD5 = SignatureAlgorithmOID.RSA_WITH_MD5
73OID_RSA_WITH_SHA1 = SignatureAlgorithmOID.RSA_WITH_SHA1
74OID_RSA_WITH_SHA224 = SignatureAlgorithmOID.RSA_WITH_SHA224
75OID_RSA_WITH_SHA256 = SignatureAlgorithmOID.RSA_WITH_SHA256
76OID_RSA_WITH_SHA384 = SignatureAlgorithmOID.RSA_WITH_SHA384
77OID_RSA_WITH_SHA512 = SignatureAlgorithmOID.RSA_WITH_SHA512
78OID_RSASSA_PSS = SignatureAlgorithmOID.RSASSA_PSS
79
80OID_COMMON_NAME = NameOID.COMMON_NAME
81OID_COUNTRY_NAME = NameOID.COUNTRY_NAME
82OID_DOMAIN_COMPONENT = NameOID.DOMAIN_COMPONENT
83OID_DN_QUALIFIER = NameOID.DN_QUALIFIER
84OID_EMAIL_ADDRESS = NameOID.EMAIL_ADDRESS
85OID_GENERATION_QUALIFIER = NameOID.GENERATION_QUALIFIER
86OID_GIVEN_NAME = NameOID.GIVEN_NAME
87OID_LOCALITY_NAME = NameOID.LOCALITY_NAME
88OID_ORGANIZATIONAL_UNIT_NAME = NameOID.ORGANIZATIONAL_UNIT_NAME
89OID_ORGANIZATION_NAME = NameOID.ORGANIZATION_NAME
90OID_PSEUDONYM = NameOID.PSEUDONYM
91OID_SERIAL_NUMBER = NameOID.SERIAL_NUMBER
92OID_STATE_OR_PROVINCE_NAME = NameOID.STATE_OR_PROVINCE_NAME
93OID_SURNAME = NameOID.SURNAME
94OID_TITLE = NameOID.TITLE
95
96OID_CLIENT_AUTH = ExtendedKeyUsageOID.CLIENT_AUTH
97OID_CODE_SIGNING = ExtendedKeyUsageOID.CODE_SIGNING
98OID_EMAIL_PROTECTION = ExtendedKeyUsageOID.EMAIL_PROTECTION
99OID_OCSP_SIGNING = ExtendedKeyUsageOID.OCSP_SIGNING
100OID_SERVER_AUTH = ExtendedKeyUsageOID.SERVER_AUTH
101OID_TIME_STAMPING = ExtendedKeyUsageOID.TIME_STAMPING
102
103OID_ANY_POLICY = CertificatePoliciesOID.ANY_POLICY
104OID_CPS_QUALIFIER = CertificatePoliciesOID.CPS_QUALIFIER
105OID_CPS_USER_NOTICE = CertificatePoliciesOID.CPS_USER_NOTICE
106
107OID_CERTIFICATE_ISSUER = CRLEntryExtensionOID.CERTIFICATE_ISSUER
108OID_CRL_REASON = CRLEntryExtensionOID.CRL_REASON
109OID_INVALIDITY_DATE = CRLEntryExtensionOID.INVALIDITY_DATE
110
111OID_CA_ISSUERS = AuthorityInformationAccessOID.CA_ISSUERS
112OID_OCSP = AuthorityInformationAccessOID.OCSP
113
114__all__ = [
115    "certificate_transparency",
116    "load_pem_x509_certificate",
117    "load_der_x509_certificate",
118    "load_pem_x509_csr",
119    "load_der_x509_csr",
120    "load_pem_x509_crl",
121    "load_der_x509_crl",
122    "random_serial_number",
123    "InvalidVersion",
124    "DeltaCRLIndicator",
125    "DuplicateExtension",
126    "ExtensionNotFound",
127    "UnsupportedGeneralNameType",
128    "NameAttribute",
129    "Name",
130    "RelativeDistinguishedName",
131    "ObjectIdentifier",
132    "ExtensionType",
133    "Extensions",
134    "Extension",
135    "ExtendedKeyUsage",
136    "FreshestCRL",
137    "IssuingDistributionPoint",
138    "TLSFeature",
139    "TLSFeatureType",
140    "OCSPNoCheck",
141    "BasicConstraints",
142    "CRLNumber",
143    "KeyUsage",
144    "AuthorityInformationAccess",
145    "AccessDescription",
146    "CertificatePolicies",
147    "PolicyInformation",
148    "UserNotice",
149    "NoticeReference",
150    "SubjectKeyIdentifier",
151    "NameConstraints",
152    "CRLDistributionPoints",
153    "DistributionPoint",
154    "ReasonFlags",
155    "InhibitAnyPolicy",
156    "SubjectAlternativeName",
157    "IssuerAlternativeName",
158    "AuthorityKeyIdentifier",
159    "GeneralNames",
160    "GeneralName",
161    "RFC822Name",
162    "DNSName",
163    "UniformResourceIdentifier",
164    "RegisteredID",
165    "DirectoryName",
166    "IPAddress",
167    "OtherName",
168    "Certificate",
169    "CertificateRevocationList",
170    "CertificateRevocationListBuilder",
171    "CertificateSigningRequest",
172    "RevokedCertificate",
173    "RevokedCertificateBuilder",
174    "CertificateSigningRequestBuilder",
175    "CertificateBuilder",
176    "Version",
177    "_SIG_OIDS_TO_HASH",
178    "OID_CA_ISSUERS",
179    "OID_OCSP",
180    "_GENERAL_NAMES",
181    "CertificateIssuer",
182    "CRLReason",
183    "InvalidityDate",
184    "UnrecognizedExtension",
185    "PolicyConstraints",
186    "PrecertificateSignedCertificateTimestamps",
187    "PrecertPoison",
188    "OCSPNonce",
189]
190