__init__.py 7.5 KB

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