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,578 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # CMS Advanced Electronic Signatures (CAdES)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc5126.txt
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import constraint
18
+ from pyasn1.type import namedtype
19
+ from pyasn1.type import opentype
20
+ from pyasn1.type import tag
21
+ from pyasn1.type import useful
22
+ from pyasn1.type import univ
23
+
24
+ from pyasn1_alt_modules import rfc5280
25
+ from pyasn1_alt_modules import rfc5652
26
+ from pyasn1_alt_modules import rfc5035
27
+ from pyasn1_alt_modules import rfc5755
28
+ from pyasn1_alt_modules import rfc6960
29
+ from pyasn1_alt_modules import rfc3161
30
+ from pyasn1_alt_modules import opentypemap
31
+
32
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
33
+
34
+ commitmentQualifierMap = opentypemap.get('commitmentQualifierMap')
35
+
36
+ sigQualifiersMap = opentypemap.get('sigQualifiersMap')
37
+
38
+ otherRevRefMap = opentypemap.get('otherRevRefMap')
39
+
40
+ otherRevValMap = opentypemap.get('otherRevValMap')
41
+
42
+ MAX = float('inf')
43
+
44
+
45
+ # Imports from RFC 5652
46
+
47
+ ContentInfo = rfc5652.ContentInfo
48
+
49
+ ContentType = rfc5652.ContentType
50
+
51
+ SignedData = rfc5652.SignedData
52
+
53
+ EncapsulatedContentInfo = rfc5652.EncapsulatedContentInfo
54
+
55
+ SignerInfo = rfc5652.SignerInfo
56
+
57
+ MessageDigest = rfc5652.MessageDigest
58
+
59
+ SigningTime = rfc5652.SigningTime
60
+
61
+ Countersignature = rfc5652.Countersignature
62
+
63
+ id_data = rfc5652.id_data
64
+
65
+ id_signedData = rfc5652.id_signedData
66
+
67
+ id_contentType= rfc5652.id_contentType
68
+
69
+ id_messageDigest = rfc5652.id_messageDigest
70
+
71
+ id_signingTime = rfc5652.id_signingTime
72
+
73
+ id_countersignature = rfc5652.id_countersignature
74
+
75
+
76
+ # Imports from RFC 5035
77
+
78
+ SigningCertificate = rfc5035.SigningCertificate
79
+
80
+ IssuerSerial = rfc5035.IssuerSerial
81
+
82
+ ContentReference = rfc5035.ContentReference
83
+
84
+ ContentIdentifier = rfc5035.ContentIdentifier
85
+
86
+ id_aa_contentReference = rfc5035.id_aa_contentReference
87
+
88
+ id_aa_contentIdentifier = rfc5035.id_aa_contentIdentifier
89
+
90
+ id_aa_signingCertificate = rfc5035.id_aa_signingCertificate
91
+
92
+ id_aa_signingCertificateV2 = rfc5035.id_aa_signingCertificateV2
93
+
94
+
95
+ # Imports from RFC 5280
96
+
97
+ Certificate = rfc5280.Certificate
98
+
99
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
100
+
101
+ CertificateList = rfc5280.CertificateList
102
+
103
+ Name = rfc5280.Name
104
+
105
+ Attribute = rfc5280.Attribute
106
+
107
+ GeneralNames = rfc5280.GeneralNames
108
+
109
+ GeneralName = rfc5280.GeneralName
110
+
111
+ PolicyInformation = rfc5280.PolicyInformation
112
+
113
+ DirectoryString = rfc5280.DirectoryString
114
+
115
+
116
+ # Imports from RFC 5755
117
+
118
+ AttributeCertificate = rfc5755.AttributeCertificate
119
+
120
+
121
+ # Imports from RFC 6960
122
+
123
+ BasicOCSPResponse = rfc6960.BasicOCSPResponse
124
+
125
+ ResponderID = rfc6960.ResponderID
126
+
127
+
128
+ # Imports from RFC 3161
129
+
130
+ TimeStampToken = rfc3161.TimeStampToken
131
+
132
+
133
+ # OID used referencing electronic signature mechanisms
134
+
135
+ id_etsi_es_IDUP_Mechanism_v1 = univ.ObjectIdentifier('0.4.0.1733.1.4.1')
136
+
137
+
138
+ # OtherSigningCertificate - deprecated
139
+
140
+ id_aa_ets_otherSigCert = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.19')
141
+
142
+
143
+ class OtherHashValue(univ.OctetString):
144
+ pass
145
+
146
+
147
+ class OtherHashAlgAndValue(univ.Sequence):
148
+ componentType = namedtype.NamedTypes(
149
+ namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
150
+ namedtype.NamedType('hashValue', OtherHashValue())
151
+ )
152
+
153
+
154
+ class OtherHash(univ.Choice):
155
+ componentType = namedtype.NamedTypes(
156
+ namedtype.NamedType('sha1Hash', OtherHashValue()),
157
+ namedtype.NamedType('otherHash', OtherHashAlgAndValue())
158
+ )
159
+
160
+
161
+ class OtherCertID(univ.Sequence):
162
+ componentType = namedtype.NamedTypes(
163
+ namedtype.NamedType('otherCertHash', OtherHash()),
164
+ namedtype.OptionalNamedType('issuerSerial', IssuerSerial())
165
+ )
166
+
167
+
168
+ class OtherSigningCertificate(univ.Sequence):
169
+ componentType = namedtype.NamedTypes(
170
+ namedtype.NamedType('certs',
171
+ univ.SequenceOf(componentType=OtherCertID())),
172
+ namedtype.OptionalNamedType('policies',
173
+ univ.SequenceOf(componentType=PolicyInformation()))
174
+ )
175
+
176
+
177
+ # Signature Policy Identifier
178
+
179
+ id_aa_ets_sigPolicyId = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.15')
180
+
181
+
182
+ class SigPolicyId(univ.ObjectIdentifier):
183
+ pass
184
+
185
+
186
+ class SigPolicyHash(OtherHashAlgAndValue):
187
+ pass
188
+
189
+
190
+ class SigPolicyQualifierId(univ.ObjectIdentifier):
191
+ pass
192
+
193
+
194
+ class SigPolicyQualifierInfo(univ.Sequence):
195
+ componentType = namedtype.NamedTypes(
196
+ namedtype.NamedType('sigPolicyQualifierId', SigPolicyQualifierId()),
197
+ namedtype.NamedType('sigQualifier', univ.Any(),
198
+ openType=opentype.OpenType('sigPolicyQualifierId', sigQualifiersMap))
199
+ )
200
+
201
+
202
+ class SignaturePolicyId(univ.Sequence):
203
+ componentType = namedtype.NamedTypes(
204
+ namedtype.NamedType('sigPolicyId', SigPolicyId()),
205
+ namedtype.NamedType('sigPolicyHash', SigPolicyHash()),
206
+ namedtype.OptionalNamedType('sigPolicyQualifiers',
207
+ univ.SequenceOf(componentType=SigPolicyQualifierInfo()).subtype(
208
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
209
+ )
210
+
211
+
212
+ class SignaturePolicyImplied(univ.Null):
213
+ pass
214
+
215
+
216
+ class SignaturePolicy(univ.Choice):
217
+ componentType = namedtype.NamedTypes(
218
+ namedtype.NamedType('signaturePolicyId', SignaturePolicyId()),
219
+ namedtype.NamedType('signaturePolicyImplied', SignaturePolicyImplied())
220
+ )
221
+
222
+
223
+ id_spq_ets_unotice = univ.ObjectIdentifier('1.2.840.113549.1.9.16.5.2')
224
+
225
+
226
+ class DisplayText(univ.Choice):
227
+ componentType = namedtype.NamedTypes(
228
+ namedtype.NamedType('visibleString', char.VisibleString().subtype(
229
+ subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
230
+ namedtype.NamedType('bmpString', char.BMPString().subtype(
231
+ subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
232
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
233
+ subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
234
+ )
235
+
236
+
237
+ class NoticeReference(univ.Sequence):
238
+ componentType = namedtype.NamedTypes(
239
+ namedtype.NamedType('organization', DisplayText()),
240
+ namedtype.NamedType('noticeNumbers',
241
+ univ.SequenceOf(componentType=univ.Integer()))
242
+ )
243
+
244
+ class SPUserNotice(univ.Sequence):
245
+ componentType = namedtype.NamedTypes(
246
+ namedtype.OptionalNamedType('noticeRef', NoticeReference()),
247
+ namedtype.OptionalNamedType('explicitText', DisplayText())
248
+ )
249
+
250
+
251
+ noticeToUser = SigPolicyQualifierInfo()
252
+ noticeToUser['sigPolicyQualifierId'] = id_spq_ets_unotice
253
+ noticeToUser['sigQualifier'] = SPUserNotice()
254
+
255
+
256
+ id_spq_ets_uri = univ.ObjectIdentifier('1.2.840.113549.1.9.16.5.1')
257
+
258
+
259
+ class SPuri(char.IA5String):
260
+ pass
261
+
262
+
263
+ pointerToSigPolSpec = SigPolicyQualifierInfo()
264
+ pointerToSigPolSpec['sigPolicyQualifierId'] = id_spq_ets_uri
265
+ pointerToSigPolSpec['sigQualifier'] = SPuri()
266
+
267
+
268
+ # Commitment Type
269
+
270
+ id_aa_ets_commitmentType = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.16')
271
+
272
+
273
+ class CommitmentTypeIdentifier(univ.ObjectIdentifier):
274
+ pass
275
+
276
+
277
+ class CommitmentTypeQualifier(univ.Sequence):
278
+ componentType = namedtype.NamedTypes(
279
+ namedtype.NamedType('commitmentTypeIdentifier',
280
+ CommitmentTypeIdentifier()),
281
+ namedtype.NamedType('qualifier', univ.Any(),
282
+ openType=opentype.OpenType('commitmentTypeIdentifier',
283
+ commitmentQualifierMap))
284
+ )
285
+
286
+
287
+ class CommitmentTypeIndication(univ.Sequence):
288
+ componentType = namedtype.NamedTypes(
289
+ namedtype.NamedType('commitmentTypeId', CommitmentTypeIdentifier()),
290
+ namedtype.OptionalNamedType('commitmentTypeQualifier',
291
+ univ.SequenceOf(componentType=CommitmentTypeQualifier()).subtype(
292
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
293
+ )
294
+
295
+
296
+ id_cti_ets_proofOfOrigin = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.1')
297
+
298
+ id_cti_ets_proofOfReceipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.2')
299
+
300
+ id_cti_ets_proofOfDelivery = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.3')
301
+
302
+ id_cti_ets_proofOfSender = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.4')
303
+
304
+ id_cti_ets_proofOfApproval = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.5')
305
+
306
+ id_cti_ets_proofOfCreation = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.6')
307
+
308
+
309
+ # Signer Location
310
+
311
+ id_aa_ets_signerLocation = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.17')
312
+
313
+
314
+ class PostalAddress(univ.SequenceOf):
315
+ componentType = DirectoryString()
316
+ subtypeSpec = constraint.ValueSizeConstraint(1, 6)
317
+
318
+
319
+ class SignerLocation(univ.Sequence):
320
+ componentType = namedtype.NamedTypes(
321
+ namedtype.OptionalNamedType('countryName',
322
+ DirectoryString().subtype(explicitTag=tag.Tag(
323
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
324
+ namedtype.OptionalNamedType('localityName',
325
+ DirectoryString().subtype(explicitTag=tag.Tag(
326
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
327
+ namedtype.OptionalNamedType('postalAdddress',
328
+ PostalAddress().subtype(explicitTag=tag.Tag(
329
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
330
+ )
331
+
332
+
333
+ # Signature Timestamp
334
+
335
+ id_aa_signatureTimeStampToken = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.14')
336
+
337
+
338
+ class SignatureTimeStampToken(TimeStampToken):
339
+ pass
340
+
341
+
342
+ # Content Timestamp
343
+
344
+ id_aa_ets_contentTimestamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.20')
345
+
346
+
347
+ class ContentTimestamp(TimeStampToken):
348
+ pass
349
+
350
+
351
+ # Signer Attributes
352
+
353
+ id_aa_ets_signerAttr = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.18')
354
+
355
+
356
+ class ClaimedAttributes(univ.SequenceOf):
357
+ componentType = Attribute()
358
+
359
+
360
+ class CertifiedAttributes(AttributeCertificate):
361
+ pass
362
+
363
+
364
+ class SignerAttribute(univ.SequenceOf):
365
+ componentType = univ.Choice(componentType=namedtype.NamedTypes(
366
+ namedtype.NamedType('claimedAttributes',
367
+ ClaimedAttributes().subtype(explicitTag=tag.Tag(
368
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
369
+ namedtype.NamedType('certifiedAttributes',
370
+ CertifiedAttributes().subtype(explicitTag=tag.Tag(
371
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
372
+ ))
373
+
374
+
375
+ # Complete Certificate Refs
376
+
377
+ id_aa_ets_certificateRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.21')
378
+
379
+
380
+ class CompleteCertificateRefs(univ.SequenceOf):
381
+ componentType = OtherCertID()
382
+
383
+
384
+ # Complete Revocation Refs
385
+
386
+ id_aa_ets_revocationRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.22')
387
+
388
+
389
+ class CrlIdentifier(univ.Sequence):
390
+ componentType = namedtype.NamedTypes(
391
+ namedtype.NamedType('crlissuer', Name()),
392
+ namedtype.NamedType('crlIssuedTime', useful.UTCTime()),
393
+ namedtype.OptionalNamedType('crlNumber', univ.Integer())
394
+ )
395
+
396
+
397
+ class CrlValidatedID(univ.Sequence):
398
+ componentType = namedtype.NamedTypes(
399
+ namedtype.NamedType('crlHash', OtherHash()),
400
+ namedtype.OptionalNamedType('crlIdentifier', CrlIdentifier())
401
+ )
402
+
403
+
404
+ class CRLListID(univ.Sequence):
405
+ componentType = namedtype.NamedTypes(
406
+ namedtype.NamedType('crls',
407
+ univ.SequenceOf(componentType=CrlValidatedID()))
408
+ )
409
+
410
+
411
+ class OcspIdentifier(univ.Sequence):
412
+ componentType = namedtype.NamedTypes(
413
+ namedtype.NamedType('ocspResponderID', ResponderID()),
414
+ namedtype.NamedType('producedAt', useful.GeneralizedTime())
415
+ )
416
+
417
+
418
+ class OcspResponsesID(univ.Sequence):
419
+ componentType = namedtype.NamedTypes(
420
+ namedtype.NamedType('ocspIdentifier', OcspIdentifier()),
421
+ namedtype.OptionalNamedType('ocspRepHash', OtherHash())
422
+ )
423
+
424
+
425
+ class OcspListID(univ.Sequence):
426
+ componentType = namedtype.NamedTypes(
427
+ namedtype.NamedType('ocspResponses',
428
+ univ.SequenceOf(componentType=OcspResponsesID()))
429
+ )
430
+
431
+
432
+ class OtherRevRefType(univ.ObjectIdentifier):
433
+ pass
434
+
435
+
436
+ class OtherRevRefs(univ.Sequence):
437
+ componentType = namedtype.NamedTypes(
438
+ namedtype.NamedType('otherRevRefType', OtherRevRefType()),
439
+ namedtype.NamedType('otherRevRefs', univ.Any(),
440
+ openType=opentype.OpenType('otherRevRefType', otherRevRefMap))
441
+ )
442
+
443
+
444
+ class CrlOcspRef(univ.Sequence):
445
+ componentType = namedtype.NamedTypes(
446
+ namedtype.OptionalNamedType('crlids',
447
+ CRLListID().subtype(explicitTag=tag.Tag(
448
+ tag.tagClassContext, tag.tagFormatConstructed, 0))),
449
+ namedtype.OptionalNamedType('ocspids',
450
+ OcspListID().subtype(explicitTag=tag.Tag(
451
+ tag.tagClassContext, tag.tagFormatConstructed, 1))),
452
+ namedtype.OptionalNamedType('otherRev',
453
+ OtherRevRefs().subtype(explicitTag=tag.Tag(
454
+ tag.tagClassContext, tag.tagFormatConstructed, 2)))
455
+ )
456
+
457
+
458
+ class CompleteRevocationRefs(univ.SequenceOf):
459
+ componentType = CrlOcspRef()
460
+
461
+
462
+ # Certificate Values
463
+
464
+ id_aa_ets_certValues = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.23')
465
+
466
+
467
+ class CertificateValues(univ.SequenceOf):
468
+ componentType = Certificate()
469
+
470
+
471
+ # Certificate Revocation Values
472
+
473
+ id_aa_ets_revocationValues = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.24')
474
+
475
+
476
+ class OtherRevValType(univ.ObjectIdentifier):
477
+ pass
478
+
479
+
480
+ class OtherRevVals(univ.Sequence):
481
+ componentType = namedtype.NamedTypes(
482
+ namedtype.NamedType('otherRevValType', OtherRevValType()),
483
+ namedtype.NamedType('otherRevVals', univ.Any(),
484
+ openType=opentype.OpenType('otherRevValType', otherRevValMap))
485
+ )
486
+
487
+
488
+ class RevocationValues(univ.Sequence):
489
+ componentType = namedtype.NamedTypes(
490
+ namedtype.OptionalNamedType('crlVals',
491
+ univ.SequenceOf(componentType=CertificateList()).subtype(
492
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
493
+ namedtype.OptionalNamedType('ocspVals',
494
+ univ.SequenceOf(componentType=BasicOCSPResponse()).subtype(
495
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
496
+ namedtype.OptionalNamedType('otherRevVals',
497
+ OtherRevVals().subtype(explicitTag=tag.Tag(
498
+ tag.tagClassContext, tag.tagFormatConstructed, 2)))
499
+ )
500
+
501
+
502
+ # CAdES-C Timestamp
503
+
504
+ id_aa_ets_escTimeStamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.25')
505
+
506
+
507
+ class ESCTimeStampToken(TimeStampToken):
508
+ pass
509
+
510
+
511
+ # Time-Stamped Certificates and CRLs
512
+
513
+ id_aa_ets_certCRLTimestamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.26')
514
+
515
+
516
+ class TimestampedCertsCRLs(TimeStampToken):
517
+ pass
518
+
519
+
520
+ # Archive Timestamp
521
+
522
+ id_aa_ets_archiveTimestampV2 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.48')
523
+
524
+
525
+ class ArchiveTimeStampToken(TimeStampToken):
526
+ pass
527
+
528
+
529
+ # Attribute certificate references
530
+
531
+ id_aa_ets_attrCertificateRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.44')
532
+
533
+
534
+ class AttributeCertificateRefs(univ.SequenceOf):
535
+ componentType = OtherCertID()
536
+
537
+
538
+ # Attribute revocation references
539
+
540
+ id_aa_ets_attrRevocationRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.45')
541
+
542
+
543
+ class AttributeRevocationRefs(univ.SequenceOf):
544
+ componentType = CrlOcspRef()
545
+
546
+
547
+ # Update the sigQualifiersMap
548
+
549
+ _sigQualifiersMapUpdate = {
550
+ id_spq_ets_unotice: SPUserNotice(),
551
+ id_spq_ets_uri: SPuri(),
552
+ }
553
+
554
+ sigQualifiersMap.update(_sigQualifiersMapUpdate)
555
+
556
+
557
+ # Update the CMS Attribute Map
558
+
559
+ _cmsAttributesMapUpdate = {
560
+ id_aa_ets_otherSigCert: OtherSigningCertificate(),
561
+ id_aa_ets_sigPolicyId: SignaturePolicy(),
562
+ id_aa_ets_commitmentType: CommitmentTypeIndication(),
563
+ id_aa_ets_signerLocation: SignerLocation(),
564
+ id_aa_signatureTimeStampToken: SignatureTimeStampToken(),
565
+ id_aa_ets_contentTimestamp: ContentTimestamp(),
566
+ id_aa_ets_signerAttr: SignerAttribute(),
567
+ id_aa_ets_certificateRefs: CompleteCertificateRefs(),
568
+ id_aa_ets_revocationRefs: CompleteRevocationRefs(),
569
+ id_aa_ets_certValues: CertificateValues(),
570
+ id_aa_ets_revocationValues: RevocationValues(),
571
+ id_aa_ets_escTimeStamp: ESCTimeStampToken(),
572
+ id_aa_ets_certCRLTimestamp: TimestampedCertsCRLs(),
573
+ id_aa_ets_archiveTimestampV2: ArchiveTimeStampToken(),
574
+ id_aa_ets_attrCertificateRefs: AttributeCertificateRefs(),
575
+ id_aa_ets_attrRevocationRefs: AttributeRevocationRefs(),
576
+ }
577
+
578
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)
@@ -0,0 +1,73 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Modified by Russ Housley to import from RFC 5280 instead of
5
+ # RFC 2251 and RFC 2459.
6
+ #
7
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
8
+ # Copyright (c) 2021-2024, Vigil Security, LLC
9
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
10
+ #
11
+ # PKCS#8 syntax
12
+ #
13
+ # ASN.1 source from:
14
+ # http://tools.ietf.org/html/rfc5208
15
+ #
16
+ # Sample captures could be obtained with "openssl pkcs8 -topk8" command
17
+ #
18
+ from pyasn1.type import namedtype
19
+ from pyasn1.type import namedval
20
+ from pyasn1.type import tag
21
+ from pyasn1.type import univ
22
+
23
+ from pyasn1_alt_modules import rfc5280
24
+
25
+
26
+ # Imports from RFC 5280
27
+
28
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
29
+
30
+ Attribute = rfc5280.Attribute
31
+
32
+
33
+ # PKCS#8
34
+
35
+ class KeyEncryptionAlgorithms(AlgorithmIdentifier):
36
+ pass
37
+
38
+
39
+ class PrivateKeyAlgorithms(AlgorithmIdentifier):
40
+ pass
41
+
42
+
43
+ class EncryptedData(univ.OctetString):
44
+ pass
45
+
46
+
47
+ class EncryptedPrivateKeyInfo(univ.Sequence):
48
+ componentType = namedtype.NamedTypes(
49
+ namedtype.NamedType('encryptionAlgorithm', AlgorithmIdentifier()),
50
+ namedtype.NamedType('encryptedData', EncryptedData())
51
+ )
52
+
53
+
54
+ class PrivateKey(univ.OctetString):
55
+ pass
56
+
57
+
58
+ class Attributes(univ.SetOf):
59
+ componentType = Attribute()
60
+
61
+
62
+ class Version(univ.Integer):
63
+ namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
64
+
65
+
66
+ class PrivateKeyInfo(univ.Sequence):
67
+ componentType = namedtype.NamedTypes(
68
+ namedtype.NamedType('version', Version()),
69
+ namedtype.NamedType('privateKeyAlgorithm', AlgorithmIdentifier()),
70
+ namedtype.NamedType('privateKey', PrivateKey()),
71
+ namedtype.OptionalNamedType('attributes', Attributes().subtype(
72
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
73
+ )