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,739 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # NSA's CMS Key Management Attributes
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc7906.txt
14
+ # https://www.rfc-editor.org/errata/eid5850
15
+ #
16
+
17
+ from pyasn1.type import char
18
+ from pyasn1.type import constraint
19
+ from pyasn1.type import namedtype
20
+ from pyasn1.type import namedval
21
+ from pyasn1.type import tag
22
+ from pyasn1.type import univ
23
+
24
+ from pyasn1_alt_modules import rfc2634
25
+ from pyasn1_alt_modules import rfc4108
26
+ from pyasn1_alt_modules import rfc5280
27
+ from pyasn1_alt_modules import rfc5652
28
+ from pyasn1_alt_modules import rfc6010
29
+ from pyasn1_alt_modules import rfc6019
30
+ from pyasn1_alt_modules import rfc7191
31
+ from pyasn1_alt_modules import opentypemap
32
+
33
+ cmsAttributesMap = opentypemap.get('cmsAttributesMap')
34
+
35
+ MAX = float('inf')
36
+
37
+
38
+ # Imports From RFC 2634
39
+
40
+ id_aa_contentHint = rfc2634.id_aa_contentHint
41
+
42
+ ContentHints = rfc2634.ContentHints
43
+
44
+ id_aa_securityLabel = rfc2634.id_aa_securityLabel
45
+
46
+ SecurityPolicyIdentifier = rfc2634.SecurityPolicyIdentifier
47
+
48
+ SecurityClassification = rfc2634.SecurityClassification
49
+
50
+ ESSPrivacyMark = rfc2634.ESSPrivacyMark
51
+
52
+ SecurityCategories= rfc2634.SecurityCategories
53
+
54
+ ESSSecurityLabel = rfc2634.ESSSecurityLabel
55
+
56
+
57
+ # Imports From RFC 4108
58
+
59
+ id_aa_communityIdentifiers = rfc4108.id_aa_communityIdentifiers
60
+
61
+ CommunityIdentifier = rfc4108.CommunityIdentifier
62
+
63
+ CommunityIdentifiers = rfc4108.CommunityIdentifiers
64
+
65
+
66
+ # Imports From RFC 5280
67
+
68
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
69
+
70
+ Name = rfc5280.Name
71
+
72
+ Certificate = rfc5280.Certificate
73
+
74
+ GeneralNames = rfc5280.GeneralNames
75
+
76
+ GeneralName = rfc5280.GeneralName
77
+
78
+
79
+ SubjectInfoAccessSyntax = rfc5280.SubjectInfoAccessSyntax
80
+
81
+ id_pkix = rfc5280.id_pkix
82
+
83
+ id_pe = rfc5280.id_pe
84
+
85
+ id_pe_subjectInfoAccess = rfc5280.id_pe_subjectInfoAccess
86
+
87
+
88
+ # Imports From RFC 6010
89
+
90
+ CMSContentConstraints = rfc6010.CMSContentConstraints
91
+
92
+
93
+ # Imports From RFC 6019
94
+
95
+ BinaryTime = rfc6019.BinaryTime
96
+
97
+ id_aa_binarySigningTime = rfc6019.id_aa_binarySigningTime
98
+
99
+ BinarySigningTime = rfc6019.BinarySigningTime
100
+
101
+
102
+ # Imports From RFC 5652
103
+
104
+ Attribute = rfc5652.Attribute
105
+
106
+ CertificateSet = rfc5652.CertificateSet
107
+
108
+ CertificateChoices = rfc5652.CertificateChoices
109
+
110
+ id_contentType = rfc5652.id_contentType
111
+
112
+ ContentType = rfc5652.ContentType
113
+
114
+ id_messageDigest = rfc5652.id_messageDigest
115
+
116
+ MessageDigest = rfc5652.MessageDigest
117
+
118
+
119
+ # Imports From RFC 7191
120
+
121
+ SIREntityName = rfc7191.SIREntityName
122
+
123
+ id_aa_KP_keyPkgIdAndReceiptReq = rfc7191.id_aa_KP_keyPkgIdAndReceiptReq
124
+
125
+ KeyPkgIdentifierAndReceiptReq = rfc7191.KeyPkgIdentifierAndReceiptReq
126
+
127
+
128
+ # Key Province Attribute
129
+
130
+ id_aa_KP_keyProvinceV2 = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.71')
131
+
132
+
133
+ class KeyProvinceV2(univ.ObjectIdentifier):
134
+ pass
135
+
136
+
137
+ aa_keyProvince_v2 = Attribute()
138
+ aa_keyProvince_v2['attrType'] = id_aa_KP_keyProvinceV2
139
+ aa_keyProvince_v2['attrValues'][0] = KeyProvinceV2()
140
+
141
+
142
+ # Manifest Attribute
143
+
144
+ id_aa_KP_manifest = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.72')
145
+
146
+
147
+ class ShortTitle(char.PrintableString):
148
+ pass
149
+
150
+
151
+ class Manifest(univ.SequenceOf):
152
+ pass
153
+
154
+ Manifest.componentType = ShortTitle()
155
+ Manifest.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
156
+
157
+
158
+ aa_manifest = Attribute()
159
+ aa_manifest['attrType'] = id_aa_KP_manifest
160
+ aa_manifest['attrValues'][0] = Manifest()
161
+
162
+
163
+ # Key Algorithm Attribute
164
+
165
+ id_kma_keyAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.1')
166
+
167
+
168
+ class KeyAlgorithm(univ.Sequence):
169
+ pass
170
+
171
+ KeyAlgorithm.componentType = namedtype.NamedTypes(
172
+ namedtype.NamedType('keyAlg', univ.ObjectIdentifier()),
173
+ namedtype.OptionalNamedType('checkWordAlg', univ.ObjectIdentifier().subtype(
174
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
175
+ namedtype.OptionalNamedType('crcAlg', univ.ObjectIdentifier().subtype(
176
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
177
+ )
178
+
179
+
180
+ aa_keyAlgorithm = Attribute()
181
+ aa_keyAlgorithm['attrType'] = id_kma_keyAlgorithm
182
+ aa_keyAlgorithm['attrValues'][0] = KeyAlgorithm()
183
+
184
+
185
+ # User Certificate Attribute
186
+
187
+ id_at_userCertificate = univ.ObjectIdentifier('2.5.4.36')
188
+
189
+
190
+ aa_userCertificate = Attribute()
191
+ aa_userCertificate['attrType'] = id_at_userCertificate
192
+ aa_userCertificate['attrValues'][0] = Certificate()
193
+
194
+
195
+ # Key Package Receivers Attribute
196
+
197
+ id_kma_keyPkgReceiversV2 = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.16')
198
+
199
+
200
+ class KeyPkgReceiver(univ.Choice):
201
+ pass
202
+
203
+ KeyPkgReceiver.componentType = namedtype.NamedTypes(
204
+ namedtype.NamedType('sirEntity', SIREntityName().subtype(
205
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
206
+ namedtype.NamedType('community', CommunityIdentifier().subtype(
207
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
208
+ )
209
+
210
+
211
+ class KeyPkgReceiversV2(univ.SequenceOf):
212
+ pass
213
+
214
+ KeyPkgReceiversV2.componentType = KeyPkgReceiver()
215
+ KeyPkgReceiversV2.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
216
+
217
+
218
+ aa_keyPackageReceivers_v2 = Attribute()
219
+ aa_keyPackageReceivers_v2['attrType'] = id_kma_keyPkgReceiversV2
220
+ aa_keyPackageReceivers_v2['attrValues'][0] = KeyPkgReceiversV2()
221
+
222
+
223
+ # TSEC Nomenclature Attribute
224
+
225
+ id_kma_TSECNomenclature = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.3')
226
+
227
+
228
+ class CharEdition(char.PrintableString):
229
+ pass
230
+
231
+
232
+ class CharEditionRange(univ.Sequence):
233
+ pass
234
+
235
+ CharEditionRange.componentType = namedtype.NamedTypes(
236
+ namedtype.NamedType('firstCharEdition', CharEdition()),
237
+ namedtype.NamedType('lastCharEdition', CharEdition())
238
+ )
239
+
240
+
241
+ class NumEdition(univ.Integer):
242
+ pass
243
+
244
+ NumEdition.subtypeSpec = constraint.ValueRangeConstraint(0, 308915776)
245
+
246
+
247
+ class NumEditionRange(univ.Sequence):
248
+ pass
249
+
250
+ NumEditionRange.componentType = namedtype.NamedTypes(
251
+ namedtype.NamedType('firstNumEdition', NumEdition()),
252
+ namedtype.NamedType('lastNumEdition', NumEdition())
253
+ )
254
+
255
+
256
+ class EditionID(univ.Choice):
257
+ pass
258
+
259
+ EditionID.componentType = namedtype.NamedTypes(
260
+ namedtype.NamedType('char', univ.Choice(componentType=namedtype.NamedTypes(
261
+ namedtype.NamedType('charEdition', CharEdition().subtype(
262
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
263
+ namedtype.NamedType('charEditionRange', CharEditionRange().subtype(
264
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
265
+ ))
266
+ ),
267
+ namedtype.NamedType('num', univ.Choice(componentType=namedtype.NamedTypes(
268
+ namedtype.NamedType('numEdition', NumEdition().subtype(
269
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
270
+ namedtype.NamedType('numEditionRange', NumEditionRange().subtype(
271
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
272
+ ))
273
+ )
274
+ )
275
+
276
+
277
+ class Register(univ.Integer):
278
+ pass
279
+
280
+ Register.subtypeSpec = constraint.ValueRangeConstraint(0, 2147483647)
281
+
282
+
283
+ class RegisterRange(univ.Sequence):
284
+ pass
285
+
286
+ RegisterRange.componentType = namedtype.NamedTypes(
287
+ namedtype.NamedType('firstRegister', Register()),
288
+ namedtype.NamedType('lastRegister', Register())
289
+ )
290
+
291
+
292
+ class RegisterID(univ.Choice):
293
+ pass
294
+
295
+ RegisterID.componentType = namedtype.NamedTypes(
296
+ namedtype.NamedType('register', Register().subtype(
297
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
298
+ namedtype.NamedType('registerRange', RegisterRange().subtype(
299
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)))
300
+ )
301
+
302
+
303
+ class SegmentNumber(univ.Integer):
304
+ pass
305
+
306
+ SegmentNumber.subtypeSpec = constraint.ValueRangeConstraint(1, 127)
307
+
308
+
309
+ class SegmentRange(univ.Sequence):
310
+ pass
311
+
312
+ SegmentRange.componentType = namedtype.NamedTypes(
313
+ namedtype.NamedType('firstSegment', SegmentNumber()),
314
+ namedtype.NamedType('lastSegment', SegmentNumber())
315
+ )
316
+
317
+
318
+ class SegmentID(univ.Choice):
319
+ pass
320
+
321
+ SegmentID.componentType = namedtype.NamedTypes(
322
+ namedtype.NamedType('segmentNumber', SegmentNumber().subtype(
323
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
324
+ namedtype.NamedType('segmentRange', SegmentRange().subtype(
325
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)))
326
+ )
327
+
328
+
329
+ class TSECNomenclature(univ.Sequence):
330
+ pass
331
+
332
+ TSECNomenclature.componentType = namedtype.NamedTypes(
333
+ namedtype.NamedType('shortTitle', ShortTitle()),
334
+ namedtype.OptionalNamedType('editionID', EditionID()),
335
+ namedtype.OptionalNamedType('registerID', RegisterID()),
336
+ namedtype.OptionalNamedType('segmentID', SegmentID())
337
+ )
338
+
339
+
340
+ aa_tsecNomenclature = Attribute()
341
+ aa_tsecNomenclature['attrType'] = id_kma_TSECNomenclature
342
+ aa_tsecNomenclature['attrValues'][0] = TSECNomenclature()
343
+
344
+
345
+ # Key Purpose Attribute
346
+
347
+ id_kma_keyPurpose = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.13')
348
+
349
+
350
+ class KeyPurpose(univ.Enumerated):
351
+ pass
352
+
353
+ KeyPurpose.namedValues = namedval.NamedValues(
354
+ ('n-a', 0),
355
+ ('a', 65),
356
+ ('b', 66),
357
+ ('l', 76),
358
+ ('m', 77),
359
+ ('r', 82),
360
+ ('s', 83),
361
+ ('t', 84),
362
+ ('v', 86),
363
+ ('x', 88),
364
+ ('z', 90)
365
+ )
366
+
367
+
368
+ aa_keyPurpose = Attribute()
369
+ aa_keyPurpose['attrType'] = id_kma_keyPurpose
370
+ aa_keyPurpose['attrValues'][0] = KeyPurpose()
371
+
372
+
373
+ # Key Use Attribute
374
+
375
+ id_kma_keyUse = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.14')
376
+
377
+
378
+ class KeyUse(univ.Enumerated):
379
+ pass
380
+
381
+ KeyUse.namedValues = namedval.NamedValues(
382
+ ('n-a', 0),
383
+ ('ffk', 1),
384
+ ('kek', 2),
385
+ ('kpk', 3),
386
+ ('msk', 4),
387
+ ('qkek', 5),
388
+ ('tek', 6),
389
+ ('tsk', 7),
390
+ ('trkek', 8),
391
+ ('nfk', 9),
392
+ ('effk', 10),
393
+ ('ebfk', 11),
394
+ ('aek', 12),
395
+ ('wod', 13),
396
+ ('kesk', 246),
397
+ ('eik', 247),
398
+ ('ask', 248),
399
+ ('kmk', 249),
400
+ ('rsk', 250),
401
+ ('csk', 251),
402
+ ('sak', 252),
403
+ ('rgk', 253),
404
+ ('cek', 254),
405
+ ('exk', 255)
406
+ )
407
+
408
+
409
+ aa_keyUse = Attribute()
410
+ aa_keyPurpose['attrType'] = id_kma_keyUse
411
+ aa_keyPurpose['attrValues'][0] = KeyUse()
412
+
413
+
414
+ # Transport Key Attribute
415
+
416
+ id_kma_transportKey = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.15')
417
+
418
+
419
+ class TransOp(univ.Enumerated):
420
+ pass
421
+
422
+ TransOp.namedValues = namedval.NamedValues(
423
+ ('transport', 1),
424
+ ('operational', 2)
425
+ )
426
+
427
+
428
+ aa_transportKey = Attribute()
429
+ aa_transportKey['attrType'] = id_kma_transportKey
430
+ aa_transportKey['attrValues'][0] = TransOp()
431
+
432
+
433
+ # Key Distribution Period Attribute
434
+
435
+ id_kma_keyDistPeriod = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.5')
436
+
437
+
438
+ class KeyDistPeriod(univ.Sequence):
439
+ pass
440
+
441
+ KeyDistPeriod.componentType = namedtype.NamedTypes(
442
+ namedtype.OptionalNamedType('doNotDistBefore', BinaryTime().subtype(
443
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
444
+ namedtype.NamedType('doNotDistAfter', BinaryTime())
445
+ )
446
+
447
+
448
+ aa_keyDistributionPeriod = Attribute()
449
+ aa_keyDistributionPeriod['attrType'] = id_kma_keyDistPeriod
450
+ aa_keyDistributionPeriod['attrValues'][0] = KeyDistPeriod()
451
+
452
+
453
+ # Key Validity Period Attribute
454
+
455
+ id_kma_keyValidityPeriod = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.6')
456
+
457
+
458
+ class KeyValidityPeriod(univ.Sequence):
459
+ pass
460
+
461
+ KeyValidityPeriod.componentType = namedtype.NamedTypes(
462
+ namedtype.NamedType('doNotUseBefore', BinaryTime()),
463
+ namedtype.OptionalNamedType('doNotUseAfter', BinaryTime())
464
+ )
465
+
466
+
467
+ aa_keyValidityPeriod = Attribute()
468
+ aa_keyValidityPeriod['attrType'] = id_kma_keyValidityPeriod
469
+ aa_keyValidityPeriod['attrValues'][0] = KeyValidityPeriod()
470
+
471
+
472
+ # Key Duration Attribute
473
+
474
+ id_kma_keyDuration = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.7')
475
+
476
+
477
+ ub_KeyDuration_months = univ.Integer(72)
478
+
479
+ ub_KeyDuration_hours = univ.Integer(96)
480
+
481
+ ub_KeyDuration_days = univ.Integer(732)
482
+
483
+ ub_KeyDuration_weeks = univ.Integer(104)
484
+
485
+ ub_KeyDuration_years = univ.Integer(100)
486
+
487
+
488
+ class KeyDuration(univ.Choice):
489
+ pass
490
+
491
+ KeyDuration.componentType = namedtype.NamedTypes(
492
+ namedtype.NamedType('hours', univ.Integer().subtype(
493
+ subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_hours)).subtype(
494
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
495
+ namedtype.NamedType('days', univ.Integer().subtype(
496
+ subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_days))),
497
+ namedtype.NamedType('weeks', univ.Integer().subtype(
498
+ subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_weeks)).subtype(
499
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
500
+ namedtype.NamedType('months', univ.Integer().subtype(
501
+ subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_months)).subtype(
502
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
503
+ namedtype.NamedType('years', univ.Integer().subtype(
504
+ subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_years)).subtype(
505
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
506
+ )
507
+
508
+
509
+ aa_keyDurationPeriod = Attribute()
510
+ aa_keyDurationPeriod['attrType'] = id_kma_keyDuration
511
+ aa_keyDurationPeriod['attrValues'][0] = KeyDuration()
512
+
513
+
514
+ # Classification Attribute
515
+
516
+ id_aa_KP_classification = univ.ObjectIdentifier(id_aa_securityLabel)
517
+
518
+
519
+ id_enumeratedPermissiveAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.1')
520
+
521
+ id_enumeratedRestrictiveAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.4')
522
+
523
+ id_informativeAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.3')
524
+
525
+
526
+ class SecurityAttribute(univ.Integer):
527
+ pass
528
+
529
+ SecurityAttribute.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
530
+
531
+
532
+ class EnumeratedTag(univ.Sequence):
533
+ pass
534
+
535
+ EnumeratedTag.componentType = namedtype.NamedTypes(
536
+ namedtype.NamedType('tagName', univ.ObjectIdentifier()),
537
+ namedtype.NamedType('attributeList', univ.SetOf(componentType=SecurityAttribute()))
538
+ )
539
+
540
+
541
+ class FreeFormField(univ.Choice):
542
+ pass
543
+
544
+ FreeFormField.componentType = namedtype.NamedTypes(
545
+ namedtype.NamedType('bitSetAttributes', univ.BitString()), # Not permitted in RFC 7906
546
+ namedtype.NamedType('securityAttributes', univ.SetOf(componentType=SecurityAttribute()))
547
+ )
548
+
549
+
550
+ class InformativeTag(univ.Sequence):
551
+ pass
552
+
553
+ InformativeTag.componentType = namedtype.NamedTypes(
554
+ namedtype.NamedType('tagName', univ.ObjectIdentifier()),
555
+ namedtype.NamedType('attributes', FreeFormField())
556
+ )
557
+
558
+
559
+ class Classification(ESSSecurityLabel):
560
+ pass
561
+
562
+
563
+ aa_classification = Attribute()
564
+ aa_classification['attrType'] = id_aa_KP_classification
565
+ aa_classification['attrValues'][0] = Classification()
566
+
567
+
568
+ # Split Identifier Attribute
569
+
570
+ id_kma_splitID = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.11')
571
+
572
+
573
+ class SplitID(univ.Sequence):
574
+ pass
575
+
576
+ SplitID.componentType = namedtype.NamedTypes(
577
+ namedtype.NamedType('half', univ.Enumerated(
578
+ namedValues=namedval.NamedValues(('a', 0), ('b', 1)))),
579
+ namedtype.OptionalNamedType('combineAlg', AlgorithmIdentifier())
580
+ )
581
+
582
+
583
+ aa_splitIdentifier = Attribute()
584
+ aa_splitIdentifier['attrType'] = id_kma_splitID
585
+ aa_splitIdentifier['attrValues'][0] = SplitID()
586
+
587
+
588
+ # Key Package Type Attribute
589
+
590
+ id_kma_keyPkgType = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.12')
591
+
592
+
593
+ class KeyPkgType(univ.ObjectIdentifier):
594
+ pass
595
+
596
+
597
+ aa_keyPackageType = Attribute()
598
+ aa_keyPackageType['attrType'] = id_kma_keyPkgType
599
+ aa_keyPackageType['attrValues'][0] = KeyPkgType()
600
+
601
+
602
+ # Signature Usage Attribute
603
+
604
+ id_kma_sigUsageV3 = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.22')
605
+
606
+
607
+ class SignatureUsage(CMSContentConstraints):
608
+ pass
609
+
610
+
611
+ aa_signatureUsage_v3 = Attribute()
612
+ aa_signatureUsage_v3['attrType'] = id_kma_sigUsageV3
613
+ aa_signatureUsage_v3['attrValues'][0] = SignatureUsage()
614
+
615
+
616
+ # Other Certificate Format Attribute
617
+
618
+ id_kma_otherCertFormats = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.19')
619
+
620
+
621
+ aa_otherCertificateFormats = Attribute()
622
+ aa_signatureUsage_v3['attrType'] = id_kma_otherCertFormats
623
+ aa_signatureUsage_v3['attrValues'][0] = CertificateChoices()
624
+
625
+
626
+ # PKI Path Attribute
627
+
628
+ id_at_pkiPath = univ.ObjectIdentifier('2.5.4.70')
629
+
630
+
631
+ class PkiPath(univ.SequenceOf):
632
+ pass
633
+
634
+ PkiPath.componentType = Certificate()
635
+ PkiPath.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
636
+
637
+
638
+ aa_pkiPath = Attribute()
639
+ aa_pkiPath['attrType'] = id_at_pkiPath
640
+ aa_pkiPath['attrValues'][0] = PkiPath()
641
+
642
+
643
+ # Useful Certificates Attribute
644
+
645
+ id_kma_usefulCerts = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.20')
646
+
647
+
648
+ aa_usefulCertificates = Attribute()
649
+ aa_usefulCertificates['attrType'] = id_kma_usefulCerts
650
+ aa_usefulCertificates['attrValues'][0] = CertificateSet()
651
+
652
+
653
+ # Key Wrap Attribute
654
+
655
+ id_kma_keyWrapAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.21')
656
+
657
+
658
+ aa_keyWrapAlgorithm = Attribute()
659
+ aa_keyWrapAlgorithm['attrType'] = id_kma_keyWrapAlgorithm
660
+ aa_keyWrapAlgorithm['attrValues'][0] = AlgorithmIdentifier()
661
+
662
+
663
+ # Content Decryption Key Identifier Attribute
664
+
665
+ id_aa_KP_contentDecryptKeyID = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.66')
666
+
667
+
668
+ class ContentDecryptKeyID(univ.OctetString):
669
+ pass
670
+
671
+
672
+ aa_contentDecryptKeyIdentifier = Attribute()
673
+ aa_contentDecryptKeyIdentifier['attrType'] = id_aa_KP_contentDecryptKeyID
674
+ aa_contentDecryptKeyIdentifier['attrValues'][0] = ContentDecryptKeyID()
675
+
676
+
677
+ # Certificate Pointers Attribute
678
+
679
+ aa_certificatePointers = Attribute()
680
+ aa_certificatePointers['attrType'] = id_pe_subjectInfoAccess
681
+ aa_certificatePointers['attrValues'][0] = SubjectInfoAccessSyntax()
682
+
683
+
684
+ # CRL Pointers Attribute
685
+
686
+ id_aa_KP_crlPointers = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.70')
687
+
688
+
689
+ aa_cRLDistributionPoints = Attribute()
690
+ aa_cRLDistributionPoints['attrType'] = id_aa_KP_crlPointers
691
+ aa_cRLDistributionPoints['attrValues'][0] = GeneralNames()
692
+
693
+
694
+ # Extended Error Codes
695
+
696
+ id_errorCodes = univ.ObjectIdentifier('2.16.840.1.101.2.1.22')
697
+
698
+ id_missingKeyType = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.1')
699
+
700
+ id_privacyMarkTooLong = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.2')
701
+
702
+ id_unrecognizedSecurityPolicy = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.3')
703
+
704
+
705
+ # Update the CMS Attributes Map
706
+
707
+ _cmsAttributesMapUpdate = {
708
+ id_aa_contentHint: ContentHints(),
709
+ id_aa_communityIdentifiers: CommunityIdentifiers(),
710
+ id_aa_binarySigningTime: BinarySigningTime(),
711
+ id_contentType: ContentType(),
712
+ id_messageDigest: MessageDigest(),
713
+ id_aa_KP_keyPkgIdAndReceiptReq: KeyPkgIdentifierAndReceiptReq(),
714
+ id_aa_KP_keyProvinceV2: KeyProvinceV2(),
715
+ id_aa_KP_manifest: Manifest(),
716
+ id_kma_keyAlgorithm: KeyAlgorithm(),
717
+ id_at_userCertificate: Certificate(),
718
+ id_kma_keyPkgReceiversV2: KeyPkgReceiversV2(),
719
+ id_kma_TSECNomenclature: TSECNomenclature(),
720
+ id_kma_keyPurpose: KeyPurpose(),
721
+ id_kma_keyUse: KeyUse(),
722
+ id_kma_transportKey: TransOp(),
723
+ id_kma_keyDistPeriod: KeyDistPeriod(),
724
+ id_kma_keyValidityPeriod: KeyValidityPeriod(),
725
+ id_kma_keyDuration: KeyDuration(),
726
+ id_aa_KP_classification: Classification(),
727
+ id_kma_splitID: SplitID(),
728
+ id_kma_keyPkgType: KeyPkgType(),
729
+ id_kma_sigUsageV3: SignatureUsage(),
730
+ id_kma_otherCertFormats: CertificateChoices(),
731
+ id_at_pkiPath: PkiPath(),
732
+ id_kma_usefulCerts: CertificateSet(),
733
+ id_kma_keyWrapAlgorithm: AlgorithmIdentifier(),
734
+ id_aa_KP_contentDecryptKeyID: ContentDecryptKeyID(),
735
+ id_pe_subjectInfoAccess: SubjectInfoAccessSyntax(),
736
+ id_aa_KP_crlPointers: GeneralNames(),
737
+ }
738
+
739
+ cmsAttributesMap.update(_cmsAttributesMapUpdate)