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