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.
- pyasn1_alt_modules/__init__.py +2 -0
- pyasn1_alt_modules/opentypemap.py +19 -0
- pyasn1_alt_modules/pem.py +66 -0
- pyasn1_alt_modules/rfc1155.py +97 -0
- pyasn1_alt_modules/rfc1157.py +127 -0
- pyasn1_alt_modules/rfc1901.py +23 -0
- pyasn1_alt_modules/rfc1902.py +130 -0
- pyasn1_alt_modules/rfc1905.py +136 -0
- pyasn1_alt_modules/rfc2040.py +50 -0
- pyasn1_alt_modules/rfc2251.py +564 -0
- pyasn1_alt_modules/rfc2314.py +68 -0
- pyasn1_alt_modules/rfc2315.py +325 -0
- pyasn1_alt_modules/rfc2437.py +70 -0
- pyasn1_alt_modules/rfc2459.py +1340 -0
- pyasn1_alt_modules/rfc2511.py +303 -0
- pyasn1_alt_modules/rfc2528.py +34 -0
- pyasn1_alt_modules/rfc2560.py +226 -0
- pyasn1_alt_modules/rfc2631.py +37 -0
- pyasn1_alt_modules/rfc2634.py +342 -0
- pyasn1_alt_modules/rfc2743.py +60 -0
- pyasn1_alt_modules/rfc2876.py +61 -0
- pyasn1_alt_modules/rfc2898.py +72 -0
- pyasn1_alt_modules/rfc2985.py +593 -0
- pyasn1_alt_modules/rfc2986.py +76 -0
- pyasn1_alt_modules/rfc3058.py +48 -0
- pyasn1_alt_modules/rfc3114.py +80 -0
- pyasn1_alt_modules/rfc3125.py +469 -0
- pyasn1_alt_modules/rfc3161.py +142 -0
- pyasn1_alt_modules/rfc3217.py +42 -0
- pyasn1_alt_modules/rfc3274.py +62 -0
- pyasn1_alt_modules/rfc3279.py +264 -0
- pyasn1_alt_modules/rfc3280.py +1544 -0
- pyasn1_alt_modules/rfc3281.py +332 -0
- pyasn1_alt_modules/rfc3370.py +142 -0
- pyasn1_alt_modules/rfc3412.py +54 -0
- pyasn1_alt_modules/rfc3414.py +29 -0
- pyasn1_alt_modules/rfc3447.py +46 -0
- pyasn1_alt_modules/rfc3537.py +44 -0
- pyasn1_alt_modules/rfc3546.py +23 -0
- pyasn1_alt_modules/rfc3560.py +74 -0
- pyasn1_alt_modules/rfc3565.py +59 -0
- pyasn1_alt_modules/rfc3657.py +69 -0
- pyasn1_alt_modules/rfc3709.py +230 -0
- pyasn1_alt_modules/rfc3739.py +207 -0
- pyasn1_alt_modules/rfc3770.py +77 -0
- pyasn1_alt_modules/rfc3779.py +139 -0
- pyasn1_alt_modules/rfc3820.py +66 -0
- pyasn1_alt_modules/rfc3852.py +707 -0
- pyasn1_alt_modules/rfc3874.py +29 -0
- pyasn1_alt_modules/rfc4010.py +58 -0
- pyasn1_alt_modules/rfc4043.py +45 -0
- pyasn1_alt_modules/rfc4055.py +285 -0
- pyasn1_alt_modules/rfc4056.py +56 -0
- pyasn1_alt_modules/rfc4059.py +101 -0
- pyasn1_alt_modules/rfc4073.py +62 -0
- pyasn1_alt_modules/rfc4108.py +355 -0
- pyasn1_alt_modules/rfc4210.py +807 -0
- pyasn1_alt_modules/rfc4211.py +420 -0
- pyasn1_alt_modules/rfc4231.py +38 -0
- pyasn1_alt_modules/rfc4262.py +37 -0
- pyasn1_alt_modules/rfc4334.py +78 -0
- pyasn1_alt_modules/rfc4357.py +485 -0
- pyasn1_alt_modules/rfc4366.py +23 -0
- pyasn1_alt_modules/rfc4387.py +23 -0
- pyasn1_alt_modules/rfc4476.py +99 -0
- pyasn1_alt_modules/rfc4490.py +119 -0
- pyasn1_alt_modules/rfc4491.py +44 -0
- pyasn1_alt_modules/rfc4683.py +76 -0
- pyasn1_alt_modules/rfc4985.py +52 -0
- pyasn1_alt_modules/rfc4998.py +125 -0
- pyasn1_alt_modules/rfc5035.py +206 -0
- pyasn1_alt_modules/rfc5055.py +763 -0
- pyasn1_alt_modules/rfc5083.py +55 -0
- pyasn1_alt_modules/rfc5084.py +94 -0
- pyasn1_alt_modules/rfc5126.py +578 -0
- pyasn1_alt_modules/rfc5208.py +73 -0
- pyasn1_alt_modules/rfc5275.py +404 -0
- pyasn1_alt_modules/rfc5276.py +82 -0
- pyasn1_alt_modules/rfc5280.py +1666 -0
- pyasn1_alt_modules/rfc5480.py +190 -0
- pyasn1_alt_modules/rfc5544.py +127 -0
- pyasn1_alt_modules/rfc5636.py +117 -0
- pyasn1_alt_modules/rfc5639.py +49 -0
- pyasn1_alt_modules/rfc5649.py +33 -0
- pyasn1_alt_modules/rfc5652.py +763 -0
- pyasn1_alt_modules/rfc5697.py +64 -0
- pyasn1_alt_modules/rfc5698.py +159 -0
- pyasn1_alt_modules/rfc5751.py +127 -0
- pyasn1_alt_modules/rfc5752.py +52 -0
- pyasn1_alt_modules/rfc5753.py +163 -0
- pyasn1_alt_modules/rfc5755.py +400 -0
- pyasn1_alt_modules/rfc5913.py +46 -0
- pyasn1_alt_modules/rfc5914.py +119 -0
- pyasn1_alt_modules/rfc5915.py +32 -0
- pyasn1_alt_modules/rfc5916.py +39 -0
- pyasn1_alt_modules/rfc5917.py +59 -0
- pyasn1_alt_modules/rfc5924.py +19 -0
- pyasn1_alt_modules/rfc5934.py +786 -0
- pyasn1_alt_modules/rfc5940.py +62 -0
- pyasn1_alt_modules/rfc5958.py +100 -0
- pyasn1_alt_modules/rfc5990.py +238 -0
- pyasn1_alt_modules/rfc6010.py +92 -0
- pyasn1_alt_modules/rfc6019.py +46 -0
- pyasn1_alt_modules/rfc6031.py +469 -0
- pyasn1_alt_modules/rfc6032.py +71 -0
- pyasn1_alt_modules/rfc6066.py +25 -0
- pyasn1_alt_modules/rfc6120.py +46 -0
- pyasn1_alt_modules/rfc6170.py +17 -0
- pyasn1_alt_modules/rfc6187.py +22 -0
- pyasn1_alt_modules/rfc6210.py +45 -0
- pyasn1_alt_modules/rfc6211.py +75 -0
- pyasn1_alt_modules/rfc6402.py +643 -0
- pyasn1_alt_modules/rfc6482.py +77 -0
- pyasn1_alt_modules/rfc6484.py +17 -0
- pyasn1_alt_modules/rfc6486.py +70 -0
- pyasn1_alt_modules/rfc6487.py +22 -0
- pyasn1_alt_modules/rfc6492.py +41 -0
- pyasn1_alt_modules/rfc6493.py +24 -0
- pyasn1_alt_modules/rfc6494.py +23 -0
- pyasn1_alt_modules/rfc6664.py +151 -0
- pyasn1_alt_modules/rfc6955.py +112 -0
- pyasn1_alt_modules/rfc6960.py +234 -0
- pyasn1_alt_modules/rfc6962.py +52 -0
- pyasn1_alt_modules/rfc7030.py +70 -0
- pyasn1_alt_modules/rfc7191.py +267 -0
- pyasn1_alt_modules/rfc7229.py +29 -0
- pyasn1_alt_modules/rfc7292.py +359 -0
- pyasn1_alt_modules/rfc7296.py +32 -0
- pyasn1_alt_modules/rfc7508.py +92 -0
- pyasn1_alt_modules/rfc7585.py +53 -0
- pyasn1_alt_modules/rfc7633.py +40 -0
- pyasn1_alt_modules/rfc7693.py +66 -0
- pyasn1_alt_modules/rfc7773.py +54 -0
- pyasn1_alt_modules/rfc7836.py +65 -0
- pyasn1_alt_modules/rfc7894.py +100 -0
- pyasn1_alt_modules/rfc7906.py +739 -0
- pyasn1_alt_modules/rfc7914.py +55 -0
- pyasn1_alt_modules/rfc8017.py +159 -0
- pyasn1_alt_modules/rfc8018.py +269 -0
- pyasn1_alt_modules/rfc8103.py +36 -0
- pyasn1_alt_modules/rfc8209.py +20 -0
- pyasn1_alt_modules/rfc8226.py +151 -0
- pyasn1_alt_modules/rfc8358.py +54 -0
- pyasn1_alt_modules/rfc8360.py +46 -0
- pyasn1_alt_modules/rfc8398.py +55 -0
- pyasn1_alt_modules/rfc8410.py +43 -0
- pyasn1_alt_modules/rfc8418.py +36 -0
- pyasn1_alt_modules/rfc8419.py +70 -0
- pyasn1_alt_modules/rfc8479.py +48 -0
- pyasn1_alt_modules/rfc8494.py +80 -0
- pyasn1_alt_modules/rfc8520.py +66 -0
- pyasn1_alt_modules/rfc8619.py +45 -0
- pyasn1_alt_modules/rfc8649.py +42 -0
- pyasn1_alt_modules/rfc8692.py +79 -0
- pyasn1_alt_modules/rfc8696.py +108 -0
- pyasn1_alt_modules/rfc8702.py +109 -0
- pyasn1_alt_modules/rfc8708.py +43 -0
- pyasn1_alt_modules/rfc8737.py +36 -0
- pyasn1_alt_modules/rfc8769.py +21 -0
- pyasn1_alt_modules/rfc8894.py +52 -0
- pyasn1_alt_modules/rfc8951.py +42 -0
- pyasn1_alt_modules/rfc8954.py +238 -0
- pyasn1_alt_modules/rfc8994.py +52 -0
- pyasn1_alt_modules/rfc8995.py +39 -0
- pyasn1_alt_modules/rfc9044.py +80 -0
- pyasn1_alt_modules/rfc9092.py +35 -0
- pyasn1_alt_modules/rfc9118.py +82 -0
- pyasn1_alt_modules/rfc9174.py +55 -0
- pyasn1_alt_modules/rfc9189.py +74 -0
- pyasn1_alt_modules/rfc9215.py +228 -0
- pyasn1_alt_modules/rfc9286.py +78 -0
- pyasn1_alt_modules/rfc9289.py +22 -0
- pyasn1_alt_modules/rfc9310.py +46 -0
- pyasn1_alt_modules/rfc9323.py +129 -0
- pyasn1_alt_modules/rfc9336.py +20 -0
- pyasn1_alt_modules/rfc9337.py +74 -0
- pyasn1_alt_modules/rfc9345.py +36 -0
- pyasn1_alt_modules/rfc9385.py +22 -0
- pyasn1_alt_modules/rfc9399.py +59 -0
- pyasn1_alt_modules/rfc9480.py +731 -0
- pyasn1_alt_modules/rfc9481.py +224 -0
- pyasn1_alt_modules/rfc9509.py +24 -0
- pyasn1_alt_modules/rfc9548.py +23 -0
- pyasn1_alt_modules/rfc9579.py +89 -0
- pyasn1_alt_modules/rfc9582.py +107 -0
- pyasn1_alt_modules/rfc9598.py +52 -0
- pyasn1_alt_modules/rfc9608.py +35 -0
- pyasn1_alt_modules/rfc9629.py +100 -0
- pyasn1_alt_modules/rfc9654.py +241 -0
- pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
- pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
- pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
- pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
- pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
- pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,593 @@
|
|
|
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
|
+
# Updated 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
|
+
# PKCS#9: Selected Attribute Types (Version 2.0)
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc2985.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 namedval
|
|
20
|
+
from pyasn1.type import opentype
|
|
21
|
+
from pyasn1.type import tag
|
|
22
|
+
from pyasn1.type import univ
|
|
23
|
+
from pyasn1.type import useful
|
|
24
|
+
|
|
25
|
+
from pyasn1_alt_modules import rfc7292
|
|
26
|
+
from pyasn1_alt_modules import rfc5958
|
|
27
|
+
from pyasn1_alt_modules import rfc5652
|
|
28
|
+
from pyasn1_alt_modules import rfc5280
|
|
29
|
+
from pyasn1_alt_modules import opentypemap
|
|
30
|
+
|
|
31
|
+
certificateAttributesMap = opentypemap.get('certificateAttributesMap')
|
|
32
|
+
|
|
33
|
+
cmsAttributesMap = opentypemap.get('cmsAttributesMap')
|
|
34
|
+
|
|
35
|
+
MAX = float('inf')
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _OID(*components):
|
|
39
|
+
output = []
|
|
40
|
+
for x in tuple(components):
|
|
41
|
+
if isinstance(x, univ.ObjectIdentifier):
|
|
42
|
+
output.extend(list(x))
|
|
43
|
+
else:
|
|
44
|
+
output.append(int(x))
|
|
45
|
+
|
|
46
|
+
return univ.ObjectIdentifier(output)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Imports from RFC 5280
|
|
50
|
+
|
|
51
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
52
|
+
|
|
53
|
+
Attribute = rfc5280.Attribute
|
|
54
|
+
|
|
55
|
+
EmailAddress = rfc5280.EmailAddress
|
|
56
|
+
|
|
57
|
+
Extensions = rfc5280.Extensions
|
|
58
|
+
|
|
59
|
+
Time = rfc5280.Time
|
|
60
|
+
|
|
61
|
+
X520countryName = rfc5280.X520countryName
|
|
62
|
+
|
|
63
|
+
X520SerialNumber = rfc5280.X520SerialNumber
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Imports from RFC 5652
|
|
67
|
+
|
|
68
|
+
ContentInfo = rfc5652.ContentInfo
|
|
69
|
+
|
|
70
|
+
ContentType = rfc5652.ContentType
|
|
71
|
+
|
|
72
|
+
Countersignature = rfc5652.Countersignature
|
|
73
|
+
|
|
74
|
+
MessageDigest = rfc5652.MessageDigest
|
|
75
|
+
|
|
76
|
+
SignerInfo = rfc5652.SignerInfo
|
|
77
|
+
|
|
78
|
+
SigningTime = rfc5652.SigningTime
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# Imports from RFC 5958
|
|
82
|
+
|
|
83
|
+
EncryptedPrivateKeyInfo = rfc5958.EncryptedPrivateKeyInfo
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Imports from RFC 7292
|
|
87
|
+
|
|
88
|
+
PFX = rfc7292.PFX
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# TODO:
|
|
92
|
+
# Need a place to import PKCS15Token; it does not yet appear in an RFC
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# SingleAttribute is the same as Attribute in RFC 5280, except that the
|
|
96
|
+
# attrValues SET must have one and only one member
|
|
97
|
+
|
|
98
|
+
class AttributeType(univ.ObjectIdentifier):
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class AttributeValue(univ.Any):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class AttributeValues(univ.SetOf):
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
AttributeValues.componentType = AttributeValue()
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class SingleAttributeValues(univ.SetOf):
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
SingleAttributeValues.componentType = AttributeValue()
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class SingleAttribute(univ.Sequence):
|
|
119
|
+
pass
|
|
120
|
+
|
|
121
|
+
SingleAttribute.componentType = namedtype.NamedTypes(
|
|
122
|
+
namedtype.NamedType('type', AttributeType()),
|
|
123
|
+
namedtype.NamedType('values',
|
|
124
|
+
AttributeValues().subtype(sizeSpec=constraint.ValueSizeConstraint(1, 1)),
|
|
125
|
+
openType=opentype.OpenType('type', certificateAttributesMap)
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# CMSAttribute is the same as Attribute in RFC 5652, and CMSSingleAttribute
|
|
131
|
+
# is the companion where the attrValues SET must have one and only one member
|
|
132
|
+
|
|
133
|
+
CMSAttribute = rfc5652.Attribute
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class CMSSingleAttribute(univ.Sequence):
|
|
137
|
+
pass
|
|
138
|
+
|
|
139
|
+
CMSSingleAttribute.componentType = namedtype.NamedTypes(
|
|
140
|
+
namedtype.NamedType('attrType', AttributeType()),
|
|
141
|
+
namedtype.NamedType('attrValues',
|
|
142
|
+
AttributeValues().subtype(sizeSpec=constraint.ValueSizeConstraint(1, 1)),
|
|
143
|
+
openType=opentype.OpenType('attrType', cmsAttributesMap)
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# DirectoryString is the same as RFC 5280, except the length is limited to 255
|
|
149
|
+
|
|
150
|
+
class DirectoryString(univ.Choice):
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
DirectoryString.componentType = namedtype.NamedTypes(
|
|
154
|
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
|
155
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
|
156
|
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
|
157
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
|
158
|
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
|
159
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
|
160
|
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
|
161
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
|
162
|
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
|
163
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255)))
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# PKCS9String is DirectoryString with an additional choice of IA5String,
|
|
168
|
+
# and the SIZE is limited to 255
|
|
169
|
+
|
|
170
|
+
class PKCS9String(univ.Choice):
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
PKCS9String.componentType = namedtype.NamedTypes(
|
|
174
|
+
namedtype.NamedType('ia5String', char.IA5String().subtype(
|
|
175
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
|
176
|
+
namedtype.NamedType('directoryString', DirectoryString())
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# Upper Bounds
|
|
181
|
+
|
|
182
|
+
pkcs_9_ub_pkcs9String = univ.Integer(255)
|
|
183
|
+
|
|
184
|
+
pkcs_9_ub_challengePassword = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
185
|
+
|
|
186
|
+
pkcs_9_ub_emailAddress = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
187
|
+
|
|
188
|
+
pkcs_9_ub_friendlyName = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
189
|
+
|
|
190
|
+
pkcs_9_ub_match = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
191
|
+
|
|
192
|
+
pkcs_9_ub_signingDescription = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
193
|
+
|
|
194
|
+
pkcs_9_ub_unstructuredAddress = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
195
|
+
|
|
196
|
+
pkcs_9_ub_unstructuredName = univ.Integer(pkcs_9_ub_pkcs9String)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
ub_name = univ.Integer(32768)
|
|
200
|
+
|
|
201
|
+
pkcs_9_ub_placeOfBirth = univ.Integer(ub_name)
|
|
202
|
+
|
|
203
|
+
pkcs_9_ub_pseudonym = univ.Integer(ub_name)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# Object Identifier Arcs
|
|
207
|
+
|
|
208
|
+
ietf_at = _OID(1, 3, 6, 1, 5, 5, 7, 9)
|
|
209
|
+
|
|
210
|
+
id_at = _OID(2, 5, 4)
|
|
211
|
+
|
|
212
|
+
pkcs_9 = _OID(1, 2, 840, 113549, 1, 9)
|
|
213
|
+
|
|
214
|
+
pkcs_9_mo = _OID(pkcs_9, 0)
|
|
215
|
+
|
|
216
|
+
smime = _OID(pkcs_9, 16)
|
|
217
|
+
|
|
218
|
+
certTypes = _OID(pkcs_9, 22)
|
|
219
|
+
|
|
220
|
+
crlTypes = _OID(pkcs_9, 23)
|
|
221
|
+
|
|
222
|
+
pkcs_9_oc = _OID(pkcs_9, 24)
|
|
223
|
+
|
|
224
|
+
pkcs_9_at = _OID(pkcs_9, 25)
|
|
225
|
+
|
|
226
|
+
pkcs_9_sx = _OID(pkcs_9, 26)
|
|
227
|
+
|
|
228
|
+
pkcs_9_mr = _OID(pkcs_9, 27)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# Object Identifiers for Syntaxes for use with LDAP-accessible directories
|
|
232
|
+
|
|
233
|
+
pkcs_9_sx_pkcs9String = _OID(pkcs_9_sx, 1)
|
|
234
|
+
|
|
235
|
+
pkcs_9_sx_signingTime = _OID(pkcs_9_sx, 2)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# Object Identifiers for object classes
|
|
239
|
+
|
|
240
|
+
pkcs_9_oc_pkcsEntity = _OID(pkcs_9_oc, 1)
|
|
241
|
+
|
|
242
|
+
pkcs_9_oc_naturalPerson = _OID(pkcs_9_oc, 2)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# Object Identifiers for matching rules
|
|
246
|
+
|
|
247
|
+
pkcs_9_mr_caseIgnoreMatch = _OID(pkcs_9_mr, 1)
|
|
248
|
+
|
|
249
|
+
pkcs_9_mr_signingTimeMatch = _OID(pkcs_9_mr, 2)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
# PKCS #7 PDU
|
|
253
|
+
|
|
254
|
+
pkcs_9_at_pkcs7PDU = _OID(pkcs_9_at, 5)
|
|
255
|
+
|
|
256
|
+
pKCS7PDU = Attribute()
|
|
257
|
+
pKCS7PDU['type'] = pkcs_9_at_pkcs7PDU
|
|
258
|
+
pKCS7PDU['values'][0] = ContentInfo()
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
# PKCS #12 token
|
|
262
|
+
|
|
263
|
+
pkcs_9_at_userPKCS12 = _OID(2, 16, 840, 1, 113730, 3, 1, 216)
|
|
264
|
+
|
|
265
|
+
userPKCS12 = Attribute()
|
|
266
|
+
userPKCS12['type'] = pkcs_9_at_userPKCS12
|
|
267
|
+
userPKCS12['values'][0] = PFX()
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
# PKCS #15 token
|
|
271
|
+
|
|
272
|
+
pkcs_9_at_pkcs15Token = _OID(pkcs_9_at, 1)
|
|
273
|
+
|
|
274
|
+
# TODO: Once PKCS15Token can be imported, this can be included
|
|
275
|
+
#
|
|
276
|
+
# pKCS15Token = Attribute()
|
|
277
|
+
# userPKCS12['type'] = pkcs_9_at_pkcs15Token
|
|
278
|
+
# userPKCS12['values'][0] = PKCS15Token()
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
# PKCS #8 encrypted private key information
|
|
282
|
+
|
|
283
|
+
pkcs_9_at_encryptedPrivateKeyInfo = _OID(pkcs_9_at, 2)
|
|
284
|
+
|
|
285
|
+
encryptedPrivateKeyInfo = Attribute()
|
|
286
|
+
encryptedPrivateKeyInfo['type'] = pkcs_9_at_encryptedPrivateKeyInfo
|
|
287
|
+
encryptedPrivateKeyInfo['values'][0] = EncryptedPrivateKeyInfo()
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# Electronic-mail address
|
|
291
|
+
|
|
292
|
+
pkcs_9_at_emailAddress = rfc5280.id_emailAddress
|
|
293
|
+
|
|
294
|
+
emailAddress = Attribute()
|
|
295
|
+
emailAddress['type'] = pkcs_9_at_emailAddress
|
|
296
|
+
emailAddress['values'][0] = EmailAddress()
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
# Unstructured name
|
|
300
|
+
|
|
301
|
+
pkcs_9_at_unstructuredName = _OID(pkcs_9, 2)
|
|
302
|
+
|
|
303
|
+
unstructuredName = Attribute()
|
|
304
|
+
unstructuredName['type'] = pkcs_9_at_unstructuredName
|
|
305
|
+
unstructuredName['values'][0] = PKCS9String()
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
# Unstructured address
|
|
309
|
+
|
|
310
|
+
pkcs_9_at_unstructuredAddress = _OID(pkcs_9, 8)
|
|
311
|
+
|
|
312
|
+
unstructuredAddress = Attribute()
|
|
313
|
+
unstructuredAddress['type'] = pkcs_9_at_unstructuredAddress
|
|
314
|
+
unstructuredAddress['values'][0] = DirectoryString()
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
# Date of birth
|
|
318
|
+
|
|
319
|
+
pkcs_9_at_dateOfBirth = _OID(ietf_at, 1)
|
|
320
|
+
|
|
321
|
+
dateOfBirth = SingleAttribute()
|
|
322
|
+
dateOfBirth['type'] = pkcs_9_at_dateOfBirth
|
|
323
|
+
dateOfBirth['values'][0] = useful.GeneralizedTime()
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
# Place of birth
|
|
327
|
+
|
|
328
|
+
pkcs_9_at_placeOfBirth = _OID(ietf_at, 2)
|
|
329
|
+
|
|
330
|
+
placeOfBirth = SingleAttribute()
|
|
331
|
+
placeOfBirth['type'] = pkcs_9_at_placeOfBirth
|
|
332
|
+
placeOfBirth['values'][0] = DirectoryString()
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
# Gender
|
|
336
|
+
|
|
337
|
+
class GenderString(char.PrintableString):
|
|
338
|
+
pass
|
|
339
|
+
|
|
340
|
+
GenderString.subtypeSpec = constraint.ValueSizeConstraint(1, 1)
|
|
341
|
+
GenderString.subtypeSpec = constraint.SingleValueConstraint("M", "F", "m", "f")
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
pkcs_9_at_gender = _OID(ietf_at, 3)
|
|
345
|
+
|
|
346
|
+
gender = SingleAttribute()
|
|
347
|
+
gender['type'] = pkcs_9_at_gender
|
|
348
|
+
gender['values'][0] = GenderString()
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
# Country of citizenship
|
|
352
|
+
|
|
353
|
+
pkcs_9_at_countryOfCitizenship = _OID(ietf_at, 4)
|
|
354
|
+
|
|
355
|
+
countryOfCitizenship = Attribute()
|
|
356
|
+
countryOfCitizenship['type'] = pkcs_9_at_countryOfCitizenship
|
|
357
|
+
countryOfCitizenship['values'][0] = X520countryName()
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
# Country of residence
|
|
361
|
+
|
|
362
|
+
pkcs_9_at_countryOfResidence = _OID(ietf_at, 5)
|
|
363
|
+
|
|
364
|
+
countryOfResidence = Attribute()
|
|
365
|
+
countryOfResidence['type'] = pkcs_9_at_countryOfResidence
|
|
366
|
+
countryOfResidence['values'][0] = X520countryName()
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
# Pseudonym
|
|
370
|
+
|
|
371
|
+
id_at_pseudonym = _OID(2, 5, 4, 65)
|
|
372
|
+
|
|
373
|
+
pseudonym = Attribute()
|
|
374
|
+
pseudonym['type'] = id_at_pseudonym
|
|
375
|
+
pseudonym['values'][0] = DirectoryString()
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
# Serial number
|
|
379
|
+
|
|
380
|
+
id_at_serialNumber = rfc5280.id_at_serialNumber
|
|
381
|
+
|
|
382
|
+
serialNumber = Attribute()
|
|
383
|
+
serialNumber['type'] = id_at_serialNumber
|
|
384
|
+
serialNumber['values'][0] = X520SerialNumber()
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
# Content type
|
|
388
|
+
|
|
389
|
+
pkcs_9_at_contentType = rfc5652.id_contentType
|
|
390
|
+
|
|
391
|
+
contentType = CMSSingleAttribute()
|
|
392
|
+
contentType['attrType'] = pkcs_9_at_contentType
|
|
393
|
+
contentType['attrValues'][0] = ContentType()
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
# Message digest
|
|
397
|
+
|
|
398
|
+
pkcs_9_at_messageDigest = rfc5652.id_messageDigest
|
|
399
|
+
|
|
400
|
+
messageDigest = CMSSingleAttribute()
|
|
401
|
+
messageDigest['attrType'] = pkcs_9_at_messageDigest
|
|
402
|
+
messageDigest['attrValues'][0] = MessageDigest()
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
# Signing time
|
|
406
|
+
|
|
407
|
+
pkcs_9_at_signingTime = rfc5652.id_signingTime
|
|
408
|
+
|
|
409
|
+
signingTime = CMSSingleAttribute()
|
|
410
|
+
signingTime['attrType'] = pkcs_9_at_signingTime
|
|
411
|
+
signingTime['attrValues'][0] = SigningTime()
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
# Random nonce
|
|
415
|
+
|
|
416
|
+
class RandomNonce(univ.OctetString):
|
|
417
|
+
pass
|
|
418
|
+
|
|
419
|
+
RandomNonce.subtypeSpec = constraint.ValueSizeConstraint(4, MAX)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
pkcs_9_at_randomNonce = _OID(pkcs_9_at, 3)
|
|
423
|
+
|
|
424
|
+
randomNonce = CMSSingleAttribute()
|
|
425
|
+
randomNonce['attrType'] = pkcs_9_at_randomNonce
|
|
426
|
+
randomNonce['attrValues'][0] = RandomNonce()
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
# Sequence number
|
|
430
|
+
|
|
431
|
+
class SequenceNumber(univ.Integer):
|
|
432
|
+
pass
|
|
433
|
+
|
|
434
|
+
SequenceNumber.subtypeSpec = constraint.ValueRangeConstraint(1, MAX)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
pkcs_9_at_sequenceNumber = _OID(pkcs_9_at, 4)
|
|
438
|
+
|
|
439
|
+
sequenceNumber = CMSSingleAttribute()
|
|
440
|
+
sequenceNumber['attrType'] = pkcs_9_at_sequenceNumber
|
|
441
|
+
sequenceNumber['attrValues'][0] = SequenceNumber()
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
# Countersignature
|
|
445
|
+
|
|
446
|
+
pkcs_9_at_counterSignature = rfc5652.id_countersignature
|
|
447
|
+
|
|
448
|
+
counterSignature = CMSAttribute()
|
|
449
|
+
counterSignature['attrType'] = pkcs_9_at_counterSignature
|
|
450
|
+
counterSignature['attrValues'][0] = Countersignature()
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
# Challenge password
|
|
454
|
+
|
|
455
|
+
pkcs_9_at_challengePassword = _OID(pkcs_9, 7)
|
|
456
|
+
|
|
457
|
+
challengePassword = SingleAttribute()
|
|
458
|
+
challengePassword['type'] = pkcs_9_at_challengePassword
|
|
459
|
+
challengePassword['values'][0] = DirectoryString()
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
# Extension request
|
|
463
|
+
|
|
464
|
+
class ExtensionRequest(Extensions):
|
|
465
|
+
pass
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
pkcs_9_at_extensionRequest = _OID(pkcs_9, 14)
|
|
469
|
+
|
|
470
|
+
extensionRequest = SingleAttribute()
|
|
471
|
+
extensionRequest['type'] = pkcs_9_at_extensionRequest
|
|
472
|
+
extensionRequest['values'][0] = ExtensionRequest()
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
# Extended-certificate attributes (deprecated)
|
|
476
|
+
|
|
477
|
+
class AttributeSet(univ.SetOf):
|
|
478
|
+
pass
|
|
479
|
+
|
|
480
|
+
AttributeSet.componentType = Attribute()
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
pkcs_9_at_extendedCertificateAttributes = _OID(pkcs_9, 9)
|
|
484
|
+
|
|
485
|
+
extendedCertificateAttributes = SingleAttribute()
|
|
486
|
+
extendedCertificateAttributes['type'] = pkcs_9_at_extendedCertificateAttributes
|
|
487
|
+
extendedCertificateAttributes['values'][0] = AttributeSet()
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
# Friendly name
|
|
491
|
+
|
|
492
|
+
class FriendlyName(char.BMPString):
|
|
493
|
+
pass
|
|
494
|
+
|
|
495
|
+
FriendlyName.subtypeSpec = constraint.ValueSizeConstraint(1, pkcs_9_ub_friendlyName)
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
pkcs_9_at_friendlyName = _OID(pkcs_9, 20)
|
|
499
|
+
|
|
500
|
+
friendlyName = SingleAttribute()
|
|
501
|
+
friendlyName['type'] = pkcs_9_at_friendlyName
|
|
502
|
+
friendlyName['values'][0] = FriendlyName()
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
# Local key identifier
|
|
506
|
+
|
|
507
|
+
pkcs_9_at_localKeyId = _OID(pkcs_9, 21)
|
|
508
|
+
|
|
509
|
+
localKeyId = SingleAttribute()
|
|
510
|
+
localKeyId['type'] = pkcs_9_at_localKeyId
|
|
511
|
+
localKeyId['values'][0] = univ.OctetString()
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
# Signing description
|
|
515
|
+
|
|
516
|
+
pkcs_9_at_signingDescription = _OID(pkcs_9, 13)
|
|
517
|
+
|
|
518
|
+
signingDescription = CMSSingleAttribute()
|
|
519
|
+
signingDescription['attrType'] = pkcs_9_at_signingDescription
|
|
520
|
+
signingDescription['attrValues'][0] = DirectoryString()
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
# S/MIME capabilities
|
|
524
|
+
|
|
525
|
+
class SMIMECapability(AlgorithmIdentifier):
|
|
526
|
+
pass
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
class SMIMECapabilities(univ.SequenceOf):
|
|
530
|
+
pass
|
|
531
|
+
|
|
532
|
+
SMIMECapabilities.componentType = SMIMECapability()
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
pkcs_9_at_smimeCapabilities = _OID(pkcs_9, 15)
|
|
536
|
+
|
|
537
|
+
smimeCapabilities = CMSSingleAttribute()
|
|
538
|
+
smimeCapabilities['attrType'] = pkcs_9_at_smimeCapabilities
|
|
539
|
+
smimeCapabilities['attrValues'][0] = SMIMECapabilities()
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
# Certificate Attribute Map
|
|
543
|
+
|
|
544
|
+
_certificateAttributesMapUpdate = {
|
|
545
|
+
# Attribute types for use with the "pkcsEntity" object class
|
|
546
|
+
pkcs_9_at_pkcs7PDU: ContentInfo(),
|
|
547
|
+
pkcs_9_at_userPKCS12: PFX(),
|
|
548
|
+
# TODO: Once PKCS15Token can be imported, this can be included
|
|
549
|
+
# pkcs_9_at_pkcs15Token: PKCS15Token(),
|
|
550
|
+
pkcs_9_at_encryptedPrivateKeyInfo: EncryptedPrivateKeyInfo(),
|
|
551
|
+
# Attribute types for use with the "naturalPerson" object class
|
|
552
|
+
pkcs_9_at_emailAddress: EmailAddress(),
|
|
553
|
+
pkcs_9_at_unstructuredName: PKCS9String(),
|
|
554
|
+
pkcs_9_at_unstructuredAddress: DirectoryString(),
|
|
555
|
+
pkcs_9_at_dateOfBirth: useful.GeneralizedTime(),
|
|
556
|
+
pkcs_9_at_placeOfBirth: DirectoryString(),
|
|
557
|
+
pkcs_9_at_gender: GenderString(),
|
|
558
|
+
pkcs_9_at_countryOfCitizenship: X520countryName(),
|
|
559
|
+
pkcs_9_at_countryOfResidence: X520countryName(),
|
|
560
|
+
id_at_pseudonym: DirectoryString(),
|
|
561
|
+
id_at_serialNumber: X520SerialNumber(),
|
|
562
|
+
# Attribute types for use with PKCS #10 certificate requests
|
|
563
|
+
pkcs_9_at_challengePassword: DirectoryString(),
|
|
564
|
+
pkcs_9_at_extensionRequest: ExtensionRequest(),
|
|
565
|
+
pkcs_9_at_extendedCertificateAttributes: AttributeSet(),
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
# CMS Attribute Map
|
|
572
|
+
|
|
573
|
+
# Note: pkcs_9_at_smimeCapabilities is not included in the map because
|
|
574
|
+
# the definition in RFC 5751 is preferred, which produces the same
|
|
575
|
+
# encoding, but it allows different parameters for SMIMECapability
|
|
576
|
+
# and AlgorithmIdentifier.
|
|
577
|
+
|
|
578
|
+
_cmsAttributesMapUpdate = {
|
|
579
|
+
# Attribute types for use in PKCS #7 data (a.k.a. CMS)
|
|
580
|
+
pkcs_9_at_contentType: ContentType(),
|
|
581
|
+
pkcs_9_at_messageDigest: MessageDigest(),
|
|
582
|
+
pkcs_9_at_signingTime: SigningTime(),
|
|
583
|
+
pkcs_9_at_randomNonce: RandomNonce(),
|
|
584
|
+
pkcs_9_at_sequenceNumber: SequenceNumber(),
|
|
585
|
+
pkcs_9_at_counterSignature: Countersignature(),
|
|
586
|
+
# Attributes for use in PKCS #12 "PFX" PDUs or PKCS #15 tokens
|
|
587
|
+
pkcs_9_at_friendlyName: FriendlyName(),
|
|
588
|
+
pkcs_9_at_localKeyId: univ.OctetString(),
|
|
589
|
+
pkcs_9_at_signingDescription: DirectoryString(),
|
|
590
|
+
# pkcs_9_at_smimeCapabilities: SMIMECapabilities(),
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
#
|
|
3
|
+
# This file is part of pyasn1-alt-modules software.
|
|
4
|
+
#
|
|
5
|
+
# Created by Joel Johnson with asn1ate tool.
|
|
6
|
+
# Modified by Russ Housley to add support for opentypes by importing
|
|
7
|
+
# definitions from rfc5280 so that the same maps are used.
|
|
8
|
+
#
|
|
9
|
+
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
|
|
10
|
+
# Copyright (c) 2021-2024, Vigil Security, LLC
|
|
11
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
12
|
+
#
|
|
13
|
+
# PKCS #10: Certification Request Syntax Specification
|
|
14
|
+
#
|
|
15
|
+
# ASN.1 source from:
|
|
16
|
+
# https://www.rfc-editor.org/rfc/rfc2986.txt
|
|
17
|
+
#
|
|
18
|
+
from pyasn1.type import namedtype
|
|
19
|
+
from pyasn1.type import tag
|
|
20
|
+
from pyasn1.type import univ
|
|
21
|
+
|
|
22
|
+
from pyasn1_alt_modules import rfc5280
|
|
23
|
+
|
|
24
|
+
MAX = float('inf')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
AttributeType = rfc5280.AttributeType
|
|
28
|
+
|
|
29
|
+
AttributeValue = rfc5280.AttributeValue
|
|
30
|
+
|
|
31
|
+
AttributeTypeAndValue = rfc5280.AttributeTypeAndValue
|
|
32
|
+
|
|
33
|
+
Attribute = rfc5280.Attribute
|
|
34
|
+
|
|
35
|
+
RelativeDistinguishedName = rfc5280.RelativeDistinguishedName
|
|
36
|
+
|
|
37
|
+
RDNSequence = rfc5280.RDNSequence
|
|
38
|
+
|
|
39
|
+
Name = rfc5280.Name
|
|
40
|
+
|
|
41
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
42
|
+
|
|
43
|
+
SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Attributes(univ.SetOf):
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Attributes.componentType = Attribute()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class CertificationRequestInfo(univ.Sequence):
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
CertificationRequestInfo.componentType = namedtype.NamedTypes(
|
|
58
|
+
namedtype.NamedType('version', univ.Integer()),
|
|
59
|
+
namedtype.NamedType('subject', Name()),
|
|
60
|
+
namedtype.NamedType('subjectPKInfo', SubjectPublicKeyInfo()),
|
|
61
|
+
namedtype.NamedType('attributes',
|
|
62
|
+
Attributes().subtype(implicitTag=tag.Tag(
|
|
63
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class CertificationRequest(univ.Sequence):
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
CertificationRequest.componentType = namedtype.NamedTypes(
|
|
73
|
+
namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
|
|
74
|
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
|
75
|
+
namedtype.NamedType('signature', univ.BitString())
|
|
76
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
# IDEA Encryption Algorithm in CMS
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc3058.txt
|
|
14
|
+
# https://www.rfc-editor.org/errata/eid5913
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
from pyasn1.type import namedtype
|
|
18
|
+
from pyasn1.type import univ
|
|
19
|
+
|
|
20
|
+
from pyasn1_alt_modules import rfc5280
|
|
21
|
+
from pyasn1_alt_modules import opentypemap
|
|
22
|
+
|
|
23
|
+
algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Object Identifiers and Parameters for IDEA
|
|
27
|
+
|
|
28
|
+
id_IDEA_CBC = univ.ObjectIdentifier('1.3.6.1.4.1.188.7.1.1.2')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
id_alg_CMSIDEAwrap = univ.ObjectIdentifier('1.3.6.1.4.1.188.7.1.1.6')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class IDEA_CBCPar(univ.Sequence):
|
|
35
|
+
componentType = namedtype.NamedTypes(
|
|
36
|
+
namedtype.OptionalNamedType('iv', univ.OctetString())
|
|
37
|
+
# exactly 8 octets, when present
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Update the Algorithm Identifiers Map and the SMIMECapability Map
|
|
42
|
+
|
|
43
|
+
_algorithmIdentifierMapUpdate = {
|
|
44
|
+
id_IDEA_CBC: IDEA_CBCPar(),
|
|
45
|
+
id_alg_CMSIDEAwrap: univ.Null("")
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|