@pairling/runtime-darwin-x64 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/bin/pairling-connectd +0 -0
  3. package/manifest.json +4 -4
  4. package/package.json +3 -3
  5. package/python/bin/python3 +0 -0
  6. package/python/bin/python3.12 +0 -0
  7. package/python/lib/libpython3.12.dylib +0 -0
  8. package/python/lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so +0 -0
  9. package/python/lib/python3.12/lib-dynload/_dbm.cpython-312-darwin.so +0 -0
  10. package/python/lib/python3.12/site-packages/_cffi_backend.cpython-312-darwin.so +0 -0
  11. package/python/lib/python3.12/site-packages/cffi/__init__.py +14 -0
  12. package/python/lib/python3.12/site-packages/cffi/_cffi_errors.h +149 -0
  13. package/python/lib/python3.12/site-packages/cffi/_cffi_include.h +389 -0
  14. package/python/lib/python3.12/site-packages/cffi/_embedding.h +550 -0
  15. package/python/lib/python3.12/site-packages/cffi/_imp_emulation.py +83 -0
  16. package/python/lib/python3.12/site-packages/cffi/_shimmed_dist_utils.py +45 -0
  17. package/python/lib/python3.12/site-packages/cffi/api.py +967 -0
  18. package/python/lib/python3.12/site-packages/cffi/backend_ctypes.py +1121 -0
  19. package/python/lib/python3.12/site-packages/cffi/cffi_opcode.py +187 -0
  20. package/python/lib/python3.12/site-packages/cffi/commontypes.py +82 -0
  21. package/python/lib/python3.12/site-packages/cffi/cparser.py +1015 -0
  22. package/python/lib/python3.12/site-packages/cffi/error.py +31 -0
  23. package/python/lib/python3.12/site-packages/cffi/ffiplatform.py +113 -0
  24. package/python/lib/python3.12/site-packages/cffi/lock.py +30 -0
  25. package/python/lib/python3.12/site-packages/cffi/model.py +618 -0
  26. package/python/lib/python3.12/site-packages/cffi/parse_c_type.h +181 -0
  27. package/python/lib/python3.12/site-packages/cffi/pkgconfig.py +121 -0
  28. package/python/lib/python3.12/site-packages/cffi/recompiler.py +1598 -0
  29. package/python/lib/python3.12/site-packages/cffi/setuptools_ext.py +216 -0
  30. package/python/lib/python3.12/site-packages/cffi/vengine_cpy.py +1084 -0
  31. package/python/lib/python3.12/site-packages/cffi/vengine_gen.py +679 -0
  32. package/python/lib/python3.12/site-packages/cffi/verifier.py +306 -0
  33. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/INSTALLER +1 -0
  34. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/LICENSE +26 -0
  35. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/METADATA +40 -0
  36. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD +30 -0
  37. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/WHEEL +5 -0
  38. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/entry_points.txt +2 -0
  39. package/python/lib/python3.12/site-packages/cffi-1.17.1.dist-info/top_level.txt +2 -0
  40. package/python/lib/python3.12/site-packages/cryptography/__about__.py +17 -0
  41. package/python/lib/python3.12/site-packages/cryptography/__init__.py +26 -0
  42. package/python/lib/python3.12/site-packages/cryptography/exceptions.py +52 -0
  43. package/python/lib/python3.12/site-packages/cryptography/fernet.py +224 -0
  44. package/python/lib/python3.12/site-packages/cryptography/hazmat/__init__.py +13 -0
  45. package/python/lib/python3.12/site-packages/cryptography/hazmat/_oid.py +348 -0
  46. package/python/lib/python3.12/site-packages/cryptography/hazmat/backends/__init__.py +13 -0
  47. package/python/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/__init__.py +9 -0
  48. package/python/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/backend.py +308 -0
  49. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/__init__.py +3 -0
  50. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi +37 -0
  51. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi +8 -0
  52. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi +7 -0
  53. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi +17 -0
  54. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi +117 -0
  55. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi +75 -0
  56. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/aead.pyi +107 -0
  57. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ciphers.pyi +38 -0
  58. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi +18 -0
  59. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi +51 -0
  60. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi +41 -0
  61. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ec.pyi +52 -0
  62. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi +13 -0
  63. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi +13 -0
  64. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi +28 -0
  65. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi +22 -0
  66. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi +49 -0
  67. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/keys.pyi +34 -0
  68. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi +15 -0
  69. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/rsa.pyi +55 -0
  70. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi +13 -0
  71. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi +13 -0
  72. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/pkcs12.pyi +52 -0
  73. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi +50 -0
  74. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/test_support.pyi +23 -0
  75. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +313 -0
  76. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/_rust.abi3.so +0 -0
  77. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/__init__.py +3 -0
  78. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py +191 -0
  79. package/python/lib/python3.12/site-packages/cryptography/hazmat/bindings/openssl/binding.py +122 -0
  80. package/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/__init__.py +5 -0
  81. package/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/ciphers/__init__.py +5 -0
  82. package/python/lib/python3.12/site-packages/cryptography/hazmat/decrepit/ciphers/algorithms.py +112 -0
  83. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/__init__.py +3 -0
  84. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_asymmetric.py +19 -0
  85. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py +60 -0
  86. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/_serialization.py +168 -0
  87. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py +3 -0
  88. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/dh.py +147 -0
  89. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py +167 -0
  90. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py +447 -0
  91. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py +129 -0
  92. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/ed448.py +131 -0
  93. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py +113 -0
  94. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py +277 -0
  95. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/types.py +111 -0
  96. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py +24 -0
  97. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py +122 -0
  98. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/asymmetric/x448.py +125 -0
  99. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py +27 -0
  100. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/aead.py +23 -0
  101. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py +183 -0
  102. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.py +146 -0
  103. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/modes.py +268 -0
  104. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/cmac.py +10 -0
  105. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/constant_time.py +14 -0
  106. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/hashes.py +246 -0
  107. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/hmac.py +13 -0
  108. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/__init__.py +23 -0
  109. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/argon2.py +13 -0
  110. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py +125 -0
  111. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py +101 -0
  112. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py +305 -0
  113. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py +62 -0
  114. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py +19 -0
  115. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/kdf/x963kdf.py +61 -0
  116. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/keywrap.py +177 -0
  117. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/padding.py +69 -0
  118. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/poly1305.py +11 -0
  119. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/__init__.py +65 -0
  120. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/base.py +14 -0
  121. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py +176 -0
  122. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py +411 -0
  123. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/serialization/ssh.py +1619 -0
  124. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/__init__.py +9 -0
  125. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/hotp.py +101 -0
  126. package/python/lib/python3.12/site-packages/cryptography/hazmat/primitives/twofactor/totp.py +56 -0
  127. package/python/lib/python3.12/site-packages/cryptography/py.typed +0 -0
  128. package/python/lib/python3.12/site-packages/cryptography/utils.py +139 -0
  129. package/python/lib/python3.12/site-packages/cryptography/x509/__init__.py +270 -0
  130. package/python/lib/python3.12/site-packages/cryptography/x509/base.py +848 -0
  131. package/python/lib/python3.12/site-packages/cryptography/x509/certificate_transparency.py +35 -0
  132. package/python/lib/python3.12/site-packages/cryptography/x509/extensions.py +2528 -0
  133. package/python/lib/python3.12/site-packages/cryptography/x509/general_name.py +281 -0
  134. package/python/lib/python3.12/site-packages/cryptography/x509/name.py +477 -0
  135. package/python/lib/python3.12/site-packages/cryptography/x509/ocsp.py +379 -0
  136. package/python/lib/python3.12/site-packages/cryptography/x509/oid.py +37 -0
  137. package/python/lib/python3.12/site-packages/cryptography/x509/verification.py +34 -0
  138. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/INSTALLER +1 -0
  139. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/METADATA +139 -0
  140. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/RECORD +106 -0
  141. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/REQUESTED +0 -0
  142. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/WHEEL +4 -0
  143. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/licenses/LICENSE +3 -0
  144. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/licenses/LICENSE.APACHE +202 -0
  145. package/python/lib/python3.12/site-packages/cryptography-45.0.7.dist-info/licenses/LICENSE.BSD +27 -0
  146. package/python/lib/python3.12/site-packages/pycparser/__init__.py +99 -0
  147. package/python/lib/python3.12/site-packages/pycparser/_ast_gen.py +355 -0
  148. package/python/lib/python3.12/site-packages/pycparser/_c_ast.cfg +195 -0
  149. package/python/lib/python3.12/site-packages/pycparser/ast_transforms.py +174 -0
  150. package/python/lib/python3.12/site-packages/pycparser/c_ast.py +1341 -0
  151. package/python/lib/python3.12/site-packages/pycparser/c_generator.py +573 -0
  152. package/python/lib/python3.12/site-packages/pycparser/c_lexer.py +706 -0
  153. package/python/lib/python3.12/site-packages/pycparser/c_parser.py +2376 -0
  154. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/INSTALLER +1 -0
  155. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/METADATA +244 -0
  156. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/RECORD +14 -0
  157. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/WHEEL +5 -0
  158. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/licenses/LICENSE +27 -0
  159. package/python/lib/python3.12/site-packages/pycparser-3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,379 @@
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
+
5
+ from __future__ import annotations
6
+
7
+ import datetime
8
+ from collections.abc import Iterable
9
+
10
+ from cryptography import utils, x509
11
+ from cryptography.hazmat.bindings._rust import ocsp
12
+ from cryptography.hazmat.primitives import hashes
13
+ from cryptography.hazmat.primitives.asymmetric.types import (
14
+ CertificateIssuerPrivateKeyTypes,
15
+ )
16
+ from cryptography.x509.base import _reject_duplicate_extension
17
+
18
+
19
+ class OCSPResponderEncoding(utils.Enum):
20
+ HASH = "By Hash"
21
+ NAME = "By Name"
22
+
23
+
24
+ class OCSPResponseStatus(utils.Enum):
25
+ SUCCESSFUL = 0
26
+ MALFORMED_REQUEST = 1
27
+ INTERNAL_ERROR = 2
28
+ TRY_LATER = 3
29
+ SIG_REQUIRED = 5
30
+ UNAUTHORIZED = 6
31
+
32
+
33
+ _ALLOWED_HASHES = (
34
+ hashes.SHA1,
35
+ hashes.SHA224,
36
+ hashes.SHA256,
37
+ hashes.SHA384,
38
+ hashes.SHA512,
39
+ )
40
+
41
+
42
+ def _verify_algorithm(algorithm: hashes.HashAlgorithm) -> None:
43
+ if not isinstance(algorithm, _ALLOWED_HASHES):
44
+ raise ValueError(
45
+ "Algorithm must be SHA1, SHA224, SHA256, SHA384, or SHA512"
46
+ )
47
+
48
+
49
+ class OCSPCertStatus(utils.Enum):
50
+ GOOD = 0
51
+ REVOKED = 1
52
+ UNKNOWN = 2
53
+
54
+
55
+ class _SingleResponse:
56
+ def __init__(
57
+ self,
58
+ resp: tuple[x509.Certificate, x509.Certificate] | None,
59
+ resp_hash: tuple[bytes, bytes, int] | None,
60
+ algorithm: hashes.HashAlgorithm,
61
+ cert_status: OCSPCertStatus,
62
+ this_update: datetime.datetime,
63
+ next_update: datetime.datetime | None,
64
+ revocation_time: datetime.datetime | None,
65
+ revocation_reason: x509.ReasonFlags | None,
66
+ ):
67
+ _verify_algorithm(algorithm)
68
+ if not isinstance(this_update, datetime.datetime):
69
+ raise TypeError("this_update must be a datetime object")
70
+ if next_update is not None and not isinstance(
71
+ next_update, datetime.datetime
72
+ ):
73
+ raise TypeError("next_update must be a datetime object or None")
74
+
75
+ self._resp = resp
76
+ self._resp_hash = resp_hash
77
+ self._algorithm = algorithm
78
+ self._this_update = this_update
79
+ self._next_update = next_update
80
+
81
+ if not isinstance(cert_status, OCSPCertStatus):
82
+ raise TypeError(
83
+ "cert_status must be an item from the OCSPCertStatus enum"
84
+ )
85
+ if cert_status is not OCSPCertStatus.REVOKED:
86
+ if revocation_time is not None:
87
+ raise ValueError(
88
+ "revocation_time can only be provided if the certificate "
89
+ "is revoked"
90
+ )
91
+ if revocation_reason is not None:
92
+ raise ValueError(
93
+ "revocation_reason can only be provided if the certificate"
94
+ " is revoked"
95
+ )
96
+ else:
97
+ if not isinstance(revocation_time, datetime.datetime):
98
+ raise TypeError("revocation_time must be a datetime object")
99
+
100
+ if revocation_reason is not None and not isinstance(
101
+ revocation_reason, x509.ReasonFlags
102
+ ):
103
+ raise TypeError(
104
+ "revocation_reason must be an item from the ReasonFlags "
105
+ "enum or None"
106
+ )
107
+
108
+ self._cert_status = cert_status
109
+ self._revocation_time = revocation_time
110
+ self._revocation_reason = revocation_reason
111
+
112
+
113
+ OCSPRequest = ocsp.OCSPRequest
114
+ OCSPResponse = ocsp.OCSPResponse
115
+ OCSPSingleResponse = ocsp.OCSPSingleResponse
116
+
117
+
118
+ class OCSPRequestBuilder:
119
+ def __init__(
120
+ self,
121
+ request: tuple[
122
+ x509.Certificate, x509.Certificate, hashes.HashAlgorithm
123
+ ]
124
+ | None = None,
125
+ request_hash: tuple[bytes, bytes, int, hashes.HashAlgorithm]
126
+ | None = None,
127
+ extensions: list[x509.Extension[x509.ExtensionType]] = [],
128
+ ) -> None:
129
+ self._request = request
130
+ self._request_hash = request_hash
131
+ self._extensions = extensions
132
+
133
+ def add_certificate(
134
+ self,
135
+ cert: x509.Certificate,
136
+ issuer: x509.Certificate,
137
+ algorithm: hashes.HashAlgorithm,
138
+ ) -> OCSPRequestBuilder:
139
+ if self._request is not None or self._request_hash is not None:
140
+ raise ValueError("Only one certificate can be added to a request")
141
+
142
+ _verify_algorithm(algorithm)
143
+ if not isinstance(cert, x509.Certificate) or not isinstance(
144
+ issuer, x509.Certificate
145
+ ):
146
+ raise TypeError("cert and issuer must be a Certificate")
147
+
148
+ return OCSPRequestBuilder(
149
+ (cert, issuer, algorithm), self._request_hash, self._extensions
150
+ )
151
+
152
+ def add_certificate_by_hash(
153
+ self,
154
+ issuer_name_hash: bytes,
155
+ issuer_key_hash: bytes,
156
+ serial_number: int,
157
+ algorithm: hashes.HashAlgorithm,
158
+ ) -> OCSPRequestBuilder:
159
+ if self._request is not None or self._request_hash is not None:
160
+ raise ValueError("Only one certificate can be added to a request")
161
+
162
+ if not isinstance(serial_number, int):
163
+ raise TypeError("serial_number must be an integer")
164
+
165
+ _verify_algorithm(algorithm)
166
+ utils._check_bytes("issuer_name_hash", issuer_name_hash)
167
+ utils._check_bytes("issuer_key_hash", issuer_key_hash)
168
+ if algorithm.digest_size != len(
169
+ issuer_name_hash
170
+ ) or algorithm.digest_size != len(issuer_key_hash):
171
+ raise ValueError(
172
+ "issuer_name_hash and issuer_key_hash must be the same length "
173
+ "as the digest size of the algorithm"
174
+ )
175
+
176
+ return OCSPRequestBuilder(
177
+ self._request,
178
+ (issuer_name_hash, issuer_key_hash, serial_number, algorithm),
179
+ self._extensions,
180
+ )
181
+
182
+ def add_extension(
183
+ self, extval: x509.ExtensionType, critical: bool
184
+ ) -> OCSPRequestBuilder:
185
+ if not isinstance(extval, x509.ExtensionType):
186
+ raise TypeError("extension must be an ExtensionType")
187
+
188
+ extension = x509.Extension(extval.oid, critical, extval)
189
+ _reject_duplicate_extension(extension, self._extensions)
190
+
191
+ return OCSPRequestBuilder(
192
+ self._request, self._request_hash, [*self._extensions, extension]
193
+ )
194
+
195
+ def build(self) -> OCSPRequest:
196
+ if self._request is None and self._request_hash is None:
197
+ raise ValueError("You must add a certificate before building")
198
+
199
+ return ocsp.create_ocsp_request(self)
200
+
201
+
202
+ class OCSPResponseBuilder:
203
+ def __init__(
204
+ self,
205
+ response: _SingleResponse | None = None,
206
+ responder_id: tuple[x509.Certificate, OCSPResponderEncoding]
207
+ | None = None,
208
+ certs: list[x509.Certificate] | None = None,
209
+ extensions: list[x509.Extension[x509.ExtensionType]] = [],
210
+ ):
211
+ self._response = response
212
+ self._responder_id = responder_id
213
+ self._certs = certs
214
+ self._extensions = extensions
215
+
216
+ def add_response(
217
+ self,
218
+ cert: x509.Certificate,
219
+ issuer: x509.Certificate,
220
+ algorithm: hashes.HashAlgorithm,
221
+ cert_status: OCSPCertStatus,
222
+ this_update: datetime.datetime,
223
+ next_update: datetime.datetime | None,
224
+ revocation_time: datetime.datetime | None,
225
+ revocation_reason: x509.ReasonFlags | None,
226
+ ) -> OCSPResponseBuilder:
227
+ if self._response is not None:
228
+ raise ValueError("Only one response per OCSPResponse.")
229
+
230
+ if not isinstance(cert, x509.Certificate) or not isinstance(
231
+ issuer, x509.Certificate
232
+ ):
233
+ raise TypeError("cert and issuer must be a Certificate")
234
+
235
+ singleresp = _SingleResponse(
236
+ (cert, issuer),
237
+ None,
238
+ algorithm,
239
+ cert_status,
240
+ this_update,
241
+ next_update,
242
+ revocation_time,
243
+ revocation_reason,
244
+ )
245
+ return OCSPResponseBuilder(
246
+ singleresp,
247
+ self._responder_id,
248
+ self._certs,
249
+ self._extensions,
250
+ )
251
+
252
+ def add_response_by_hash(
253
+ self,
254
+ issuer_name_hash: bytes,
255
+ issuer_key_hash: bytes,
256
+ serial_number: int,
257
+ algorithm: hashes.HashAlgorithm,
258
+ cert_status: OCSPCertStatus,
259
+ this_update: datetime.datetime,
260
+ next_update: datetime.datetime | None,
261
+ revocation_time: datetime.datetime | None,
262
+ revocation_reason: x509.ReasonFlags | None,
263
+ ) -> OCSPResponseBuilder:
264
+ if self._response is not None:
265
+ raise ValueError("Only one response per OCSPResponse.")
266
+
267
+ if not isinstance(serial_number, int):
268
+ raise TypeError("serial_number must be an integer")
269
+
270
+ utils._check_bytes("issuer_name_hash", issuer_name_hash)
271
+ utils._check_bytes("issuer_key_hash", issuer_key_hash)
272
+ _verify_algorithm(algorithm)
273
+ if algorithm.digest_size != len(
274
+ issuer_name_hash
275
+ ) or algorithm.digest_size != len(issuer_key_hash):
276
+ raise ValueError(
277
+ "issuer_name_hash and issuer_key_hash must be the same length "
278
+ "as the digest size of the algorithm"
279
+ )
280
+
281
+ singleresp = _SingleResponse(
282
+ None,
283
+ (issuer_name_hash, issuer_key_hash, serial_number),
284
+ algorithm,
285
+ cert_status,
286
+ this_update,
287
+ next_update,
288
+ revocation_time,
289
+ revocation_reason,
290
+ )
291
+ return OCSPResponseBuilder(
292
+ singleresp,
293
+ self._responder_id,
294
+ self._certs,
295
+ self._extensions,
296
+ )
297
+
298
+ def responder_id(
299
+ self, encoding: OCSPResponderEncoding, responder_cert: x509.Certificate
300
+ ) -> OCSPResponseBuilder:
301
+ if self._responder_id is not None:
302
+ raise ValueError("responder_id can only be set once")
303
+ if not isinstance(responder_cert, x509.Certificate):
304
+ raise TypeError("responder_cert must be a Certificate")
305
+ if not isinstance(encoding, OCSPResponderEncoding):
306
+ raise TypeError(
307
+ "encoding must be an element from OCSPResponderEncoding"
308
+ )
309
+
310
+ return OCSPResponseBuilder(
311
+ self._response,
312
+ (responder_cert, encoding),
313
+ self._certs,
314
+ self._extensions,
315
+ )
316
+
317
+ def certificates(
318
+ self, certs: Iterable[x509.Certificate]
319
+ ) -> OCSPResponseBuilder:
320
+ if self._certs is not None:
321
+ raise ValueError("certificates may only be set once")
322
+ certs = list(certs)
323
+ if len(certs) == 0:
324
+ raise ValueError("certs must not be an empty list")
325
+ if not all(isinstance(x, x509.Certificate) for x in certs):
326
+ raise TypeError("certs must be a list of Certificates")
327
+ return OCSPResponseBuilder(
328
+ self._response,
329
+ self._responder_id,
330
+ certs,
331
+ self._extensions,
332
+ )
333
+
334
+ def add_extension(
335
+ self, extval: x509.ExtensionType, critical: bool
336
+ ) -> OCSPResponseBuilder:
337
+ if not isinstance(extval, x509.ExtensionType):
338
+ raise TypeError("extension must be an ExtensionType")
339
+
340
+ extension = x509.Extension(extval.oid, critical, extval)
341
+ _reject_duplicate_extension(extension, self._extensions)
342
+
343
+ return OCSPResponseBuilder(
344
+ self._response,
345
+ self._responder_id,
346
+ self._certs,
347
+ [*self._extensions, extension],
348
+ )
349
+
350
+ def sign(
351
+ self,
352
+ private_key: CertificateIssuerPrivateKeyTypes,
353
+ algorithm: hashes.HashAlgorithm | None,
354
+ ) -> OCSPResponse:
355
+ if self._response is None:
356
+ raise ValueError("You must add a response before signing")
357
+ if self._responder_id is None:
358
+ raise ValueError("You must add a responder_id before signing")
359
+
360
+ return ocsp.create_ocsp_response(
361
+ OCSPResponseStatus.SUCCESSFUL, self, private_key, algorithm
362
+ )
363
+
364
+ @classmethod
365
+ def build_unsuccessful(
366
+ cls, response_status: OCSPResponseStatus
367
+ ) -> OCSPResponse:
368
+ if not isinstance(response_status, OCSPResponseStatus):
369
+ raise TypeError(
370
+ "response_status must be an item from OCSPResponseStatus"
371
+ )
372
+ if response_status is OCSPResponseStatus.SUCCESSFUL:
373
+ raise ValueError("response_status cannot be SUCCESSFUL")
374
+
375
+ return ocsp.create_ocsp_response(response_status, None, None, None)
376
+
377
+
378
+ load_der_ocsp_request = ocsp.load_der_ocsp_request
379
+ load_der_ocsp_response = ocsp.load_der_ocsp_response
@@ -0,0 +1,37 @@
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
+
5
+ from __future__ import annotations
6
+
7
+ from cryptography.hazmat._oid import (
8
+ AttributeOID,
9
+ AuthorityInformationAccessOID,
10
+ CertificatePoliciesOID,
11
+ CRLEntryExtensionOID,
12
+ ExtendedKeyUsageOID,
13
+ ExtensionOID,
14
+ NameOID,
15
+ ObjectIdentifier,
16
+ OCSPExtensionOID,
17
+ OtherNameFormOID,
18
+ PublicKeyAlgorithmOID,
19
+ SignatureAlgorithmOID,
20
+ SubjectInformationAccessOID,
21
+ )
22
+
23
+ __all__ = [
24
+ "AttributeOID",
25
+ "AuthorityInformationAccessOID",
26
+ "CRLEntryExtensionOID",
27
+ "CertificatePoliciesOID",
28
+ "ExtendedKeyUsageOID",
29
+ "ExtensionOID",
30
+ "NameOID",
31
+ "OCSPExtensionOID",
32
+ "ObjectIdentifier",
33
+ "OtherNameFormOID",
34
+ "PublicKeyAlgorithmOID",
35
+ "SignatureAlgorithmOID",
36
+ "SubjectInformationAccessOID",
37
+ ]
@@ -0,0 +1,34 @@
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
+
5
+ from __future__ import annotations
6
+
7
+ import typing
8
+
9
+ from cryptography.hazmat.bindings._rust import x509 as rust_x509
10
+ from cryptography.x509.general_name import DNSName, IPAddress
11
+
12
+ __all__ = [
13
+ "ClientVerifier",
14
+ "Criticality",
15
+ "ExtensionPolicy",
16
+ "Policy",
17
+ "PolicyBuilder",
18
+ "ServerVerifier",
19
+ "Store",
20
+ "Subject",
21
+ "VerificationError",
22
+ "VerifiedClient",
23
+ ]
24
+
25
+ Store = rust_x509.Store
26
+ Subject = typing.Union[DNSName, IPAddress]
27
+ VerifiedClient = rust_x509.VerifiedClient
28
+ ClientVerifier = rust_x509.ClientVerifier
29
+ ServerVerifier = rust_x509.ServerVerifier
30
+ PolicyBuilder = rust_x509.PolicyBuilder
31
+ Policy = rust_x509.Policy
32
+ ExtensionPolicy = rust_x509.ExtensionPolicy
33
+ Criticality = rust_x509.Criticality
34
+ VerificationError = rust_x509.VerificationError
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: cryptography
3
+ Version: 45.0.7
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Natural Language :: English
7
+ Classifier: Operating System :: MacOS :: MacOS X
8
+ Classifier: Operating System :: POSIX
9
+ Classifier: Operating System :: POSIX :: BSD
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
24
+ Classifier: Topic :: Security :: Cryptography
25
+ Requires-Dist: cffi>=1.14 ; platform_python_implementation != 'PyPy'
26
+ Requires-Dist: bcrypt>=3.1.5 ; extra == 'ssh'
27
+ Requires-Dist: nox>=2024.4.15 ; extra == 'nox'
28
+ Requires-Dist: nox[uv]>=2024.3.2 ; python_full_version >= '3.8' and extra == 'nox'
29
+ Requires-Dist: cryptography-vectors==45.0.7 ; extra == 'test'
30
+ Requires-Dist: pytest>=7.4.0 ; extra == 'test'
31
+ Requires-Dist: pytest-benchmark>=4.0 ; extra == 'test'
32
+ Requires-Dist: pytest-cov>=2.10.1 ; extra == 'test'
33
+ Requires-Dist: pytest-xdist>=3.5.0 ; extra == 'test'
34
+ Requires-Dist: pretend>=0.7 ; extra == 'test'
35
+ Requires-Dist: certifi>=2024 ; extra == 'test'
36
+ Requires-Dist: pytest-randomly ; extra == 'test-randomorder'
37
+ Requires-Dist: sphinx>=5.3.0 ; extra == 'docs'
38
+ Requires-Dist: sphinx-rtd-theme>=3.0.0 ; python_full_version >= '3.8' and extra == 'docs'
39
+ Requires-Dist: sphinx-inline-tabs ; python_full_version >= '3.8' and extra == 'docs'
40
+ Requires-Dist: pyenchant>=3 ; extra == 'docstest'
41
+ Requires-Dist: readme-renderer>=30.0 ; extra == 'docstest'
42
+ Requires-Dist: sphinxcontrib-spelling>=7.3.1 ; extra == 'docstest'
43
+ Requires-Dist: build>=1.0.0 ; extra == 'sdist'
44
+ Requires-Dist: ruff>=0.3.6 ; extra == 'pep8test'
45
+ Requires-Dist: mypy>=1.4 ; extra == 'pep8test'
46
+ Requires-Dist: check-sdist ; python_full_version >= '3.8' and extra == 'pep8test'
47
+ Requires-Dist: click>=8.0.1 ; extra == 'pep8test'
48
+ Provides-Extra: ssh
49
+ Provides-Extra: nox
50
+ Provides-Extra: test
51
+ Provides-Extra: test-randomorder
52
+ Provides-Extra: docs
53
+ Provides-Extra: docstest
54
+ Provides-Extra: sdist
55
+ Provides-Extra: pep8test
56
+ License-File: LICENSE
57
+ License-File: LICENSE.APACHE
58
+ License-File: LICENSE.BSD
59
+ Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
60
+ Author: The cryptography developers <cryptography-dev@python.org>
61
+ Author-email: The Python Cryptographic Authority and individual contributors <cryptography-dev@python.org>
62
+ License: Apache-2.0 OR BSD-3-Clause
63
+ Requires-Python: >=3.7, !=3.9.0, !=3.9.1
64
+ Description-Content-Type: text/x-rst; charset=UTF-8
65
+ Project-URL: homepage, https://github.com/pyca/cryptography
66
+ Project-URL: documentation, https://cryptography.io/
67
+ Project-URL: source, https://github.com/pyca/cryptography/
68
+ Project-URL: issues, https://github.com/pyca/cryptography/issues
69
+ Project-URL: changelog, https://cryptography.io/en/latest/changelog/
70
+
71
+ pyca/cryptography
72
+ =================
73
+
74
+ .. image:: https://img.shields.io/pypi/v/cryptography.svg
75
+ :target: https://pypi.org/project/cryptography/
76
+ :alt: Latest Version
77
+
78
+ .. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest
79
+ :target: https://cryptography.io
80
+ :alt: Latest Docs
81
+
82
+ .. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main
83
+ :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain
84
+
85
+
86
+ ``cryptography`` is a package which provides cryptographic recipes and
87
+ primitives to Python developers. Our goal is for it to be your "cryptographic
88
+ standard library". It supports Python 3.7+ and PyPy3 7.3.11+.
89
+
90
+ ``cryptography`` includes both high level recipes and low level interfaces to
91
+ common cryptographic algorithms such as symmetric ciphers, message digests, and
92
+ key derivation functions. For example, to encrypt something with
93
+ ``cryptography``'s high level symmetric encryption recipe:
94
+
95
+ .. code-block:: pycon
96
+
97
+ >>> from cryptography.fernet import Fernet
98
+ >>> # Put this somewhere safe!
99
+ >>> key = Fernet.generate_key()
100
+ >>> f = Fernet(key)
101
+ >>> token = f.encrypt(b"A really secret message. Not for prying eyes.")
102
+ >>> token
103
+ b'...'
104
+ >>> f.decrypt(token)
105
+ b'A really secret message. Not for prying eyes.'
106
+
107
+ You can find more information in the `documentation`_.
108
+
109
+ You can install ``cryptography`` with:
110
+
111
+ .. code-block:: console
112
+
113
+ $ pip install cryptography
114
+
115
+ For full details see `the installation documentation`_.
116
+
117
+ Discussion
118
+ ~~~~~~~~~~
119
+
120
+ If you run into bugs, you can file them in our `issue tracker`_.
121
+
122
+ We maintain a `cryptography-dev`_ mailing list for development discussion.
123
+
124
+ You can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get
125
+ involved.
126
+
127
+ Security
128
+ ~~~~~~~~
129
+
130
+ Need to report a security issue? Please consult our `security reporting`_
131
+ documentation.
132
+
133
+
134
+ .. _`documentation`: https://cryptography.io/
135
+ .. _`the installation documentation`: https://cryptography.io/en/latest/installation/
136
+ .. _`issue tracker`: https://github.com/pyca/cryptography/issues
137
+ .. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev
138
+ .. _`security reporting`: https://cryptography.io/en/latest/security/
139
+