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,763 @@
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-alt-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Modified by Russ Housley to add support for opentypes.
7
+ # Modified by Russ Housley to include the opentypemap manager.
8
+ #
9
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
10
+ # Copyright (c) 2021-2024, Vigil Security, LLC
11
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
12
+ #
13
+ # Cryptographic Message Syntax (CMS)
14
+ #
15
+ # ASN.1 source from:
16
+ # http://www.ietf.org/rfc/rfc5652.txt
17
+ #
18
+ from pyasn1.type import constraint
19
+ from pyasn1.type import namedtype
20
+ from pyasn1.type import namedval
21
+ from pyasn1.type import opentype
22
+ from pyasn1.type import tag
23
+ from pyasn1.type import univ
24
+ from pyasn1.type import useful
25
+
26
+ from pyasn1_alt_modules import rfc3281
27
+ from pyasn1_alt_modules import rfc5280
28
+ from pyasn1_alt_modules import opentypemap
29
+
30
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
31
+
32
+ cmsContentTypesMap = opentypemap.get('cmsContentTypesMap')
33
+
34
+ otherKeyAttributesMap = opentypemap.get('otherKeyAttributesMap')
35
+
36
+ otherCertFormatMap = opentypemap.get('otherCertFormatMap')
37
+
38
+ otherRevInfoFormatMap = opentypemap.get('otherRevInfoFormatMap')
39
+
40
+ otherRecipientInfoMap = opentypemap.get('otherRecipientInfoMap')
41
+
42
+ MAX = float('inf')
43
+
44
+
45
+ def _buildOid(*components):
46
+ output = []
47
+ for x in tuple(components):
48
+ if isinstance(x, univ.ObjectIdentifier):
49
+ output.extend(list(x))
50
+ else:
51
+ output.append(int(x))
52
+
53
+ return univ.ObjectIdentifier(output)
54
+
55
+
56
+ class AttCertVersionV1(univ.Integer):
57
+ pass
58
+
59
+
60
+ AttCertVersionV1.namedValues = namedval.NamedValues(
61
+ ('v1', 0)
62
+ )
63
+
64
+
65
+ class AttributeCertificateInfoV1(univ.Sequence):
66
+ pass
67
+
68
+
69
+ AttributeCertificateInfoV1.componentType = namedtype.NamedTypes(
70
+ namedtype.DefaultedNamedType('version', AttCertVersionV1().subtype(value="v1")),
71
+ namedtype.NamedType(
72
+ 'subject', univ.Choice(
73
+ componentType=namedtype.NamedTypes(
74
+ namedtype.NamedType('baseCertificateID', rfc3281.IssuerSerial().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
75
+ namedtype.NamedType('subjectName', rfc5280.GeneralNames().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
76
+ )
77
+ )
78
+ ),
79
+ namedtype.NamedType('issuer', rfc5280.GeneralNames()),
80
+ namedtype.NamedType('signature', rfc5280.AlgorithmIdentifier()),
81
+ namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber()),
82
+ namedtype.NamedType('attCertValidityPeriod', rfc3281.AttCertValidityPeriod()),
83
+ namedtype.NamedType('attributes', univ.SequenceOf(componentType=rfc5280.Attribute())),
84
+ namedtype.OptionalNamedType('issuerUniqueID', rfc5280.UniqueIdentifier()),
85
+ namedtype.OptionalNamedType('extensions', rfc5280.Extensions())
86
+ )
87
+
88
+
89
+ class AttributeCertificateV1(univ.Sequence):
90
+ pass
91
+
92
+
93
+ AttributeCertificateV1.componentType = namedtype.NamedTypes(
94
+ namedtype.NamedType('acInfo', AttributeCertificateInfoV1()),
95
+ namedtype.NamedType('signatureAlgorithm', rfc5280.AlgorithmIdentifier()),
96
+ namedtype.NamedType('signature', univ.BitString())
97
+ )
98
+
99
+
100
+ class AttributeValue(univ.Any):
101
+ pass
102
+
103
+
104
+ class Attribute(univ.Sequence):
105
+ pass
106
+
107
+
108
+ Attribute.componentType = namedtype.NamedTypes(
109
+ namedtype.NamedType('attrType', univ.ObjectIdentifier()),
110
+ namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()),
111
+ openType=opentype.OpenType('attrType', cmsAttributesMap)
112
+ )
113
+ )
114
+
115
+
116
+ class SignedAttributes(univ.SetOf):
117
+ pass
118
+
119
+
120
+ SignedAttributes.componentType = Attribute()
121
+ SignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
122
+
123
+
124
+ class AttributeCertificateV2(rfc3281.AttributeCertificate):
125
+ pass
126
+
127
+
128
+ class OtherKeyAttribute(univ.Sequence):
129
+ pass
130
+
131
+
132
+ OtherKeyAttribute.componentType = namedtype.NamedTypes(
133
+ namedtype.NamedType('keyAttrId', univ.ObjectIdentifier()),
134
+ namedtype.OptionalNamedType('keyAttr', univ.Any(),
135
+ openType=opentype.OpenType('keyAttrId', otherKeyAttributesMap)
136
+ )
137
+ )
138
+
139
+
140
+ class UnauthAttributes(univ.SetOf):
141
+ pass
142
+
143
+
144
+ UnauthAttributes.componentType = Attribute()
145
+ UnauthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
146
+
147
+ id_encryptedData = _buildOid(1, 2, 840, 113549, 1, 7, 6)
148
+
149
+
150
+ class SignatureValue(univ.OctetString):
151
+ pass
152
+
153
+
154
+ class IssuerAndSerialNumber(univ.Sequence):
155
+ pass
156
+
157
+
158
+ IssuerAndSerialNumber.componentType = namedtype.NamedTypes(
159
+ namedtype.NamedType('issuer', rfc5280.Name()),
160
+ namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber())
161
+ )
162
+
163
+
164
+ class SubjectKeyIdentifier(univ.OctetString):
165
+ pass
166
+
167
+
168
+ class RecipientKeyIdentifier(univ.Sequence):
169
+ pass
170
+
171
+
172
+ RecipientKeyIdentifier.componentType = namedtype.NamedTypes(
173
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier()),
174
+ namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
175
+ namedtype.OptionalNamedType('other', OtherKeyAttribute())
176
+ )
177
+
178
+
179
+ class KeyAgreeRecipientIdentifier(univ.Choice):
180
+ pass
181
+
182
+
183
+ KeyAgreeRecipientIdentifier.componentType = namedtype.NamedTypes(
184
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
185
+ namedtype.NamedType('rKeyId', RecipientKeyIdentifier().subtype(
186
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
187
+ )
188
+
189
+
190
+ class EncryptedKey(univ.OctetString):
191
+ pass
192
+
193
+
194
+ class RecipientEncryptedKey(univ.Sequence):
195
+ pass
196
+
197
+
198
+ RecipientEncryptedKey.componentType = namedtype.NamedTypes(
199
+ namedtype.NamedType('rid', KeyAgreeRecipientIdentifier()),
200
+ namedtype.NamedType('encryptedKey', EncryptedKey())
201
+ )
202
+
203
+
204
+ class RecipientEncryptedKeys(univ.SequenceOf):
205
+ pass
206
+
207
+
208
+ RecipientEncryptedKeys.componentType = RecipientEncryptedKey()
209
+
210
+
211
+ class MessageAuthenticationCode(univ.OctetString):
212
+ pass
213
+
214
+
215
+ class CMSVersion(univ.Integer):
216
+ pass
217
+
218
+
219
+ CMSVersion.namedValues = namedval.NamedValues(
220
+ ('v0', 0),
221
+ ('v1', 1),
222
+ ('v2', 2),
223
+ ('v3', 3),
224
+ ('v4', 4),
225
+ ('v5', 5)
226
+ )
227
+
228
+
229
+ class OtherCertificateFormat(univ.Sequence):
230
+ pass
231
+
232
+
233
+ OtherCertificateFormat.componentType = namedtype.NamedTypes(
234
+ namedtype.NamedType('otherCertFormat', univ.ObjectIdentifier()),
235
+ namedtype.NamedType('otherCert', univ.Any(),
236
+ openType=opentype.OpenType('otherCertFormat', otherCertFormatMap)
237
+ )
238
+ )
239
+
240
+
241
+ class ExtendedCertificateInfo(univ.Sequence):
242
+ pass
243
+
244
+
245
+ ExtendedCertificateInfo.componentType = namedtype.NamedTypes(
246
+ namedtype.NamedType('version', CMSVersion()),
247
+ namedtype.NamedType('certificate', rfc5280.Certificate()),
248
+ namedtype.NamedType('attributes', UnauthAttributes())
249
+ )
250
+
251
+
252
+ class Signature(univ.BitString):
253
+ pass
254
+
255
+
256
+ class SignatureAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
257
+ pass
258
+
259
+
260
+ class ExtendedCertificate(univ.Sequence):
261
+ pass
262
+
263
+
264
+ ExtendedCertificate.componentType = namedtype.NamedTypes(
265
+ namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
266
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
267
+ namedtype.NamedType('signature', Signature())
268
+ )
269
+
270
+
271
+ class CertificateChoices(univ.Choice):
272
+ pass
273
+
274
+
275
+ CertificateChoices.componentType = namedtype.NamedTypes(
276
+ namedtype.NamedType('certificate', rfc5280.Certificate()),
277
+ namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
278
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
279
+ namedtype.NamedType('v1AttrCert', AttributeCertificateV1().subtype(
280
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
281
+ namedtype.NamedType('v2AttrCert', AttributeCertificateV2().subtype(
282
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
283
+ namedtype.NamedType('other', OtherCertificateFormat().subtype(
284
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
285
+ )
286
+
287
+
288
+ class CertificateSet(univ.SetOf):
289
+ pass
290
+
291
+
292
+ CertificateSet.componentType = CertificateChoices()
293
+
294
+
295
+ class OtherRevocationInfoFormat(univ.Sequence):
296
+ pass
297
+
298
+
299
+ OtherRevocationInfoFormat.componentType = namedtype.NamedTypes(
300
+ namedtype.NamedType('otherRevInfoFormat', univ.ObjectIdentifier()),
301
+ namedtype.NamedType('otherRevInfo', univ.Any(),
302
+ openType=opentype.OpenType('otherRevInfoFormat', otherRevInfoFormatMap)
303
+ )
304
+ )
305
+
306
+
307
+ class RevocationInfoChoice(univ.Choice):
308
+ pass
309
+
310
+
311
+ RevocationInfoChoice.componentType = namedtype.NamedTypes(
312
+ namedtype.NamedType('crl', rfc5280.CertificateList()),
313
+ namedtype.NamedType('other', OtherRevocationInfoFormat().subtype(
314
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
315
+ )
316
+
317
+
318
+ class RevocationInfoChoices(univ.SetOf):
319
+ pass
320
+
321
+
322
+ RevocationInfoChoices.componentType = RevocationInfoChoice()
323
+
324
+
325
+ class OriginatorInfo(univ.Sequence):
326
+ pass
327
+
328
+
329
+ OriginatorInfo.componentType = namedtype.NamedTypes(
330
+ namedtype.OptionalNamedType('certs', CertificateSet().subtype(
331
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
332
+ namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
333
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
334
+ )
335
+
336
+
337
+ class ContentType(univ.ObjectIdentifier):
338
+ pass
339
+
340
+
341
+ class EncryptedContent(univ.OctetString):
342
+ pass
343
+
344
+
345
+ class ContentEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
346
+ pass
347
+
348
+
349
+ class EncryptedContentInfo(univ.Sequence):
350
+ pass
351
+
352
+
353
+ EncryptedContentInfo.componentType = namedtype.NamedTypes(
354
+ namedtype.NamedType('contentType', ContentType()),
355
+ namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
356
+ namedtype.OptionalNamedType('encryptedContent', EncryptedContent().subtype(
357
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
358
+ )
359
+
360
+
361
+ class UnprotectedAttributes(univ.SetOf):
362
+ pass
363
+
364
+
365
+ UnprotectedAttributes.componentType = Attribute()
366
+ UnprotectedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
367
+
368
+
369
+ class KeyEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
370
+ pass
371
+
372
+
373
+ class KEKIdentifier(univ.Sequence):
374
+ pass
375
+
376
+
377
+ KEKIdentifier.componentType = namedtype.NamedTypes(
378
+ namedtype.NamedType('keyIdentifier', univ.OctetString()),
379
+ namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
380
+ namedtype.OptionalNamedType('other', OtherKeyAttribute())
381
+ )
382
+
383
+
384
+ class KEKRecipientInfo(univ.Sequence):
385
+ pass
386
+
387
+
388
+ KEKRecipientInfo.componentType = namedtype.NamedTypes(
389
+ namedtype.NamedType('version', CMSVersion()),
390
+ namedtype.NamedType('kekid', KEKIdentifier()),
391
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
392
+ namedtype.NamedType('encryptedKey', EncryptedKey())
393
+ )
394
+
395
+
396
+ class KeyDerivationAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
397
+ pass
398
+
399
+
400
+ class PasswordRecipientInfo(univ.Sequence):
401
+ pass
402
+
403
+
404
+ PasswordRecipientInfo.componentType = namedtype.NamedTypes(
405
+ namedtype.NamedType('version', CMSVersion()),
406
+ namedtype.OptionalNamedType('keyDerivationAlgorithm', KeyDerivationAlgorithmIdentifier().subtype(
407
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
408
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
409
+ namedtype.NamedType('encryptedKey', EncryptedKey())
410
+ )
411
+
412
+
413
+ class RecipientIdentifier(univ.Choice):
414
+ pass
415
+
416
+
417
+ RecipientIdentifier.componentType = namedtype.NamedTypes(
418
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
419
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
420
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
421
+ )
422
+
423
+
424
+ class KeyTransRecipientInfo(univ.Sequence):
425
+ pass
426
+
427
+
428
+ KeyTransRecipientInfo.componentType = namedtype.NamedTypes(
429
+ namedtype.NamedType('version', CMSVersion()),
430
+ namedtype.NamedType('rid', RecipientIdentifier()),
431
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
432
+ namedtype.NamedType('encryptedKey', EncryptedKey())
433
+ )
434
+
435
+
436
+ class UserKeyingMaterial(univ.OctetString):
437
+ pass
438
+
439
+
440
+ class OriginatorPublicKey(univ.Sequence):
441
+ pass
442
+
443
+
444
+ OriginatorPublicKey.componentType = namedtype.NamedTypes(
445
+ namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()),
446
+ namedtype.NamedType('publicKey', univ.BitString())
447
+ )
448
+
449
+
450
+ class OriginatorIdentifierOrKey(univ.Choice):
451
+ pass
452
+
453
+
454
+ OriginatorIdentifierOrKey.componentType = namedtype.NamedTypes(
455
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
456
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
457
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
458
+ namedtype.NamedType('originatorKey', OriginatorPublicKey().subtype(
459
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
460
+ )
461
+
462
+
463
+ class KeyAgreeRecipientInfo(univ.Sequence):
464
+ pass
465
+
466
+
467
+ KeyAgreeRecipientInfo.componentType = namedtype.NamedTypes(
468
+ namedtype.NamedType('version', CMSVersion()),
469
+ namedtype.NamedType('originator', OriginatorIdentifierOrKey().subtype(
470
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
471
+ namedtype.OptionalNamedType('ukm', UserKeyingMaterial().subtype(
472
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
473
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
474
+ namedtype.NamedType('recipientEncryptedKeys', RecipientEncryptedKeys())
475
+ )
476
+
477
+
478
+ class OtherRecipientInfo(univ.Sequence):
479
+ pass
480
+
481
+
482
+ OtherRecipientInfo.componentType = namedtype.NamedTypes(
483
+ namedtype.NamedType('oriType', univ.ObjectIdentifier()),
484
+ namedtype.NamedType('oriValue', univ.Any(),
485
+ openType=opentype.OpenType('oriType', otherRecipientInfoMap)
486
+ )
487
+ )
488
+
489
+
490
+ class RecipientInfo(univ.Choice):
491
+ pass
492
+
493
+
494
+ RecipientInfo.componentType = namedtype.NamedTypes(
495
+ namedtype.NamedType('ktri', KeyTransRecipientInfo()),
496
+ namedtype.NamedType('kari', KeyAgreeRecipientInfo().subtype(
497
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
498
+ namedtype.NamedType('kekri', KEKRecipientInfo().subtype(
499
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
500
+ namedtype.NamedType('pwri', PasswordRecipientInfo().subtype(
501
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
502
+ namedtype.NamedType('ori', OtherRecipientInfo().subtype(
503
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
504
+ )
505
+
506
+
507
+ class RecipientInfos(univ.SetOf):
508
+ pass
509
+
510
+
511
+ RecipientInfos.componentType = RecipientInfo()
512
+ RecipientInfos.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
513
+
514
+
515
+ class EnvelopedData(univ.Sequence):
516
+ pass
517
+
518
+
519
+ EnvelopedData.componentType = namedtype.NamedTypes(
520
+ namedtype.NamedType('version', CMSVersion()),
521
+ namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
522
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
523
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
524
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
525
+ namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
526
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
527
+ )
528
+
529
+
530
+ class DigestAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
531
+ pass
532
+
533
+
534
+ id_ct_contentInfo = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 6)
535
+
536
+ id_digestedData = _buildOid(1, 2, 840, 113549, 1, 7, 5)
537
+
538
+
539
+ class EncryptedData(univ.Sequence):
540
+ pass
541
+
542
+
543
+ EncryptedData.componentType = namedtype.NamedTypes(
544
+ namedtype.NamedType('version', CMSVersion()),
545
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
546
+ namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
547
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
548
+ )
549
+
550
+ id_messageDigest = _buildOid(1, 2, 840, 113549, 1, 9, 4)
551
+
552
+ id_signedData = _buildOid(1, 2, 840, 113549, 1, 7, 2)
553
+
554
+
555
+ class MessageAuthenticationCodeAlgorithm(rfc5280.AlgorithmIdentifier):
556
+ pass
557
+
558
+
559
+ class UnsignedAttributes(univ.SetOf):
560
+ pass
561
+
562
+
563
+ UnsignedAttributes.componentType = Attribute()
564
+ UnsignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
565
+
566
+
567
+ class SignerIdentifier(univ.Choice):
568
+ pass
569
+
570
+
571
+ SignerIdentifier.componentType = namedtype.NamedTypes(
572
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
573
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
574
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
575
+ )
576
+
577
+
578
+ class SignerInfo(univ.Sequence):
579
+ pass
580
+
581
+
582
+ SignerInfo.componentType = namedtype.NamedTypes(
583
+ namedtype.NamedType('version', CMSVersion()),
584
+ namedtype.NamedType('sid', SignerIdentifier()),
585
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
586
+ namedtype.OptionalNamedType('signedAttrs', SignedAttributes().subtype(
587
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
588
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
589
+ namedtype.NamedType('signature', SignatureValue()),
590
+ namedtype.OptionalNamedType('unsignedAttrs', UnsignedAttributes().subtype(
591
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
592
+ )
593
+
594
+
595
+ class SignerInfos(univ.SetOf):
596
+ pass
597
+
598
+
599
+ SignerInfos.componentType = SignerInfo()
600
+
601
+
602
+ class Countersignature(SignerInfo):
603
+ pass
604
+
605
+
606
+ class ContentInfo(univ.Sequence):
607
+ pass
608
+
609
+
610
+ ContentInfo.componentType = namedtype.NamedTypes(
611
+ namedtype.NamedType('contentType', ContentType()),
612
+ namedtype.NamedType('content', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)),
613
+ openType=opentype.OpenType('contentType', cmsContentTypesMap)
614
+ )
615
+ )
616
+
617
+
618
+ class EncapsulatedContentInfo(univ.Sequence):
619
+ pass
620
+
621
+
622
+ EncapsulatedContentInfo.componentType = namedtype.NamedTypes(
623
+ namedtype.NamedType('eContentType', ContentType()),
624
+ namedtype.OptionalNamedType('eContent', univ.OctetString().subtype(
625
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
626
+ )
627
+
628
+ id_countersignature = _buildOid(1, 2, 840, 113549, 1, 9, 6)
629
+
630
+ id_data = _buildOid(1, 2, 840, 113549, 1, 7, 1)
631
+
632
+
633
+ class MessageDigest(univ.OctetString):
634
+ pass
635
+
636
+
637
+ class AuthAttributes(univ.SetOf):
638
+ pass
639
+
640
+
641
+ AuthAttributes.componentType = Attribute()
642
+ AuthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
643
+
644
+
645
+ class Time(univ.Choice):
646
+ pass
647
+
648
+
649
+ Time.componentType = namedtype.NamedTypes(
650
+ namedtype.NamedType('utcTime', useful.UTCTime()),
651
+ namedtype.NamedType('generalTime', useful.GeneralizedTime())
652
+ )
653
+
654
+
655
+ class AuthenticatedData(univ.Sequence):
656
+ pass
657
+
658
+
659
+ AuthenticatedData.componentType = namedtype.NamedTypes(
660
+ namedtype.NamedType('version', CMSVersion()),
661
+ namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
662
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
663
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
664
+ namedtype.NamedType('macAlgorithm', MessageAuthenticationCodeAlgorithm()),
665
+ namedtype.OptionalNamedType('digestAlgorithm', DigestAlgorithmIdentifier().subtype(
666
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
667
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
668
+ namedtype.OptionalNamedType('authAttrs', AuthAttributes().subtype(
669
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
670
+ namedtype.NamedType('mac', MessageAuthenticationCode()),
671
+ namedtype.OptionalNamedType('unauthAttrs', UnauthAttributes().subtype(
672
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
673
+ )
674
+
675
+ id_contentType = _buildOid(1, 2, 840, 113549, 1, 9, 3)
676
+
677
+
678
+ class ExtendedCertificateOrCertificate(univ.Choice):
679
+ pass
680
+
681
+
682
+ ExtendedCertificateOrCertificate.componentType = namedtype.NamedTypes(
683
+ namedtype.NamedType('certificate', rfc5280.Certificate()),
684
+ namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
685
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
686
+ )
687
+
688
+
689
+ class Digest(univ.OctetString):
690
+ pass
691
+
692
+
693
+ class DigestedData(univ.Sequence):
694
+ pass
695
+
696
+
697
+ DigestedData.componentType = namedtype.NamedTypes(
698
+ namedtype.NamedType('version', CMSVersion()),
699
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
700
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
701
+ namedtype.NamedType('digest', Digest())
702
+ )
703
+
704
+ id_envelopedData = _buildOid(1, 2, 840, 113549, 1, 7, 3)
705
+
706
+
707
+ class DigestAlgorithmIdentifiers(univ.SetOf):
708
+ pass
709
+
710
+
711
+ DigestAlgorithmIdentifiers.componentType = DigestAlgorithmIdentifier()
712
+
713
+
714
+ class SignedData(univ.Sequence):
715
+ pass
716
+
717
+
718
+ SignedData.componentType = namedtype.NamedTypes(
719
+ namedtype.NamedType('version', CMSVersion()),
720
+ namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
721
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
722
+ namedtype.OptionalNamedType('certificates', CertificateSet().subtype(
723
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
724
+ namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
725
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
726
+ namedtype.NamedType('signerInfos', SignerInfos())
727
+ )
728
+
729
+ id_signingTime = _buildOid(1, 2, 840, 113549, 1, 9, 5)
730
+
731
+
732
+ class SigningTime(Time):
733
+ pass
734
+
735
+
736
+ id_ct_authData = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 2)
737
+
738
+
739
+ # CMS Content Type Map
740
+
741
+ _cmsContentTypesMapUpdate = {
742
+ id_ct_contentInfo: ContentInfo(),
743
+ id_data: univ.OctetString(),
744
+ id_signedData: SignedData(),
745
+ id_envelopedData: EnvelopedData(),
746
+ id_digestedData: DigestedData(),
747
+ id_encryptedData: EncryptedData(),
748
+ id_ct_authData: AuthenticatedData(),
749
+ }
750
+
751
+ cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
752
+
753
+
754
+ # CMS Attribute Map
755
+
756
+ _cmsAttributesMapUpdate = {
757
+ id_contentType: ContentType(),
758
+ id_messageDigest: MessageDigest(),
759
+ id_signingTime: SigningTime(),
760
+ id_countersignature: Countersignature(),
761
+ }
762
+
763
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)