• 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    AttributeNotFound,
10    Certificate,
11    CertificateBuilder,
12    CertificateRevocationList,
13    CertificateRevocationListBuilder,
14    CertificateSigningRequest,
15    CertificateSigningRequestBuilder,
16    InvalidVersion,
17    RevokedCertificate,
18    RevokedCertificateBuilder,
19    Version,
20    load_der_x509_certificate,
21    load_der_x509_crl,
22    load_der_x509_csr,
23    load_pem_x509_certificate,
24    load_pem_x509_crl,
25    load_pem_x509_csr,
26    random_serial_number,
27)
28from cryptography.x509.extensions import (
29    AccessDescription,
30    AuthorityInformationAccess,
31    AuthorityKeyIdentifier,
32    BasicConstraints,
33    CRLDistributionPoints,
34    CRLNumber,
35    CRLReason,
36    CertificateIssuer,
37    CertificatePolicies,
38    DeltaCRLIndicator,
39    DistributionPoint,
40    DuplicateExtension,
41    ExtendedKeyUsage,
42    Extension,
43    ExtensionNotFound,
44    ExtensionType,
45    Extensions,
46    FreshestCRL,
47    GeneralNames,
48    InhibitAnyPolicy,
49    InvalidityDate,
50    IssuerAlternativeName,
51    IssuingDistributionPoint,
52    KeyUsage,
53    NameConstraints,
54    NoticeReference,
55    OCSPNoCheck,
56    OCSPNonce,
57    PolicyConstraints,
58    PolicyInformation,
59    PrecertPoison,
60    PrecertificateSignedCertificateTimestamps,
61    ReasonFlags,
62    SignedCertificateTimestamps,
63    SubjectAlternativeName,
64    SubjectInformationAccess,
65    SubjectKeyIdentifier,
66    TLSFeature,
67    TLSFeatureType,
68    UnrecognizedExtension,
69    UserNotice,
70)
71from cryptography.x509.general_name import (
72    DNSName,
73    DirectoryName,
74    GeneralName,
75    IPAddress,
76    OtherName,
77    RFC822Name,
78    RegisteredID,
79    UniformResourceIdentifier,
80    UnsupportedGeneralNameType,
81    _GENERAL_NAMES,
82)
83from cryptography.x509.name import (
84    Name,
85    NameAttribute,
86    RelativeDistinguishedName,
87)
88from cryptography.x509.oid import (
89    AuthorityInformationAccessOID,
90    CRLEntryExtensionOID,
91    CertificatePoliciesOID,
92    ExtendedKeyUsageOID,
93    ExtensionOID,
94    NameOID,
95    ObjectIdentifier,
96    SignatureAlgorithmOID,
97    _SIG_OIDS_TO_HASH,
98)
99
100
101OID_AUTHORITY_INFORMATION_ACCESS = ExtensionOID.AUTHORITY_INFORMATION_ACCESS
102OID_AUTHORITY_KEY_IDENTIFIER = ExtensionOID.AUTHORITY_KEY_IDENTIFIER
103OID_BASIC_CONSTRAINTS = ExtensionOID.BASIC_CONSTRAINTS
104OID_CERTIFICATE_POLICIES = ExtensionOID.CERTIFICATE_POLICIES
105OID_CRL_DISTRIBUTION_POINTS = ExtensionOID.CRL_DISTRIBUTION_POINTS
106OID_EXTENDED_KEY_USAGE = ExtensionOID.EXTENDED_KEY_USAGE
107OID_FRESHEST_CRL = ExtensionOID.FRESHEST_CRL
108OID_INHIBIT_ANY_POLICY = ExtensionOID.INHIBIT_ANY_POLICY
109OID_ISSUER_ALTERNATIVE_NAME = ExtensionOID.ISSUER_ALTERNATIVE_NAME
110OID_KEY_USAGE = ExtensionOID.KEY_USAGE
111OID_NAME_CONSTRAINTS = ExtensionOID.NAME_CONSTRAINTS
112OID_OCSP_NO_CHECK = ExtensionOID.OCSP_NO_CHECK
113OID_POLICY_CONSTRAINTS = ExtensionOID.POLICY_CONSTRAINTS
114OID_POLICY_MAPPINGS = ExtensionOID.POLICY_MAPPINGS
115OID_SUBJECT_ALTERNATIVE_NAME = ExtensionOID.SUBJECT_ALTERNATIVE_NAME
116OID_SUBJECT_DIRECTORY_ATTRIBUTES = ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES
117OID_SUBJECT_INFORMATION_ACCESS = ExtensionOID.SUBJECT_INFORMATION_ACCESS
118OID_SUBJECT_KEY_IDENTIFIER = ExtensionOID.SUBJECT_KEY_IDENTIFIER
119
120OID_DSA_WITH_SHA1 = SignatureAlgorithmOID.DSA_WITH_SHA1
121OID_DSA_WITH_SHA224 = SignatureAlgorithmOID.DSA_WITH_SHA224
122OID_DSA_WITH_SHA256 = SignatureAlgorithmOID.DSA_WITH_SHA256
123OID_ECDSA_WITH_SHA1 = SignatureAlgorithmOID.ECDSA_WITH_SHA1
124OID_ECDSA_WITH_SHA224 = SignatureAlgorithmOID.ECDSA_WITH_SHA224
125OID_ECDSA_WITH_SHA256 = SignatureAlgorithmOID.ECDSA_WITH_SHA256
126OID_ECDSA_WITH_SHA384 = SignatureAlgorithmOID.ECDSA_WITH_SHA384
127OID_ECDSA_WITH_SHA512 = SignatureAlgorithmOID.ECDSA_WITH_SHA512
128OID_RSA_WITH_MD5 = SignatureAlgorithmOID.RSA_WITH_MD5
129OID_RSA_WITH_SHA1 = SignatureAlgorithmOID.RSA_WITH_SHA1
130OID_RSA_WITH_SHA224 = SignatureAlgorithmOID.RSA_WITH_SHA224
131OID_RSA_WITH_SHA256 = SignatureAlgorithmOID.RSA_WITH_SHA256
132OID_RSA_WITH_SHA384 = SignatureAlgorithmOID.RSA_WITH_SHA384
133OID_RSA_WITH_SHA512 = SignatureAlgorithmOID.RSA_WITH_SHA512
134OID_RSASSA_PSS = SignatureAlgorithmOID.RSASSA_PSS
135
136OID_COMMON_NAME = NameOID.COMMON_NAME
137OID_COUNTRY_NAME = NameOID.COUNTRY_NAME
138OID_DOMAIN_COMPONENT = NameOID.DOMAIN_COMPONENT
139OID_DN_QUALIFIER = NameOID.DN_QUALIFIER
140OID_EMAIL_ADDRESS = NameOID.EMAIL_ADDRESS
141OID_GENERATION_QUALIFIER = NameOID.GENERATION_QUALIFIER
142OID_GIVEN_NAME = NameOID.GIVEN_NAME
143OID_LOCALITY_NAME = NameOID.LOCALITY_NAME
144OID_ORGANIZATIONAL_UNIT_NAME = NameOID.ORGANIZATIONAL_UNIT_NAME
145OID_ORGANIZATION_NAME = NameOID.ORGANIZATION_NAME
146OID_PSEUDONYM = NameOID.PSEUDONYM
147OID_SERIAL_NUMBER = NameOID.SERIAL_NUMBER
148OID_STATE_OR_PROVINCE_NAME = NameOID.STATE_OR_PROVINCE_NAME
149OID_SURNAME = NameOID.SURNAME
150OID_TITLE = NameOID.TITLE
151
152OID_CLIENT_AUTH = ExtendedKeyUsageOID.CLIENT_AUTH
153OID_CODE_SIGNING = ExtendedKeyUsageOID.CODE_SIGNING
154OID_EMAIL_PROTECTION = ExtendedKeyUsageOID.EMAIL_PROTECTION
155OID_OCSP_SIGNING = ExtendedKeyUsageOID.OCSP_SIGNING
156OID_SERVER_AUTH = ExtendedKeyUsageOID.SERVER_AUTH
157OID_TIME_STAMPING = ExtendedKeyUsageOID.TIME_STAMPING
158
159OID_ANY_POLICY = CertificatePoliciesOID.ANY_POLICY
160OID_CPS_QUALIFIER = CertificatePoliciesOID.CPS_QUALIFIER
161OID_CPS_USER_NOTICE = CertificatePoliciesOID.CPS_USER_NOTICE
162
163OID_CERTIFICATE_ISSUER = CRLEntryExtensionOID.CERTIFICATE_ISSUER
164OID_CRL_REASON = CRLEntryExtensionOID.CRL_REASON
165OID_INVALIDITY_DATE = CRLEntryExtensionOID.INVALIDITY_DATE
166
167OID_CA_ISSUERS = AuthorityInformationAccessOID.CA_ISSUERS
168OID_OCSP = AuthorityInformationAccessOID.OCSP
169
170__all__ = [
171    "certificate_transparency",
172    "load_pem_x509_certificate",
173    "load_der_x509_certificate",
174    "load_pem_x509_csr",
175    "load_der_x509_csr",
176    "load_pem_x509_crl",
177    "load_der_x509_crl",
178    "random_serial_number",
179    "AttributeNotFound",
180    "InvalidVersion",
181    "DeltaCRLIndicator",
182    "DuplicateExtension",
183    "ExtensionNotFound",
184    "UnsupportedGeneralNameType",
185    "NameAttribute",
186    "Name",
187    "RelativeDistinguishedName",
188    "ObjectIdentifier",
189    "ExtensionType",
190    "Extensions",
191    "Extension",
192    "ExtendedKeyUsage",
193    "FreshestCRL",
194    "IssuingDistributionPoint",
195    "TLSFeature",
196    "TLSFeatureType",
197    "OCSPNoCheck",
198    "BasicConstraints",
199    "CRLNumber",
200    "KeyUsage",
201    "AuthorityInformationAccess",
202    "SubjectInformationAccess",
203    "AccessDescription",
204    "CertificatePolicies",
205    "PolicyInformation",
206    "UserNotice",
207    "NoticeReference",
208    "SubjectKeyIdentifier",
209    "NameConstraints",
210    "CRLDistributionPoints",
211    "DistributionPoint",
212    "ReasonFlags",
213    "InhibitAnyPolicy",
214    "SubjectAlternativeName",
215    "IssuerAlternativeName",
216    "AuthorityKeyIdentifier",
217    "GeneralNames",
218    "GeneralName",
219    "RFC822Name",
220    "DNSName",
221    "UniformResourceIdentifier",
222    "RegisteredID",
223    "DirectoryName",
224    "IPAddress",
225    "OtherName",
226    "Certificate",
227    "CertificateRevocationList",
228    "CertificateRevocationListBuilder",
229    "CertificateSigningRequest",
230    "RevokedCertificate",
231    "RevokedCertificateBuilder",
232    "CertificateSigningRequestBuilder",
233    "CertificateBuilder",
234    "Version",
235    "_SIG_OIDS_TO_HASH",
236    "OID_CA_ISSUERS",
237    "OID_OCSP",
238    "_GENERAL_NAMES",
239    "CertificateIssuer",
240    "CRLReason",
241    "InvalidityDate",
242    "UnrecognizedExtension",
243    "PolicyConstraints",
244    "PrecertificateSignedCertificateTimestamps",
245    "PrecertPoison",
246    "OCSPNonce",
247    "SignedCertificateTimestamps",
248]
249