pyasn1-alt-modules 0.4.5__py3-none-any.whl

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.

Potentially problematic release.


This version of pyasn1-alt-modules might be problematic. Click here for more details.

Files changed (195) hide show
  1. pyasn1_alt_modules/__init__.py +2 -0
  2. pyasn1_alt_modules/opentypemap.py +19 -0
  3. pyasn1_alt_modules/pem.py +66 -0
  4. pyasn1_alt_modules/rfc1155.py +97 -0
  5. pyasn1_alt_modules/rfc1157.py +127 -0
  6. pyasn1_alt_modules/rfc1901.py +23 -0
  7. pyasn1_alt_modules/rfc1902.py +130 -0
  8. pyasn1_alt_modules/rfc1905.py +136 -0
  9. pyasn1_alt_modules/rfc2040.py +50 -0
  10. pyasn1_alt_modules/rfc2251.py +564 -0
  11. pyasn1_alt_modules/rfc2314.py +68 -0
  12. pyasn1_alt_modules/rfc2315.py +325 -0
  13. pyasn1_alt_modules/rfc2437.py +70 -0
  14. pyasn1_alt_modules/rfc2459.py +1340 -0
  15. pyasn1_alt_modules/rfc2511.py +303 -0
  16. pyasn1_alt_modules/rfc2528.py +34 -0
  17. pyasn1_alt_modules/rfc2560.py +226 -0
  18. pyasn1_alt_modules/rfc2631.py +37 -0
  19. pyasn1_alt_modules/rfc2634.py +342 -0
  20. pyasn1_alt_modules/rfc2743.py +60 -0
  21. pyasn1_alt_modules/rfc2876.py +61 -0
  22. pyasn1_alt_modules/rfc2898.py +72 -0
  23. pyasn1_alt_modules/rfc2985.py +593 -0
  24. pyasn1_alt_modules/rfc2986.py +76 -0
  25. pyasn1_alt_modules/rfc3058.py +48 -0
  26. pyasn1_alt_modules/rfc3114.py +80 -0
  27. pyasn1_alt_modules/rfc3125.py +469 -0
  28. pyasn1_alt_modules/rfc3161.py +142 -0
  29. pyasn1_alt_modules/rfc3217.py +42 -0
  30. pyasn1_alt_modules/rfc3274.py +62 -0
  31. pyasn1_alt_modules/rfc3279.py +264 -0
  32. pyasn1_alt_modules/rfc3280.py +1544 -0
  33. pyasn1_alt_modules/rfc3281.py +332 -0
  34. pyasn1_alt_modules/rfc3370.py +142 -0
  35. pyasn1_alt_modules/rfc3412.py +54 -0
  36. pyasn1_alt_modules/rfc3414.py +29 -0
  37. pyasn1_alt_modules/rfc3447.py +46 -0
  38. pyasn1_alt_modules/rfc3537.py +44 -0
  39. pyasn1_alt_modules/rfc3546.py +23 -0
  40. pyasn1_alt_modules/rfc3560.py +74 -0
  41. pyasn1_alt_modules/rfc3565.py +59 -0
  42. pyasn1_alt_modules/rfc3657.py +69 -0
  43. pyasn1_alt_modules/rfc3709.py +230 -0
  44. pyasn1_alt_modules/rfc3739.py +207 -0
  45. pyasn1_alt_modules/rfc3770.py +77 -0
  46. pyasn1_alt_modules/rfc3779.py +139 -0
  47. pyasn1_alt_modules/rfc3820.py +66 -0
  48. pyasn1_alt_modules/rfc3852.py +707 -0
  49. pyasn1_alt_modules/rfc3874.py +29 -0
  50. pyasn1_alt_modules/rfc4010.py +58 -0
  51. pyasn1_alt_modules/rfc4043.py +45 -0
  52. pyasn1_alt_modules/rfc4055.py +285 -0
  53. pyasn1_alt_modules/rfc4056.py +56 -0
  54. pyasn1_alt_modules/rfc4059.py +101 -0
  55. pyasn1_alt_modules/rfc4073.py +62 -0
  56. pyasn1_alt_modules/rfc4108.py +355 -0
  57. pyasn1_alt_modules/rfc4210.py +807 -0
  58. pyasn1_alt_modules/rfc4211.py +420 -0
  59. pyasn1_alt_modules/rfc4231.py +38 -0
  60. pyasn1_alt_modules/rfc4262.py +37 -0
  61. pyasn1_alt_modules/rfc4334.py +78 -0
  62. pyasn1_alt_modules/rfc4357.py +485 -0
  63. pyasn1_alt_modules/rfc4366.py +23 -0
  64. pyasn1_alt_modules/rfc4387.py +23 -0
  65. pyasn1_alt_modules/rfc4476.py +99 -0
  66. pyasn1_alt_modules/rfc4490.py +119 -0
  67. pyasn1_alt_modules/rfc4491.py +44 -0
  68. pyasn1_alt_modules/rfc4683.py +76 -0
  69. pyasn1_alt_modules/rfc4985.py +52 -0
  70. pyasn1_alt_modules/rfc4998.py +125 -0
  71. pyasn1_alt_modules/rfc5035.py +206 -0
  72. pyasn1_alt_modules/rfc5055.py +763 -0
  73. pyasn1_alt_modules/rfc5083.py +55 -0
  74. pyasn1_alt_modules/rfc5084.py +94 -0
  75. pyasn1_alt_modules/rfc5126.py +578 -0
  76. pyasn1_alt_modules/rfc5208.py +73 -0
  77. pyasn1_alt_modules/rfc5275.py +404 -0
  78. pyasn1_alt_modules/rfc5276.py +82 -0
  79. pyasn1_alt_modules/rfc5280.py +1666 -0
  80. pyasn1_alt_modules/rfc5480.py +190 -0
  81. pyasn1_alt_modules/rfc5544.py +127 -0
  82. pyasn1_alt_modules/rfc5636.py +117 -0
  83. pyasn1_alt_modules/rfc5639.py +49 -0
  84. pyasn1_alt_modules/rfc5649.py +33 -0
  85. pyasn1_alt_modules/rfc5652.py +763 -0
  86. pyasn1_alt_modules/rfc5697.py +64 -0
  87. pyasn1_alt_modules/rfc5698.py +159 -0
  88. pyasn1_alt_modules/rfc5751.py +127 -0
  89. pyasn1_alt_modules/rfc5752.py +52 -0
  90. pyasn1_alt_modules/rfc5753.py +163 -0
  91. pyasn1_alt_modules/rfc5755.py +400 -0
  92. pyasn1_alt_modules/rfc5913.py +46 -0
  93. pyasn1_alt_modules/rfc5914.py +119 -0
  94. pyasn1_alt_modules/rfc5915.py +32 -0
  95. pyasn1_alt_modules/rfc5916.py +39 -0
  96. pyasn1_alt_modules/rfc5917.py +59 -0
  97. pyasn1_alt_modules/rfc5924.py +19 -0
  98. pyasn1_alt_modules/rfc5934.py +786 -0
  99. pyasn1_alt_modules/rfc5940.py +62 -0
  100. pyasn1_alt_modules/rfc5958.py +100 -0
  101. pyasn1_alt_modules/rfc5990.py +238 -0
  102. pyasn1_alt_modules/rfc6010.py +92 -0
  103. pyasn1_alt_modules/rfc6019.py +46 -0
  104. pyasn1_alt_modules/rfc6031.py +469 -0
  105. pyasn1_alt_modules/rfc6032.py +71 -0
  106. pyasn1_alt_modules/rfc6066.py +25 -0
  107. pyasn1_alt_modules/rfc6120.py +46 -0
  108. pyasn1_alt_modules/rfc6170.py +17 -0
  109. pyasn1_alt_modules/rfc6187.py +22 -0
  110. pyasn1_alt_modules/rfc6210.py +45 -0
  111. pyasn1_alt_modules/rfc6211.py +75 -0
  112. pyasn1_alt_modules/rfc6402.py +643 -0
  113. pyasn1_alt_modules/rfc6482.py +77 -0
  114. pyasn1_alt_modules/rfc6484.py +17 -0
  115. pyasn1_alt_modules/rfc6486.py +70 -0
  116. pyasn1_alt_modules/rfc6487.py +22 -0
  117. pyasn1_alt_modules/rfc6492.py +41 -0
  118. pyasn1_alt_modules/rfc6493.py +24 -0
  119. pyasn1_alt_modules/rfc6494.py +23 -0
  120. pyasn1_alt_modules/rfc6664.py +151 -0
  121. pyasn1_alt_modules/rfc6955.py +112 -0
  122. pyasn1_alt_modules/rfc6960.py +234 -0
  123. pyasn1_alt_modules/rfc6962.py +52 -0
  124. pyasn1_alt_modules/rfc7030.py +70 -0
  125. pyasn1_alt_modules/rfc7191.py +267 -0
  126. pyasn1_alt_modules/rfc7229.py +29 -0
  127. pyasn1_alt_modules/rfc7292.py +359 -0
  128. pyasn1_alt_modules/rfc7296.py +32 -0
  129. pyasn1_alt_modules/rfc7508.py +92 -0
  130. pyasn1_alt_modules/rfc7585.py +53 -0
  131. pyasn1_alt_modules/rfc7633.py +40 -0
  132. pyasn1_alt_modules/rfc7693.py +66 -0
  133. pyasn1_alt_modules/rfc7773.py +54 -0
  134. pyasn1_alt_modules/rfc7836.py +65 -0
  135. pyasn1_alt_modules/rfc7894.py +100 -0
  136. pyasn1_alt_modules/rfc7906.py +739 -0
  137. pyasn1_alt_modules/rfc7914.py +55 -0
  138. pyasn1_alt_modules/rfc8017.py +159 -0
  139. pyasn1_alt_modules/rfc8018.py +269 -0
  140. pyasn1_alt_modules/rfc8103.py +36 -0
  141. pyasn1_alt_modules/rfc8209.py +20 -0
  142. pyasn1_alt_modules/rfc8226.py +151 -0
  143. pyasn1_alt_modules/rfc8358.py +54 -0
  144. pyasn1_alt_modules/rfc8360.py +46 -0
  145. pyasn1_alt_modules/rfc8398.py +55 -0
  146. pyasn1_alt_modules/rfc8410.py +43 -0
  147. pyasn1_alt_modules/rfc8418.py +36 -0
  148. pyasn1_alt_modules/rfc8419.py +70 -0
  149. pyasn1_alt_modules/rfc8479.py +48 -0
  150. pyasn1_alt_modules/rfc8494.py +80 -0
  151. pyasn1_alt_modules/rfc8520.py +66 -0
  152. pyasn1_alt_modules/rfc8619.py +45 -0
  153. pyasn1_alt_modules/rfc8649.py +42 -0
  154. pyasn1_alt_modules/rfc8692.py +79 -0
  155. pyasn1_alt_modules/rfc8696.py +108 -0
  156. pyasn1_alt_modules/rfc8702.py +109 -0
  157. pyasn1_alt_modules/rfc8708.py +43 -0
  158. pyasn1_alt_modules/rfc8737.py +36 -0
  159. pyasn1_alt_modules/rfc8769.py +21 -0
  160. pyasn1_alt_modules/rfc8894.py +52 -0
  161. pyasn1_alt_modules/rfc8951.py +42 -0
  162. pyasn1_alt_modules/rfc8954.py +238 -0
  163. pyasn1_alt_modules/rfc8994.py +52 -0
  164. pyasn1_alt_modules/rfc8995.py +39 -0
  165. pyasn1_alt_modules/rfc9044.py +80 -0
  166. pyasn1_alt_modules/rfc9092.py +35 -0
  167. pyasn1_alt_modules/rfc9118.py +82 -0
  168. pyasn1_alt_modules/rfc9174.py +55 -0
  169. pyasn1_alt_modules/rfc9189.py +74 -0
  170. pyasn1_alt_modules/rfc9215.py +228 -0
  171. pyasn1_alt_modules/rfc9286.py +78 -0
  172. pyasn1_alt_modules/rfc9289.py +22 -0
  173. pyasn1_alt_modules/rfc9310.py +46 -0
  174. pyasn1_alt_modules/rfc9323.py +129 -0
  175. pyasn1_alt_modules/rfc9336.py +20 -0
  176. pyasn1_alt_modules/rfc9337.py +74 -0
  177. pyasn1_alt_modules/rfc9345.py +36 -0
  178. pyasn1_alt_modules/rfc9385.py +22 -0
  179. pyasn1_alt_modules/rfc9399.py +59 -0
  180. pyasn1_alt_modules/rfc9480.py +731 -0
  181. pyasn1_alt_modules/rfc9481.py +224 -0
  182. pyasn1_alt_modules/rfc9509.py +24 -0
  183. pyasn1_alt_modules/rfc9548.py +23 -0
  184. pyasn1_alt_modules/rfc9579.py +89 -0
  185. pyasn1_alt_modules/rfc9582.py +107 -0
  186. pyasn1_alt_modules/rfc9598.py +52 -0
  187. pyasn1_alt_modules/rfc9608.py +35 -0
  188. pyasn1_alt_modules/rfc9629.py +100 -0
  189. pyasn1_alt_modules/rfc9654.py +241 -0
  190. pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
  191. pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
  192. pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
  193. pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
  194. pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
  195. pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
