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,731 @@
1
+ #
2
+ # This file is part of pyasn1_alt_modules software.
3
+ #
4
+ # Created by Russ Housley with minor assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to make InfoTypeAndValue['infoType'] optional.
6
+ # Modified by Russ Housley to update the algorithmIdentifierMap.
7
+ # Modified bt Russ Housley to correct typo in SignKeyPairTypesValue.
8
+ #
9
+ # Copyright (c) 2021-2024, Vigil Security, LLC
10
+ # License: http://vigilsec.com/pyasn1_alt_modules_license.txt
11
+ #
12
+ # Updates to the Certificate Management Protocol (CMP)
13
+ #
14
+ # ASN.1 source from:
15
+ # https://www.rfc_editor.org/rfc/rfc9480.txt
16
+ #
17
+
18
+ from pyasn1.type import char
19
+ from pyasn1.type import constraint
20
+ from pyasn1.type import namedval
21
+ from pyasn1.type import namedtype
22
+ from pyasn1.type import opentype
23
+ from pyasn1.type import tag
24
+ from pyasn1.type import univ
25
+ from pyasn1.type import useful
26
+
27
+ from pyasn1_alt_modules import rfc2985
28
+ from pyasn1_alt_modules import rfc4210
29
+ from pyasn1_alt_modules import rfc4211
30
+ from pyasn1_alt_modules import rfc5280
31
+ from pyasn1_alt_modules import rfc5652
32
+ from pyasn1_alt_modules import rfc6402
33
+ from pyasn1_alt_modules import opentypemap
34
+
35
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
36
+
37
+ cmpInfoTypeAndValueMap = opentypemap.get('cmpInfoTypeAndValueMap')
38
+
39
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
40
+
41
+ MAX = float('inf')
42
+
43
+
44
+ # Imports from RFC 5280
45
+
46
+ Certificate = rfc5280.Certificate
47
+
48
+ CertificateList = rfc5280.CertificateList
49
+
50
+ DistributionPointName = rfc5280.DistributionPointName
51
+
52
+ Extensions = rfc5280.Extensions
53
+
54
+ Name = rfc5280.Name
55
+
56
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
57
+
58
+ GeneralNames = rfc5280.GeneralNames
59
+
60
+ GeneralName = rfc5280.GeneralName
61
+
62
+ KeyIdentifier = rfc5280.KeyIdentifier
63
+
64
+ Time = rfc5280.Time
65
+
66
+ id_pkix = rfc5280.id_pkix
67
+
68
+ id_kp = rfc5280.id_kp
69
+
70
+
71
+ # Imports from RFC 4211
72
+
73
+ CertTemplate = rfc4211.CertTemplate
74
+
75
+ PKIPublicationInfo = rfc4211.PKIPublicationInfo
76
+
77
+ EncryptedKey = rfc4211.EncryptedKey
78
+
79
+ CertId = rfc4211.CertId
80
+
81
+ CertReqMessages = rfc4211.CertReqMessages
82
+
83
+ Controls = rfc4211.Controls
84
+
85
+ AttributeTypeAndValue = rfc4211.AttributeTypeAndValue
86
+
87
+ id_regCtrl = rfc4211.id_regCtrl
88
+
89
+
90
+ # Imports from RFC 5652
91
+
92
+ Attribute = rfc5652.Attribute
93
+
94
+ EnvelopedData = rfc5652.EnvelopedData
95
+
96
+ SignedData = rfc5652.SignedData
97
+
98
+
99
+ # Imports from RFC 6402
100
+
101
+ CertificationRequest = rfc6402.CertificationRequest
102
+
103
+ id_kp_cmcCA = rfc6402.id_kp_cmcCA
104
+
105
+ id_kp_cmcRA = rfc6402.id_kp_cmcRA
106
+
107
+
108
+ # Imports from RFC 2985
109
+
110
+ pkcs_9 = rfc2985.pkcs_9
111
+
112
+ pkcs_9_at_localKeyId = rfc2985.pkcs_9_at_localKeyId
113
+
114
+
115
+ # Updates to the Certificate Management Protocol (CMP)
116
+ # Where possible, just import from RFC 4210
117
+
118
+ CMPCertificate = rfc4210.CMPCertificate
119
+
120
+
121
+ OOBCert = rfc4210.OOBCert
122
+
123
+
124
+ CertAnnContent = rfc4210.CertAnnContent
125
+
126
+
127
+ KeyIdentifier = rfc4210.KeyIdentifier
128
+
129
+
130
+ PollRepContent = rfc4210.PollRepContent
131
+
132
+
133
+ PKIConfirmContent = rfc4210.PKIConfirmContent
134
+
135
+
136
+ CRLAnnContent = rfc4210.CRLAnnContent
137
+
138
+
139
+ CAKeyUpdAnnContent = rfc4210.CAKeyUpdAnnContent
140
+
141
+
142
+ RevDetails = rfc4210.RevDetails
143
+
144
+
145
+ RevReqContent = rfc4210.RevReqContent
146
+
147
+
148
+ class InfoTypeAndValue(univ.Sequence):
149
+ componentType = namedtype.NamedTypes(
150
+ namedtype.NamedType('infoType', univ.ObjectIdentifier()),
151
+ namedtype.OptionalNamedType('infoValue', univ.Any(),
152
+ openType=opentype.OpenType('infoType', cmpInfoTypeAndValueMap))
153
+ )
154
+
155
+
156
+ class GenRepContent(univ.SequenceOf):
157
+ componentType = InfoTypeAndValue()
158
+
159
+
160
+ class GenMsgContent(univ.SequenceOf):
161
+ componentType = InfoTypeAndValue()
162
+
163
+
164
+ class CertOrEncCert(univ.Choice):
165
+ componentType = namedtype.NamedTypes(
166
+ namedtype.NamedType('certificate', CMPCertificate().subtype(
167
+ explicitTag=tag.Tag(tag.tagClassContext,
168
+ tag.tagFormatConstructed, 0))),
169
+ namedtype.NamedType('encryptedCert', EncryptedKey().subtype(
170
+ explicitTag=tag.Tag(tag.tagClassContext,
171
+ tag.tagFormatSimple, 1)))
172
+ )
173
+
174
+
175
+ class CertifiedKeyPair(univ.Sequence):
176
+ componentType = namedtype.NamedTypes(
177
+ namedtype.NamedType('certOrEncCert', CertOrEncCert()),
178
+ namedtype.OptionalNamedType('privateKey',
179
+ EncryptedKey().subtype(explicitTag=tag.Tag(
180
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
181
+ namedtype.OptionalNamedType('publicationInfo',
182
+ PKIPublicationInfo().subtype(explicitTag=tag.Tag(
183
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
184
+ )
185
+
186
+
187
+ POPODecKeyRespContent = rfc4210.POPODecKeyRespContent
188
+
189
+
190
+ Challenge = rfc4210.Challenge
191
+
192
+
193
+ # Added in CMP Updates
194
+ #
195
+ class Rand(univ.Sequence):
196
+ componentType = namedtype.NamedTypes(
197
+ namedtype.NamedType('int', univ.Integer()),
198
+ namedtype.NamedType('sender', GeneralName())
199
+ )
200
+
201
+
202
+ PKIStatus = rfc4210.PKIStatus
203
+
204
+
205
+ PKIFailureInfo = rfc4210.PKIFailureInfo
206
+
207
+
208
+ RevAnnContent = rfc4210.RevAnnContent
209
+
210
+
211
+ RevRepContent = rfc4210.RevRepContent
212
+
213
+
214
+ KeyRecRepContent = rfc4210.KeyRecRepContent
215
+
216
+
217
+ CertResponse = rfc4210.CertResponse
218
+
219
+
220
+ CertRepMessage = rfc4210.CertRepMessage
221
+
222
+
223
+ POPODecKeyChallContent = rfc4210.POPODecKeyChallContent
224
+
225
+
226
+ OOBCertHash = rfc4210.OOBCertHash
227
+
228
+
229
+ DHBMParameter = rfc4210.DHBMParameter
230
+
231
+
232
+ PBMParameter = rfc4210.PBMParameter
233
+
234
+
235
+ PKIProtection = rfc4210.PKIProtection
236
+
237
+
238
+ class PKIFreeText(univ.SequenceOf):
239
+ componentType = char.UTF8String()
240
+ subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
241
+
242
+
243
+ class PKIStatusInfo(univ.Sequence):
244
+ componentType = namedtype.NamedTypes(
245
+ namedtype.NamedType('status', PKIStatus()),
246
+ namedtype.OptionalNamedType('statusString', PKIFreeText()),
247
+ namedtype.OptionalNamedType('failInfo', PKIFailureInfo())
248
+ )
249
+
250
+
251
+ class ErrorMsgContent(univ.Sequence):
252
+ componentType = namedtype.NamedTypes(
253
+ namedtype.NamedType('pKIStatusInfo', PKIStatusInfo()),
254
+ namedtype.OptionalNamedType('errorCode', univ.Integer()),
255
+ namedtype.OptionalNamedType('errorDetails', PKIFreeText())
256
+ )
257
+
258
+
259
+ PollReqContent = rfc4210.PollReqContent
260
+
261
+
262
+ class PollRepContent(univ.SequenceOf):
263
+ componentType = univ.Sequence(componentType=namedtype.NamedTypes(
264
+ namedtype.NamedType('certReqId', univ.Integer()),
265
+ namedtype.NamedType('checkAfter', univ.Integer()),
266
+ namedtype.OptionalNamedType('reason', PKIFreeText())
267
+ ))
268
+
269
+
270
+ class CertStatus(univ.Sequence):
271
+ componentType = namedtype.NamedTypes(
272
+ namedtype.OptionalNamedType('hashAlg',
273
+ AlgorithmIdentifier().subtype(explicitTag=tag.Tag(
274
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
275
+ namedtype.NamedType('certHash', univ.OctetString()),
276
+ namedtype.NamedType('certReqId', univ.Integer()),
277
+ namedtype.OptionalNamedType('statusInfo', PKIStatusInfo())
278
+ )
279
+
280
+
281
+ class CertConfirmContent(univ.SequenceOf):
282
+ componentType = CertStatus()
283
+
284
+
285
+ class PKIHeader(univ.Sequence):
286
+ componentType = namedtype.NamedTypes(
287
+ namedtype.NamedType('pvno', univ.Integer(
288
+ namedValues=namedval.NamedValues(
289
+ ('cmp1999', 1), ('cmp2000', 2), ('cmp2021', 3)))),
290
+ namedtype.NamedType('sender', GeneralName()),
291
+ namedtype.NamedType('recipient', GeneralName()),
292
+ namedtype.OptionalNamedType('messageTime',
293
+ useful.GeneralizedTime().subtype(explicitTag=tag.Tag(
294
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
295
+ namedtype.OptionalNamedType('protectionAlg',
296
+ AlgorithmIdentifier().subtype(explicitTag=tag.Tag(
297
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
298
+ namedtype.OptionalNamedType('senderKID',
299
+ KeyIdentifier().subtype(explicitTag=tag.Tag(
300
+ tag.tagClassContext, tag.tagFormatSimple, 2))),
301
+ namedtype.OptionalNamedType('recipKID',
302
+ KeyIdentifier().subtype(explicitTag=tag.Tag(
303
+ tag.tagClassContext, tag.tagFormatSimple, 3))),
304
+ namedtype.OptionalNamedType('transactionID',
305
+ univ.OctetString().subtype(explicitTag=tag.Tag(
306
+ tag.tagClassContext, tag.tagFormatSimple, 4))),
307
+ namedtype.OptionalNamedType('senderNonce',
308
+ univ.OctetString().subtype(explicitTag=tag.Tag(
309
+ tag.tagClassContext, tag.tagFormatSimple, 5))),
310
+ namedtype.OptionalNamedType('recipNonce',
311
+ univ.OctetString().subtype(explicitTag=tag.Tag(
312
+ tag.tagClassContext, tag.tagFormatSimple, 6))),
313
+ namedtype.OptionalNamedType('freeText',
314
+ PKIFreeText().subtype(explicitTag=tag.Tag(
315
+ tag.tagClassContext, tag.tagFormatSimple, 7))),
316
+ namedtype.OptionalNamedType('generalInfo',
317
+ univ.SequenceOf(componentType=InfoTypeAndValue()).subtype(
318
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
319
+ explicitTag=tag.Tag(tag.tagClassContext,
320
+ tag.tagFormatSimple, 8)))
321
+ )
322
+
323
+
324
+ # Since pyasn1 does not naturally handle recursive definitions, this hack
325
+ # instead of:
326
+ # class NestedMessageContent(PKIMessages):
327
+ # pass
328
+ # Note that there is a second part of the hack at the bottom of the module.
329
+ #
330
+ class NestedMessageContent(univ.SequenceOf):
331
+ componentType = univ.Any()
332
+
333
+
334
+ nestedMessageContent = NestedMessageContent().subtype(
335
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 20))
336
+
337
+
338
+ class PKIBody(univ.Choice):
339
+ componentType = namedtype.NamedTypes(
340
+ namedtype.NamedType('ir', CertReqMessages().subtype(
341
+ explicitTag=tag.Tag(tag.tagClassContext,
342
+ tag.tagFormatSimple, 0))),
343
+ namedtype.NamedType('ip', CertRepMessage().subtype(
344
+ explicitTag=tag.Tag(tag.tagClassContext,
345
+ tag.tagFormatConstructed, 1))),
346
+ namedtype.NamedType('cr', CertReqMessages().subtype(
347
+ explicitTag=tag.Tag(tag.tagClassContext,
348
+ tag.tagFormatSimple, 2))),
349
+ namedtype.NamedType('cp', CertRepMessage().subtype(
350
+ explicitTag=tag.Tag(tag.tagClassContext,
351
+ tag.tagFormatConstructed, 3))),
352
+ namedtype.NamedType('p10cr', CertificationRequest().subtype(
353
+ explicitTag=tag.Tag(tag.tagClassContext,
354
+ tag.tagFormatSimple, 4))),
355
+ namedtype.NamedType('popdecc', POPODecKeyChallContent().subtype(
356
+ explicitTag=tag.Tag(tag.tagClassContext,
357
+ tag.tagFormatSimple, 5))),
358
+ namedtype.NamedType('popdecr', POPODecKeyRespContent().subtype(
359
+ explicitTag=tag.Tag(tag.tagClassContext,
360
+ tag.tagFormatSimple, 6))),
361
+ namedtype.NamedType('kur', CertReqMessages().subtype(
362
+ explicitTag=tag.Tag(tag.tagClassContext,
363
+ tag.tagFormatSimple, 7))),
364
+ namedtype.NamedType('kup', CertRepMessage().subtype(
365
+ explicitTag=tag.Tag(tag.tagClassContext,
366
+ tag.tagFormatConstructed, 8))),
367
+ namedtype.NamedType('krr', CertReqMessages().subtype(
368
+ explicitTag=tag.Tag(tag.tagClassContext,
369
+ tag.tagFormatSimple, 9))),
370
+ namedtype.NamedType('krp', KeyRecRepContent().subtype(
371
+ explicitTag=tag.Tag(tag.tagClassContext,
372
+ tag.tagFormatConstructed, 10))),
373
+ namedtype.NamedType('rr', RevReqContent().subtype(
374
+ explicitTag=tag.Tag(tag.tagClassContext,
375
+ tag.tagFormatSimple, 11))),
376
+ namedtype.NamedType('rp', RevRepContent().subtype(
377
+ explicitTag=tag.Tag(tag.tagClassContext,
378
+ tag.tagFormatConstructed, 12))),
379
+ namedtype.NamedType('ccr', CertReqMessages().subtype(
380
+ explicitTag=tag.Tag(tag.tagClassContext,
381
+ tag.tagFormatSimple, 13))),
382
+ namedtype.NamedType('ccp', CertRepMessage().subtype(
383
+ explicitTag=tag.Tag(tag.tagClassContext,
384
+ tag.tagFormatConstructed, 14))),
385
+ namedtype.NamedType('ckuann', CAKeyUpdAnnContent().subtype(
386
+ explicitTag=tag.Tag(tag.tagClassContext,
387
+ tag.tagFormatConstructed, 15))),
388
+ namedtype.NamedType('cann', CertAnnContent().subtype(
389
+ explicitTag=tag.Tag(tag.tagClassContext,
390
+ tag.tagFormatConstructed, 16))),
391
+ namedtype.NamedType('rann', RevAnnContent().subtype(
392
+ explicitTag=tag.Tag(tag.tagClassContext,
393
+ tag.tagFormatConstructed, 17))),
394
+ namedtype.NamedType('crlann', CRLAnnContent().subtype(
395
+ explicitTag=tag.Tag(tag.tagClassContext,
396
+ tag.tagFormatSimple, 18))),
397
+ namedtype.NamedType('pkiconf', PKIConfirmContent().subtype(
398
+ explicitTag=tag.Tag(tag.tagClassContext,
399
+ tag.tagFormatSimple, 19))),
400
+ namedtype.NamedType('nested', nestedMessageContent),
401
+ namedtype.NamedType('genm', GenMsgContent().subtype(
402
+ explicitTag=tag.Tag(tag.tagClassContext,
403
+ tag.tagFormatSimple, 21))),
404
+ namedtype.NamedType('genp', GenRepContent().subtype(
405
+ explicitTag=tag.Tag(tag.tagClassContext,
406
+ tag.tagFormatSimple, 22))),
407
+ namedtype.NamedType('error', ErrorMsgContent().subtype(
408
+ explicitTag=tag.Tag(tag.tagClassContext,
409
+ tag.tagFormatConstructed, 23))),
410
+ namedtype.NamedType('certConf', CertConfirmContent().subtype(
411
+ explicitTag=tag.Tag(tag.tagClassContext,
412
+ tag.tagFormatSimple, 24))),
413
+ namedtype.NamedType('pollReq', PollReqContent().subtype(
414
+ explicitTag=tag.Tag(tag.tagClassContext,
415
+ tag.tagFormatSimple, 25))),
416
+ namedtype.NamedType('pollRep', PollRepContent().subtype(
417
+ explicitTag=tag.Tag(tag.tagClassContext,
418
+ tag.tagFormatSimple, 26)))
419
+ )
420
+
421
+
422
+ class PKIMessage(univ.Sequence):
423
+ componentType = namedtype.NamedTypes(
424
+ namedtype.NamedType('header', PKIHeader()),
425
+ namedtype.NamedType('body', PKIBody()),
426
+ namedtype.OptionalNamedType('protection', PKIProtection().subtype(
427
+ explicitTag=tag.Tag(tag.tagClassContext,
428
+ tag.tagFormatSimple, 0))),
429
+ namedtype.OptionalNamedType('extraCerts', univ.SequenceOf(
430
+ componentType=CMPCertificate()).subtype(
431
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
432
+ explicitTag=tag.Tag(tag.tagClassContext,
433
+ tag.tagFormatSimple, 1)))
434
+ )
435
+
436
+
437
+ class PKIMessages(univ.SequenceOf):
438
+ componentType = PKIMessage()
439
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
440
+
441
+
442
+ class ProtectedPart(univ.Sequence):
443
+ componentType = namedtype.NamedTypes(
444
+ namedtype.NamedType('header', PKIHeader()),
445
+ namedtype.NamedType('body', PKIBody())
446
+ )
447
+
448
+
449
+ # Added in CMP Updates
450
+ #
451
+ class RootCaKeyUpdateContent(univ.Sequence):
452
+ componentType = namedtype.NamedTypes(
453
+ namedtype.NamedType('newWithNew', CMPCertificate()),
454
+ namedtype.OptionalNamedType('newWithOld', CMPCertificate().subtype(
455
+ explicitTag=tag.Tag(tag.tagClassContext,
456
+ tag.tagFormatConstructed, 0))),
457
+ namedtype.OptionalNamedType('oldWithNew', CMPCertificate().subtype(
458
+ explicitTag=tag.Tag(tag.tagClassContext,
459
+ tag.tagFormatConstructed, 1)))
460
+ )
461
+
462
+
463
+ # Added in CMP Updates
464
+ #
465
+ class CRLSource(univ.Choice):
466
+ componentType = namedtype.NamedTypes(
467
+ namedtype.NamedType('dpn', DistributionPointName().subtype(
468
+ explicitTag=tag.Tag(tag.tagClassContext,
469
+ tag.tagFormatConstructed, 0))),
470
+ namedtype.NamedType('issuer', EncryptedKey().subtype(
471
+ explicitTag=tag.Tag(tag.tagClassContext,
472
+ tag.tagFormatConstructed, 1)))
473
+ )
474
+
475
+
476
+ # Added in CMP Updates
477
+ #
478
+ class CRLStatus(univ.Sequence):
479
+ componentType = namedtype.NamedTypes(
480
+ namedtype.NamedType('source', CRLSource()),
481
+ namedtype.OptionalNamedType('thisUpdate', Time())
482
+ )
483
+
484
+
485
+ # Added in CMP Updates
486
+ #
487
+ class CertReqTemplateContent(univ.Sequence):
488
+ componentType = namedtype.NamedTypes(
489
+ namedtype.NamedType('certTemplate', CertTemplate()),
490
+ namedtype.OptionalNamedType('keySpec', Controls())
491
+ )
492
+
493
+
494
+ # Object Identifiers for MAC algorithms
495
+
496
+ id_DHBasedMac = rfc4210.id_DHBasedMac
497
+
498
+ id_PasswordBasedMac = rfc4210.id_PasswordBasedMac
499
+
500
+
501
+ # Extended Key Usage extension for PKI entities used in CMP operations
502
+
503
+ id_kp_cmKGA = id_kp + (32,)
504
+
505
+
506
+ # The value for the LocalKeyId Attribute from PKCS#9 (RFC 2985)
507
+
508
+ class LocalKeyIdValue(univ.OctetString):
509
+ pass
510
+
511
+
512
+ # Additional CRMF Registration Controls
513
+
514
+ id_regCtrl_altCertTemplate = id_regCtrl + (7,)
515
+
516
+ class AltCertTemplate(AttributeTypeAndValue):
517
+ pass
518
+
519
+
520
+ id_regCtrl_algId = id_regCtrl + (11,)
521
+
522
+ class AlgIdCtrl(AlgorithmIdentifier):
523
+ pass
524
+
525
+
526
+ id_regCtrl_rsaKeyLen = id_regCtrl + (12,)
527
+
528
+ class RsaKeyLenCtrl(univ.Integer):
529
+ subtypeSpec = constraint.ValueRangeConstraint(1, MAX)
530
+
531
+
532
+ # CMP Information Types
533
+
534
+ id_it = id_pkix + (4,)
535
+
536
+ id_it_caProtEncCert = id_it + (1,)
537
+
538
+ class CAProtEncCertValue(CMPCertificate):
539
+ pass
540
+
541
+
542
+ id_it_signKeyPairTypes = id_it + (2,)
543
+
544
+ class SignKeyPairTypesValue(univ.SequenceOf):
545
+ componentType = AlgorithmIdentifier()
546
+
547
+
548
+ id_it_encKeyPairTypes = id_it + (3,)
549
+
550
+ class EncKeyPairTypesValue(univ.SequenceOf):
551
+ componentType = AlgorithmIdentifier()
552
+
553
+
554
+ id_it_preferredSymmAlg = id_it + (4,)
555
+
556
+ class PreferredSymmAlgValue(AlgorithmIdentifier):
557
+ pass
558
+
559
+
560
+ id_it_caKeyUpdateInfo = id_it + (5,)
561
+
562
+ class CAKeyUpdateInfoValue(CAKeyUpdAnnContent):
563
+ pass
564
+
565
+
566
+ id_it_currentCRL = id_it + (6,)
567
+
568
+ class CurrentCRLValue(CertificateList):
569
+ pass
570
+
571
+
572
+ id_it_unsupportedOIDs = id_it + (7,)
573
+
574
+ class UnsupportedOIDsValue(univ.SequenceOf):
575
+ componentType = univ.ObjectIdentifier()
576
+
577
+
578
+ id_it_keyPairParamReq = id_it + (10,)
579
+
580
+ class KeyPairParamReqValue(univ.ObjectIdentifier):
581
+ pass
582
+
583
+
584
+ id_it_keyPairParamRep = id_it + (11,)
585
+
586
+ class KeyPairParamRepValue(AlgorithmIdentifier):
587
+ pass
588
+
589
+
590
+ id_it_revPassphrase = id_it + (12,)
591
+
592
+ class RevPassphraseValue(EncryptedKey):
593
+ pass
594
+
595
+
596
+ id_it_implicitConfirm = id_it + (13,)
597
+
598
+ class ImplicitConfirmValue(univ.Null):
599
+ pass
600
+
601
+
602
+ id_it_confirmWaitTime = id_it + (14,)
603
+
604
+ class ConfirmWaitTimeValue(useful.GeneralizedTime):
605
+ pass
606
+
607
+
608
+ id_it_origPKIMessage = id_it + (15,)
609
+
610
+ class OrigPKIMessageValue(PKIMessages):
611
+ pass
612
+
613
+
614
+ id_it_suppLangTags = id_it + (16,)
615
+
616
+ class SuppLangTagsValue(univ.SequenceOf):
617
+ componentType = char.UTF8String()
618
+
619
+
620
+ # Added in CMP Updates
621
+ #
622
+ id_it_caCerts = id_it + (17,)
623
+
624
+ class CaCertsValue(univ.SequenceOf):
625
+ componentType = CMPCertificate()
626
+
627
+
628
+ # Added in CMP Updates
629
+ #
630
+ id_it_rootCaKeyUpdate = id_it + (18,)
631
+
632
+ class RootCaKeyUpdateValue(RootCaKeyUpdateContent):
633
+ pass
634
+
635
+
636
+ # Added in CMP Updates
637
+ #
638
+ id_it_certReqTemplate = id_it + (19,)
639
+
640
+ class CertReqTemplateValue(CertReqTemplateContent):
641
+ pass
642
+
643
+
644
+ # Added in CMP Updates
645
+ #
646
+ id_it_rootCaCert = id_it + (20,)
647
+
648
+ class RootCaCertValue(CMPCertificate):
649
+ pass
650
+
651
+
652
+ # Added in CMP Updates
653
+ #
654
+ id_it_certProfile = id_it + (21,)
655
+
656
+ class CertProfileValue(char.UTF8String):
657
+ pass
658
+
659
+
660
+ # Added in CMP Updates
661
+ #
662
+ id_it_crlStatusList = id_it + (22,)
663
+
664
+ class CRLStatusListValue(univ.SequenceOf):
665
+ componentType = CRLStatus()
666
+ subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
667
+
668
+
669
+ # Added in CMP Updates
670
+ #
671
+ id_it_crls = id_it + (23,)
672
+
673
+ class CRLsValue(univ.SequenceOf):
674
+ componentType = CertificateList()
675
+ subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
676
+
677
+
678
+ # Update the CMP Information Types Map
679
+
680
+ _cmpInfoTypeAndValueMapUpdate = {
681
+ id_it_caProtEncCert: CAProtEncCertValue(),
682
+ id_it_signKeyPairTypes: SignKeyPairTypesValue(),
683
+ id_it_encKeyPairTypes: EncKeyPairTypesValue(),
684
+ id_it_preferredSymmAlg: PreferredSymmAlgValue(),
685
+ id_it_caKeyUpdateInfo: CAKeyUpdateInfoValue(),
686
+ id_it_currentCRL: CurrentCRLValue(),
687
+ id_it_unsupportedOIDs: UnsupportedOIDsValue(),
688
+ id_it_keyPairParamReq: KeyPairParamReqValue(),
689
+ id_it_keyPairParamRep: KeyPairParamRepValue(),
690
+ id_it_revPassphrase: RevPassphraseValue(),
691
+ id_it_implicitConfirm: ImplicitConfirmValue(),
692
+ id_it_confirmWaitTime: ConfirmWaitTimeValue(),
693
+ id_it_origPKIMessage: OrigPKIMessageValue(),
694
+ id_it_suppLangTags: SuppLangTagsValue(),
695
+ id_it_caCerts: CaCertsValue(),
696
+ id_it_rootCaKeyUpdate: RootCaKeyUpdateValue(),
697
+ id_it_certReqTemplate: CertReqTemplateValue(),
698
+ id_it_rootCaCert: RootCaCertValue(),
699
+ id_it_certProfile: CertProfileValue(),
700
+ id_it_crlStatusList: CRLStatusListValue(),
701
+ id_it_crls: CRLsValue(),
702
+ }
703
+
704
+ cmpInfoTypeAndValueMap.update(_cmpInfoTypeAndValueMapUpdate)
705
+
706
+
707
+ # Update the CMS Attribute Map
708
+
709
+ _cmsAttributesMapUpdate = {
710
+ id_regCtrl_altCertTemplate: AltCertTemplate(),
711
+ id_regCtrl_algId: AlgIdCtrl(),
712
+ id_regCtrl_rsaKeyLen: RsaKeyLenCtrl(),
713
+ }
714
+
715
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)
716
+
717
+
718
+ # Update the Algorithm Identifier map
719
+
720
+ _algorithmIdentifierMapUpdate = {
721
+ id_PasswordBasedMac: PBMParameter(),
722
+ id_DHBasedMac: DHBMParameter(),
723
+ }
724
+
725
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
726
+
727
+
728
+ # Since pyasn1 does not naturally handle recursive definitions, this hack:
729
+ #
730
+ NestedMessageContent._componentType = PKIMessages()
731
+ nestedMessageContent._componentType = PKIMessages()