@@ -0,0 +1,234 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Online Certificate Status Protocol (OCSP)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc6960.txt
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+ from pyasn1.type import useful
21
+
22
+ from pyasn1_alt_modules import rfc2560
23
+ from pyasn1_alt_modules import rfc5280
24
+ from pyasn1_alt_modules import opentypemap
25
+
26
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
27
+
28
+ ocspResponseMap = opentypemap.get('ocspResponseMap')
29
+
30
+ MAX = float('inf')
31
+
32
+
33
+ # Imports from RFC 5280
34
+
35
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
36
+ AuthorityInfoAccessSyntax = rfc5280.AuthorityInfoAccessSyntax
37
+ Certificate = rfc5280.Certificate
38
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
39
+ CRLReason = rfc5280.CRLReason
40
+ Extensions = rfc5280.Extensions
41
+ GeneralName = rfc5280.GeneralName
42
+ Name = rfc5280.Name
43
+
44
+ id_kp = rfc5280.id_kp
45
+
46
+ id_ad_ocsp = rfc5280.id_ad_ocsp
47
+
48
+
49
+ # Imports from the original OCSP module in RFC 2560
50
+
51
+ AcceptableResponses = rfc2560.AcceptableResponses
52
+ ArchiveCutoff = rfc2560.ArchiveCutoff
53
+ CertStatus = rfc2560.CertStatus
54
+ KeyHash = rfc2560.KeyHash
55
+ OCSPResponse = rfc2560.OCSPResponse
56
+ OCSPResponseStatus = rfc2560.OCSPResponseStatus
57
+ ResponseBytes = rfc2560.ResponseBytes
58
+ RevokedInfo = rfc2560.RevokedInfo
59
+ UnknownInfo = rfc2560.UnknownInfo
60
+ Version = rfc2560.Version
61
+
62
+ id_kp_OCSPSigning = rfc2560.id_kp_OCSPSigning
63
+
64
+ id_pkix_ocsp = rfc2560.id_pkix_ocsp
65
+ id_pkix_ocsp_archive_cutoff = rfc2560.id_pkix_ocsp_archive_cutoff
66
+ id_pkix_ocsp_basic = rfc2560.id_pkix_ocsp_basic
67
+ id_pkix_ocsp_crl = rfc2560.id_pkix_ocsp_crl
68
+ id_pkix_ocsp_nocheck = rfc2560.id_pkix_ocsp_nocheck
69
+ id_pkix_ocsp_nonce = rfc2560.id_pkix_ocsp_nonce
70
+ id_pkix_ocsp_response = rfc2560.id_pkix_ocsp_response
71
+ id_pkix_ocsp_service_locator = rfc2560.id_pkix_ocsp_service_locator
72
+
73
+
74
+ # Additional object identifiers
75
+
76
+ id_pkix_ocsp_pref_sig_algs = id_pkix_ocsp + (8, )
77
+ id_pkix_ocsp_extended_revoke = id_pkix_ocsp + (9, )
78
+
79
+
80
+ # Updated structures (mostly to improve openTypes support)
81
+
82
+ class CertID(univ.Sequence):
83
+ componentType = namedtype.NamedTypes(
84
+ namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
85
+ namedtype.NamedType('issuerNameHash', univ.OctetString()),
86
+ namedtype.NamedType('issuerKeyHash', univ.OctetString()),
87
+ namedtype.NamedType('serialNumber', CertificateSerialNumber())
88
+ )
89
+
90
+
91
+ class SingleResponse(univ.Sequence):
92
+ componentType = namedtype.NamedTypes(
93
+ namedtype.NamedType('certID', CertID()),
94
+ namedtype.NamedType('certStatus', CertStatus()),
95
+ namedtype.NamedType('thisUpdate', useful.GeneralizedTime()),
96
+ namedtype.OptionalNamedType('nextUpdate', useful.GeneralizedTime().subtype(
97
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
98
+ namedtype.OptionalNamedType('singleExtensions', Extensions().subtype(
99
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
100
+ )
101
+
102
+
103
+ class ResponderID(univ.Choice):
104
+ componentType = namedtype.NamedTypes(
105
+ namedtype.NamedType('byName', Name().subtype(
106
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
107
+ namedtype.NamedType('byKey', KeyHash().subtype(
108
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
109
+ )
110
+
111
+
112
+ class ResponseData(univ.Sequence):
113
+ componentType = namedtype.NamedTypes(
114
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
115
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
116
+ namedtype.NamedType('responderID', ResponderID()),
117
+ namedtype.NamedType('producedAt', useful.GeneralizedTime()),
118
+ namedtype.NamedType('responses', univ.SequenceOf(
119
+ componentType=SingleResponse())),
120
+ namedtype.OptionalNamedType('responseExtensions', Extensions().subtype(
121
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
122
+ )
123
+
124
+
125
+ class BasicOCSPResponse(univ.Sequence):
126
+ componentType = namedtype.NamedTypes(
127
+ namedtype.NamedType('tbsResponseData', ResponseData()),
128
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
129
+ namedtype.NamedType('signature', univ.BitString()),
130
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(
131
+ componentType=Certificate()).subtype(explicitTag=tag.Tag(
132
+ tag.tagClassContext, tag.tagFormatSimple, 0)))
133
+ )
134
+
135
+
136
+ class Request(univ.Sequence):
137
+ componentType = namedtype.NamedTypes(
138
+ namedtype.NamedType('reqCert', CertID()),
139
+ namedtype.OptionalNamedType('singleRequestExtensions', Extensions().subtype(
140
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
141
+ )
142
+
143
+
144
+ class Signature(univ.Sequence):
145
+ componentType = namedtype.NamedTypes(
146
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
147
+ namedtype.NamedType('signature', univ.BitString()),
148
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(
149
+ componentType=Certificate()).subtype(explicitTag=tag.Tag(
150
+ tag.tagClassContext, tag.tagFormatSimple, 0)))
151
+ )
152
+
153
+
154
+ class TBSRequest(univ.Sequence):
155
+ componentType = namedtype.NamedTypes(
156
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
157
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
158
+ namedtype.OptionalNamedType('requestorName', GeneralName().subtype(
159
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
160
+ namedtype.NamedType('requestList', univ.SequenceOf(
161
+ componentType=Request())),
162
+ namedtype.OptionalNamedType('requestExtensions', Extensions().subtype(
163
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
164
+ )
165
+
166
+
167
+ class OCSPRequest(univ.Sequence):
168
+ componentType = namedtype.NamedTypes(
169
+ namedtype.NamedType('tbsRequest', TBSRequest()),
170
+ namedtype.OptionalNamedType('optionalSignature', Signature().subtype(
171
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
172
+ )
173
+
174
+
175
+ # Previously omitted structure
176
+
177
+ class ServiceLocator(univ.Sequence):
178
+ componentType = namedtype.NamedTypes(
179
+ namedtype.NamedType('issuer', Name()),
180
+ namedtype.NamedType('locator', AuthorityInfoAccessSyntax())
181
+ )
182
+
183
+
184
+ # Additional structures
185
+
186
+ class CrlID(univ.Sequence):
187
+ componentType = namedtype.NamedTypes(
188
+ namedtype.OptionalNamedType('crlUrl', char.IA5String().subtype(
189
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
190
+ namedtype.OptionalNamedType('crlNum', univ.Integer().subtype(
191
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
192
+ namedtype.OptionalNamedType('crlTime', useful.GeneralizedTime().subtype(
193
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
194
+ )
195
+
196
+
197
+ class PreferredSignatureAlgorithm(univ.Sequence):
198
+ componentType = namedtype.NamedTypes(
199
+ namedtype.NamedType('sigIdentifier', AlgorithmIdentifier()),
200
+ namedtype.OptionalNamedType('certIdentifier', AlgorithmIdentifier())
201
+ )
202
+
203
+
204
+ class PreferredSignatureAlgorithms(univ.SequenceOf):
205
+ componentType = PreferredSignatureAlgorithm()
206
+
207
+
208
+
209
+ # Update the OCSP Response Map
210
+
211
+ _ocspResponseMapUpdate = {
212
+ id_pkix_ocsp_basic: BasicOCSPResponse(),
213
+ }
214
+
215
+ ocspResponseMap.update(_ocspResponseMapUpdate)
216
+
217
+
218
+ # Update the Certificate Extension Extensions Map
219
+
220
+ _certificateExtensionsMapUpdate = {
221
+ # Certificate Extension
222
+ id_pkix_ocsp_nocheck: univ.Null(""),
223
+ # OCSP Request Extensions
224
+ id_pkix_ocsp_nonce: univ.OctetString(),
225
+ id_pkix_ocsp_response: AcceptableResponses(),
226
+ id_pkix_ocsp_service_locator: ServiceLocator(),
227
+ id_pkix_ocsp_pref_sig_algs: PreferredSignatureAlgorithms(),
228
+ # OCSP Response Extensions
229
+ id_pkix_ocsp_crl: CrlID(),
230
+ id_pkix_ocsp_archive_cutoff: ArchiveCutoff(),
231
+ id_pkix_ocsp_extended_revoke: univ.Null(""),
232
+ }
233
+
234
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
@@ -0,0 +1,52 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2021-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Certificate Transparency
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc6962.txt
14
+ #
15
+
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_alt_modules import opentypemap
19
+
20
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
21
+
22
+
23
+ class SignedCertificateTimestampList(univ.OctetString):
24
+ pass
25
+
26
+
27
+ id_ce_embeddedSCT = univ.ObjectIdentifier('1.3.6.1.4.1.11129.2.4.2')
28
+
29
+
30
+ id_ce_criticalPoison = univ.ObjectIdentifier('1.3.6.1.4.1.11129.2.4.3')
31
+
32
+
33
+ id_kp_precertificateSigning = univ.ObjectIdentifier('1.3.6.1.4.1.11129.2.4.4')
34
+
35
+
36
+ id_pkix_ocsp_SCT = univ.ObjectIdentifier('1.3.6.1.4.1.11129.2.4.5')
37
+
38
+
39
+ # Update the Certificate Extension Map
40
+ #
41
+ # Note that rfc6960.py also uses this same map for OCSP extensions.
42
+ # The id_ce_criticalPoison OID is not automatically added to the map
43
+ # because normal relying parties are supposed to reject certificates
44
+ # that contain it.
45
+
46
+ _certificateExtensionsMapUpdate = {
47
+ id_ce_embeddedSCT: SignedCertificateTimestampList(),
48
+ # id_ce_criticalPoison: univ.Null(""),
49
+ id_pkix_ocsp_SCT: SignedCertificateTimestampList(),
50
+ }
51
+
52
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
@@ -0,0 +1,70 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Enrollment over Secure Transport (EST)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc7030.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_alt_modules import rfc5652
21
+ from pyasn1_alt_modules import opentypemap
22
+
23
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
24
+
25
+ MAX = float('inf')
26
+
27
+
28
+ # Imports from RFC 5652
29
+
30
+ Attribute = rfc5652.Attribute
31
+
32
+
33
+ # Asymmetric Decrypt Key Identifier Attribute
34
+
35
+ id_aa_asymmDecryptKeyID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.54')
36
+
37
+ class AsymmetricDecryptKeyIdentifier(univ.OctetString):
38
+ pass
39
+
40
+
41
+ aa_asymmDecryptKeyID = Attribute()
42
+ aa_asymmDecryptKeyID['attrType'] = id_aa_asymmDecryptKeyID
43
+ aa_asymmDecryptKeyID['attrValues'][0] = AsymmetricDecryptKeyIdentifier()
44
+
45
+
46
+ # CSR Attributes
47
+
48
+ class AttrOrOID(univ.Choice):
49
+ pass
50
+
51
+ AttrOrOID.componentType = namedtype.NamedTypes(
52
+ namedtype.NamedType('oid', univ.ObjectIdentifier()),
53
+ namedtype.NamedType('attribute', Attribute())
54
+ )
55
+
56
+
57
+ class CsrAttrs(univ.SequenceOf):
58
+ pass
59
+
60
+ CsrAttrs.componentType = AttrOrOID()
61
+ CsrAttrs.subtypeSpec=constraint.ValueSizeConstraint(0, MAX)
62
+
63
+
64
+ # Update CMS Attribute Map
65
+
66
+ _cmsAttributesMapUpdate = {
67
+ id_aa_asymmDecryptKeyID: AsymmetricDecryptKeyIdentifier(),
68
+ }
69
+
70
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)
@@ -0,0 +1,267 @@
1
+ # This file is being contributed to of pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley without assistance from the asn1ate tool.
4
+ # Modified by Russ Housley to add support for opentypes.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # CMS Key Package Receipt and Error Content Types
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc7191.txt
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import namedval
18
+ from pyasn1.type import opentype
19
+ from pyasn1.type import tag
20
+ from pyasn1.type import univ
21
+
22
+ from pyasn1_alt_modules import rfc5280
23
+ from pyasn1_alt_modules import opentypemap
24
+
25
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
26
+
27
+ cmsContentTypesMap = opentypemap.get('cmsContentTypesMap')
28
+
29
+ MAX = float('inf')
30
+
31
+
32
+ # Import from RFC 5280
33
+
34
+ DistinguishedName = rfc5280.DistinguishedName
35
+
36
+
37
+ # SingleAttribute is the same as Attribute in RFC 5652, except that the
38
+ # attrValues SET must have one and only one member
39
+
40
+ class AttributeValue(univ.Any):
41
+ pass
42
+
43
+
44
+ class AttributeValues(univ.SetOf):
45
+ pass
46
+
47
+ AttributeValues.componentType = AttributeValue()
48
+ AttributeValues.sizeSpec = univ.Set.sizeSpec + constraint.ValueSizeConstraint(1, 1)
49
+
50
+
51
+ class SingleAttribute(univ.Sequence):
52
+ pass
53
+
54
+ SingleAttribute.componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('attrType', univ.ObjectIdentifier()),
56
+ namedtype.NamedType('attrValues', AttributeValues(),
57
+ openType=opentype.OpenType('attrType', cmsAttributesMap)
58
+ )
59
+ )
60
+
61
+
62
+ # SIR Entity Name
63
+
64
+ class SIREntityNameType(univ.ObjectIdentifier):
65
+ pass
66
+
67
+
68
+ class SIREntityNameValue(univ.Any):
69
+ pass
70
+
71
+
72
+ class SIREntityName(univ.Sequence):
73
+ pass
74
+
75
+ SIREntityName.componentType = namedtype.NamedTypes(
76
+ namedtype.NamedType('sirenType', SIREntityNameType()),
77
+ namedtype.NamedType('sirenValue', univ.OctetString())
78
+ # CONTAINING the DER-encoded SIREntityNameValue
79
+ )
80
+
81
+
82
+ class SIREntityNames(univ.SequenceOf):
83
+ pass
84
+
85
+ SIREntityNames.componentType = SIREntityName()
86
+ SIREntityNames.sizeSpec=constraint.ValueSizeConstraint(1, MAX)
87
+
88
+
89
+ id_dn = univ.ObjectIdentifier('2.16.840.1.101.2.1.16.0')
90
+
91
+
92
+ class siren_dn(SIREntityName):
93
+ def __init__(self):
94
+ SIREntityName.__init__(self)
95
+ self['sirenType'] = id_dn
96
+
97
+
98
+ # Key Package Error CMS Content Type
99
+
100
+ class EnumeratedErrorCode(univ.Enumerated):
101
+ pass
102
+
103
+ # Error codes with values <= 33 are aligned with RFC 5934
104
+ EnumeratedErrorCode.namedValues = namedval.NamedValues(
105
+ ('decodeFailure', 1),
106
+ ('badContentInfo', 2),
107
+ ('badSignedData', 3),
108
+ ('badEncapContent', 4),
109
+ ('badCertificate', 5),
110
+ ('badSignerInfo', 6),
111
+ ('badSignedAttrs', 7),
112
+ ('badUnsignedAttrs', 8),
113
+ ('missingContent', 9),
114
+ ('noTrustAnchor', 10),
115
+ ('notAuthorized', 11),
116
+ ('badDigestAlgorithm', 12),
117
+ ('badSignatureAlgorithm', 13),
118
+ ('unsupportedKeySize', 14),
119
+ ('unsupportedParameters', 15),
120
+ ('signatureFailure', 16),
121
+ ('insufficientMemory', 17),
122
+ ('incorrectTarget', 23),
123
+ ('missingSignature', 29),
124
+ ('resourcesBusy', 30),
125
+ ('versionNumberMismatch', 31),
126
+ ('revokedCertificate', 33),
127
+ ('ambiguousDecrypt', 60),
128
+ ('noDecryptKey', 61),
129
+ ('badEncryptedData', 62),
130
+ ('badEnvelopedData', 63),
131
+ ('badAuthenticatedData', 64),
132
+ ('badAuthEnvelopedData', 65),
133
+ ('badKeyAgreeRecipientInfo', 66),
134
+ ('badKEKRecipientInfo', 67),
135
+ ('badEncryptContent', 68),
136
+ ('badEncryptAlgorithm', 69),
137
+ ('missingCiphertext', 70),
138
+ ('decryptFailure', 71),
139
+ ('badMACAlgorithm', 72),
140
+ ('badAuthAttrs', 73),
141
+ ('badUnauthAttrs', 74),
142
+ ('invalidMAC', 75),
143
+ ('mismatchedDigestAlg', 76),
144
+ ('missingCertificate', 77),
145
+ ('tooManySigners', 78),
146
+ ('missingSignedAttributes', 79),
147
+ ('derEncodingNotUsed', 80),
148
+ ('missingContentHints', 81),
149
+ ('invalidAttributeLocation', 82),
150
+ ('badMessageDigest', 83),
151
+ ('badKeyPackage', 84),
152
+ ('badAttributes', 85),
153
+ ('attributeComparisonFailure', 86),
154
+ ('unsupportedSymmetricKeyPackage', 87),
155
+ ('unsupportedAsymmetricKeyPackage', 88),
156
+ ('constraintViolation', 89),
157
+ ('ambiguousDefaultValue', 90),
158
+ ('noMatchingRecipientInfo', 91),
159
+ ('unsupportedKeyWrapAlgorithm', 92),
160
+ ('badKeyTransRecipientInfo', 93),
161
+ ('other', 127)
162
+ )
163
+
164
+
165
+ class ErrorCodeChoice(univ.Choice):
166
+ pass
167
+
168
+ ErrorCodeChoice.componentType = namedtype.NamedTypes(
169
+ namedtype.NamedType('enum', EnumeratedErrorCode()),
170
+ namedtype.NamedType('oid', univ.ObjectIdentifier())
171
+ )
172
+
173
+
174
+ class KeyPkgID(univ.OctetString):
175
+ pass
176
+
177
+
178
+ class KeyPkgIdentifier(univ.Choice):
179
+ pass
180
+
181
+ KeyPkgIdentifier.componentType = namedtype.NamedTypes(
182
+ namedtype.NamedType('pkgID', KeyPkgID()),
183
+ namedtype.NamedType('attribute', SingleAttribute())
184
+ )
185
+
186
+
187
+ class KeyPkgVersion(univ.Integer):
188
+ pass
189
+
190
+
191
+ KeyPkgVersion.namedValues = namedval.NamedValues(
192
+ ('v1', 1),
193
+ ('v2', 2)
194
+ )
195
+
196
+ KeyPkgVersion.subtypeSpec = constraint.ValueRangeConstraint(1, 65535)
197
+
198
+
199
+ id_ct_KP_keyPackageError = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.6')
200
+
201
+ class KeyPackageError(univ.Sequence):
202
+ pass
203
+
204
+ KeyPackageError.componentType = namedtype.NamedTypes(
205
+ namedtype.DefaultedNamedType('version', KeyPkgVersion().subtype(value='v2')),
206
+ namedtype.OptionalNamedType('errorOf', KeyPkgIdentifier().subtype(
207
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
208
+ namedtype.NamedType('errorBy', SIREntityName()),
209
+ namedtype.NamedType('errorCode', ErrorCodeChoice())
210
+ )
211
+
212
+
213
+ # Key Package Receipt CMS Content Type
214
+
215
+ id_ct_KP_keyPackageReceipt = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.3')
216
+
217
+ class KeyPackageReceipt(univ.Sequence):
218
+ pass
219
+
220
+ KeyPackageReceipt.componentType = namedtype.NamedTypes(
221
+ namedtype.DefaultedNamedType('version', KeyPkgVersion().subtype(value='v2')),
222
+ namedtype.NamedType('receiptOf', KeyPkgIdentifier()),
223
+ namedtype.NamedType('receivedBy', SIREntityName())
224
+ )
225
+
226
+
227
+ # Key Package Receipt Request Attribute
228
+
229
+ class KeyPkgReceiptReq(univ.Sequence):
230
+ pass
231
+
232
+ KeyPkgReceiptReq.componentType = namedtype.NamedTypes(
233
+ namedtype.DefaultedNamedType('encryptReceipt', univ.Boolean().subtype(value=0)),
234
+ namedtype.OptionalNamedType('receiptsFrom', SIREntityNames().subtype(
235
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
236
+ namedtype.NamedType('receiptsTo', SIREntityNames())
237
+ )
238
+
239
+
240
+ id_aa_KP_keyPkgIdAndReceiptReq = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.65')
241
+
242
+ class KeyPkgIdentifierAndReceiptReq(univ.Sequence):
243
+ pass
244
+
245
+ KeyPkgIdentifierAndReceiptReq.componentType = namedtype.NamedTypes(
246
+ namedtype.NamedType('pkgID', KeyPkgID()),
247
+ namedtype.OptionalNamedType('receiptReq', KeyPkgReceiptReq())
248
+ )
249
+
250
+
251
+ # Update the of CMS Attributes Map
252
+
253
+ _cmsAttributesMapUpdate = {
254
+ id_aa_KP_keyPkgIdAndReceiptReq: KeyPkgIdentifierAndReceiptReq(),
255
+ }
256
+
257
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)
258
+
259
+
260
+ # Update the CMS Content Types Maps
261
+
262
+ _cmsContentTypesMapUpdate = {
263
+ id_ct_KP_keyPackageError: KeyPackageError(),
264
+ id_ct_KP_keyPackageReceipt: KeyPackageReceipt(),
265
+ }
266
+
267
+ cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
@@ -0,0 +1,29 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # Object Identifiers for Test Certificate Policies
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc7229.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+
17
+
18
+ id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
19
+
20
+ id_TEST = id_pkix + (13, )
21
+
22
+ id_TEST_certPolicyOne = id_TEST + (1, )
23
+ id_TEST_certPolicyTwo = id_TEST + (2, )
24
+ id_TEST_certPolicyThree = id_TEST + (3, )
25
+ id_TEST_certPolicyFour = id_TEST + (4, )
26
+ id_TEST_certPolicyFive = id_TEST + (5, )
27
+ id_TEST_certPolicySix = id_TEST + (6, )
28
+ id_TEST_certPolicySeven = id_TEST + (7, )
29
+ id_TEST_certPolicyEight = id_TEST + (8, )