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,807 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
|
|
5
|
+
# Copyright (c) 2021-2024, Vigil Security, LLC
|
|
6
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
7
|
+
#
|
|
8
|
+
# Certificate Management Protocol structures as per RFC4210
|
|
9
|
+
#
|
|
10
|
+
# Based on Alex Railean's work
|
|
11
|
+
# Modified by Russ Housley to import from RFC 5280 instead of RFC 2459.
|
|
12
|
+
# Modified by Russ Housley to import from RFC 4211 instead of RFC 2511.
|
|
13
|
+
# Modified by Russ Housley to import from RFC 6402 instead of RFC 2314.
|
|
14
|
+
#
|
|
15
|
+
from pyasn1.type import char
|
|
16
|
+
from pyasn1.type import constraint
|
|
17
|
+
from pyasn1.type import namedtype
|
|
18
|
+
from pyasn1.type import namedval
|
|
19
|
+
from pyasn1.type import tag
|
|
20
|
+
from pyasn1.type import univ
|
|
21
|
+
from pyasn1.type import useful
|
|
22
|
+
|
|
23
|
+
from pyasn1_alt_modules import rfc6402
|
|
24
|
+
from pyasn1_alt_modules import rfc4211
|
|
25
|
+
from pyasn1_alt_modules import rfc5280
|
|
26
|
+
|
|
27
|
+
MAX = float('inf')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class KeyIdentifier(univ.OctetString):
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class CMPCertificate(rfc5280.Certificate):
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class OOBCert(CMPCertificate):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CertAnnContent(CMPCertificate):
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PKIFreeText(univ.SequenceOf):
|
|
47
|
+
"""
|
|
48
|
+
PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
|
|
49
|
+
"""
|
|
50
|
+
componentType = char.UTF8String()
|
|
51
|
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class PollRepContent(univ.SequenceOf):
|
|
55
|
+
"""
|
|
56
|
+
PollRepContent ::= SEQUENCE OF SEQUENCE {
|
|
57
|
+
certReqId INTEGER,
|
|
58
|
+
checkAfter INTEGER, -- time in seconds
|
|
59
|
+
reason PKIFreeText OPTIONAL
|
|
60
|
+
}
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
class CertReq(univ.Sequence):
|
|
64
|
+
componentType = namedtype.NamedTypes(
|
|
65
|
+
namedtype.NamedType('certReqId', univ.Integer()),
|
|
66
|
+
namedtype.NamedType('checkAfter', univ.Integer()),
|
|
67
|
+
namedtype.OptionalNamedType('reason', PKIFreeText())
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
componentType = CertReq()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class PollReqContent(univ.SequenceOf):
|
|
74
|
+
"""
|
|
75
|
+
PollReqContent ::= SEQUENCE OF SEQUENCE {
|
|
76
|
+
certReqId INTEGER
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
class CertReq(univ.Sequence):
|
|
82
|
+
componentType = namedtype.NamedTypes(
|
|
83
|
+
namedtype.NamedType('certReqId', univ.Integer())
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
componentType = CertReq()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class InfoTypeAndValue(univ.Sequence):
|
|
90
|
+
"""
|
|
91
|
+
InfoTypeAndValue ::= SEQUENCE {
|
|
92
|
+
infoType OBJECT IDENTIFIER,
|
|
93
|
+
infoValue ANY DEFINED BY infoType OPTIONAL
|
|
94
|
+
}"""
|
|
95
|
+
componentType = namedtype.NamedTypes(
|
|
96
|
+
namedtype.NamedType('infoType', univ.ObjectIdentifier()),
|
|
97
|
+
namedtype.OptionalNamedType('infoValue', univ.Any())
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class GenRepContent(univ.SequenceOf):
|
|
102
|
+
componentType = InfoTypeAndValue()
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class GenMsgContent(univ.SequenceOf):
|
|
106
|
+
componentType = InfoTypeAndValue()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class PKIConfirmContent(univ.Null):
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class CRLAnnContent(univ.SequenceOf):
|
|
114
|
+
componentType = rfc5280.CertificateList()
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class CAKeyUpdAnnContent(univ.Sequence):
|
|
118
|
+
"""
|
|
119
|
+
CAKeyUpdAnnContent ::= SEQUENCE {
|
|
120
|
+
oldWithNew CMPCertificate,
|
|
121
|
+
newWithOld CMPCertificate,
|
|
122
|
+
newWithNew CMPCertificate
|
|
123
|
+
}
|
|
124
|
+
"""
|
|
125
|
+
componentType = namedtype.NamedTypes(
|
|
126
|
+
namedtype.NamedType('oldWithNew', CMPCertificate()),
|
|
127
|
+
namedtype.NamedType('newWithOld', CMPCertificate()),
|
|
128
|
+
namedtype.NamedType('newWithNew', CMPCertificate())
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class RevDetails(univ.Sequence):
|
|
133
|
+
"""
|
|
134
|
+
RevDetails ::= SEQUENCE {
|
|
135
|
+
certDetails CertTemplate,
|
|
136
|
+
crlEntryDetails Extensions OPTIONAL
|
|
137
|
+
}
|
|
138
|
+
"""
|
|
139
|
+
componentType = namedtype.NamedTypes(
|
|
140
|
+
namedtype.NamedType('certDetails', rfc4211.CertTemplate()),
|
|
141
|
+
namedtype.OptionalNamedType('crlEntryDetails', rfc5280.Extensions())
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class RevReqContent(univ.SequenceOf):
|
|
146
|
+
componentType = RevDetails()
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class CertOrEncCert(univ.Choice):
|
|
150
|
+
"""
|
|
151
|
+
CertOrEncCert ::= CHOICE {
|
|
152
|
+
certificate [0] CMPCertificate,
|
|
153
|
+
encryptedCert [1] EncryptedValue
|
|
154
|
+
}
|
|
155
|
+
"""
|
|
156
|
+
componentType = namedtype.NamedTypes(
|
|
157
|
+
namedtype.NamedType('certificate', CMPCertificate().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
158
|
+
namedtype.NamedType('encryptedCert', rfc4211.EncryptedValue().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class CertifiedKeyPair(univ.Sequence):
|
|
163
|
+
"""
|
|
164
|
+
CertifiedKeyPair ::= SEQUENCE {
|
|
165
|
+
certOrEncCert CertOrEncCert,
|
|
166
|
+
privateKey [0] EncryptedValue OPTIONAL,
|
|
167
|
+
publicationInfo [1] PKIPublicationInfo OPTIONAL
|
|
168
|
+
}
|
|
169
|
+
"""
|
|
170
|
+
componentType = namedtype.NamedTypes(
|
|
171
|
+
namedtype.NamedType('certOrEncCert', CertOrEncCert()),
|
|
172
|
+
namedtype.OptionalNamedType('privateKey', rfc4211.EncryptedValue().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
173
|
+
namedtype.OptionalNamedType('publicationInfo', rfc4211.PKIPublicationInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class POPODecKeyRespContent(univ.SequenceOf):
|
|
178
|
+
componentType = univ.Integer()
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class Challenge(univ.Sequence):
|
|
182
|
+
"""
|
|
183
|
+
Challenge ::= SEQUENCE {
|
|
184
|
+
owf AlgorithmIdentifier OPTIONAL,
|
|
185
|
+
witness OCTET STRING,
|
|
186
|
+
challenge OCTET STRING
|
|
187
|
+
}
|
|
188
|
+
"""
|
|
189
|
+
componentType = namedtype.NamedTypes(
|
|
190
|
+
namedtype.OptionalNamedType('owf', rfc5280.AlgorithmIdentifier()),
|
|
191
|
+
namedtype.NamedType('witness', univ.OctetString()),
|
|
192
|
+
namedtype.NamedType('challenge', univ.OctetString())
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class PKIStatus(univ.Integer):
|
|
197
|
+
"""
|
|
198
|
+
PKIStatus ::= INTEGER {
|
|
199
|
+
accepted (0),
|
|
200
|
+
grantedWithMods (1),
|
|
201
|
+
rejection (2),
|
|
202
|
+
waiting (3),
|
|
203
|
+
revocationWarning (4),
|
|
204
|
+
revocationNotification (5),
|
|
205
|
+
keyUpdateWarning (6)
|
|
206
|
+
}
|
|
207
|
+
"""
|
|
208
|
+
namedValues = namedval.NamedValues(
|
|
209
|
+
('accepted', 0),
|
|
210
|
+
('grantedWithMods', 1),
|
|
211
|
+
('rejection', 2),
|
|
212
|
+
('waiting', 3),
|
|
213
|
+
('revocationWarning', 4),
|
|
214
|
+
('revocationNotification', 5),
|
|
215
|
+
('keyUpdateWarning', 6)
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class PKIFailureInfo(univ.BitString):
|
|
220
|
+
"""
|
|
221
|
+
PKIFailureInfo ::= BIT STRING {
|
|
222
|
+
badAlg (0),
|
|
223
|
+
badMessageCheck (1),
|
|
224
|
+
badRequest (2),
|
|
225
|
+
badTime (3),
|
|
226
|
+
badCertId (4),
|
|
227
|
+
badDataFormat (5),
|
|
228
|
+
wrongAuthority (6),
|
|
229
|
+
incorrectData (7),
|
|
230
|
+
missingTimeStamp (8),
|
|
231
|
+
badPOP (9),
|
|
232
|
+
certRevoked (10),
|
|
233
|
+
certConfirmed (11),
|
|
234
|
+
wrongIntegrity (12),
|
|
235
|
+
badRecipientNonce (13),
|
|
236
|
+
timeNotAvailable (14),
|
|
237
|
+
unacceptedPolicy (15),
|
|
238
|
+
unacceptedExtension (16),
|
|
239
|
+
addInfoNotAvailable (17),
|
|
240
|
+
badSenderNonce (18),
|
|
241
|
+
badCertTemplate (19),
|
|
242
|
+
signerNotTrusted (20),
|
|
243
|
+
transactionIdInUse (21),
|
|
244
|
+
unsupportedVersion (22),
|
|
245
|
+
notAuthorized (23),
|
|
246
|
+
systemUnavail (24),
|
|
247
|
+
systemFailure (25),
|
|
248
|
+
duplicateCertReq (26)
|
|
249
|
+
"""
|
|
250
|
+
namedValues = namedval.NamedValues(
|
|
251
|
+
('badAlg', 0),
|
|
252
|
+
('badMessageCheck', 1),
|
|
253
|
+
('badRequest', 2),
|
|
254
|
+
('badTime', 3),
|
|
255
|
+
('badCertId', 4),
|
|
256
|
+
('badDataFormat', 5),
|
|
257
|
+
('wrongAuthority', 6),
|
|
258
|
+
('incorrectData', 7),
|
|
259
|
+
('missingTimeStamp', 8),
|
|
260
|
+
('badPOP', 9),
|
|
261
|
+
('certRevoked', 10),
|
|
262
|
+
('certConfirmed', 11),
|
|
263
|
+
('wrongIntegrity', 12),
|
|
264
|
+
('badRecipientNonce', 13),
|
|
265
|
+
('timeNotAvailable', 14),
|
|
266
|
+
('unacceptedPolicy', 15),
|
|
267
|
+
('unacceptedExtension', 16),
|
|
268
|
+
('addInfoNotAvailable', 17),
|
|
269
|
+
('badSenderNonce', 18),
|
|
270
|
+
('badCertTemplate', 19),
|
|
271
|
+
('signerNotTrusted', 20),
|
|
272
|
+
('transactionIdInUse', 21),
|
|
273
|
+
('unsupportedVersion', 22),
|
|
274
|
+
('notAuthorized', 23),
|
|
275
|
+
('systemUnavail', 24),
|
|
276
|
+
('systemFailure', 25),
|
|
277
|
+
('duplicateCertReq', 26)
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
class PKIStatusInfo(univ.Sequence):
|
|
282
|
+
"""
|
|
283
|
+
PKIStatusInfo ::= SEQUENCE {
|
|
284
|
+
status PKIStatus,
|
|
285
|
+
statusString PKIFreeText OPTIONAL,
|
|
286
|
+
failInfo PKIFailureInfo OPTIONAL
|
|
287
|
+
}
|
|
288
|
+
"""
|
|
289
|
+
componentType = namedtype.NamedTypes(
|
|
290
|
+
namedtype.NamedType('status', PKIStatus()),
|
|
291
|
+
namedtype.OptionalNamedType('statusString', PKIFreeText()),
|
|
292
|
+
namedtype.OptionalNamedType('failInfo', PKIFailureInfo())
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class ErrorMsgContent(univ.Sequence):
|
|
297
|
+
"""
|
|
298
|
+
ErrorMsgContent ::= SEQUENCE {
|
|
299
|
+
pKIStatusInfo PKIStatusInfo,
|
|
300
|
+
errorCode INTEGER OPTIONAL,
|
|
301
|
+
-- implementation-specific error codes
|
|
302
|
+
errorDetails PKIFreeText OPTIONAL
|
|
303
|
+
-- implementation-specific error details
|
|
304
|
+
}
|
|
305
|
+
"""
|
|
306
|
+
componentType = namedtype.NamedTypes(
|
|
307
|
+
namedtype.NamedType('pKIStatusInfo', PKIStatusInfo()),
|
|
308
|
+
namedtype.OptionalNamedType('errorCode', univ.Integer()),
|
|
309
|
+
namedtype.OptionalNamedType('errorDetails', PKIFreeText())
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
class CertStatus(univ.Sequence):
|
|
314
|
+
"""
|
|
315
|
+
CertStatus ::= SEQUENCE {
|
|
316
|
+
certHash OCTET STRING,
|
|
317
|
+
certReqId INTEGER,
|
|
318
|
+
statusInfo PKIStatusInfo OPTIONAL
|
|
319
|
+
}
|
|
320
|
+
"""
|
|
321
|
+
componentType = namedtype.NamedTypes(
|
|
322
|
+
namedtype.NamedType('certHash', univ.OctetString()),
|
|
323
|
+
namedtype.NamedType('certReqId', univ.Integer()),
|
|
324
|
+
namedtype.OptionalNamedType('statusInfo', PKIStatusInfo())
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
class CertConfirmContent(univ.SequenceOf):
|
|
329
|
+
componentType = CertStatus()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class RevAnnContent(univ.Sequence):
|
|
333
|
+
"""
|
|
334
|
+
RevAnnContent ::= SEQUENCE {
|
|
335
|
+
status PKIStatus,
|
|
336
|
+
certId CertId,
|
|
337
|
+
willBeRevokedAt GeneralizedTime,
|
|
338
|
+
badSinceDate GeneralizedTime,
|
|
339
|
+
crlDetails Extensions OPTIONAL
|
|
340
|
+
}
|
|
341
|
+
"""
|
|
342
|
+
componentType = namedtype.NamedTypes(
|
|
343
|
+
namedtype.NamedType('status', PKIStatus()),
|
|
344
|
+
namedtype.NamedType('certId', rfc4211.CertId()),
|
|
345
|
+
namedtype.NamedType('willBeRevokedAt', useful.GeneralizedTime()),
|
|
346
|
+
namedtype.NamedType('badSinceDate', useful.GeneralizedTime()),
|
|
347
|
+
namedtype.OptionalNamedType('crlDetails', rfc5280.Extensions())
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class RevRepContent(univ.Sequence):
|
|
352
|
+
"""
|
|
353
|
+
RevRepContent ::= SEQUENCE {
|
|
354
|
+
status SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
|
|
355
|
+
revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId
|
|
356
|
+
OPTIONAL,
|
|
357
|
+
crls [1] SEQUENCE SIZE (1..MAX) OF CertificateList
|
|
358
|
+
OPTIONAL
|
|
359
|
+
"""
|
|
360
|
+
componentType = namedtype.NamedTypes(
|
|
361
|
+
namedtype.NamedType(
|
|
362
|
+
'status', univ.SequenceOf(
|
|
363
|
+
componentType=PKIStatusInfo(),
|
|
364
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
365
|
+
)
|
|
366
|
+
),
|
|
367
|
+
namedtype.OptionalNamedType(
|
|
368
|
+
'revCerts', univ.SequenceOf(componentType=rfc4211.CertId()).subtype(
|
|
369
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
|
370
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
|
371
|
+
)
|
|
372
|
+
),
|
|
373
|
+
namedtype.OptionalNamedType(
|
|
374
|
+
'crls', univ.SequenceOf(componentType=rfc5280.CertificateList()).subtype(
|
|
375
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
|
376
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class KeyRecRepContent(univ.Sequence):
|
|
383
|
+
"""
|
|
384
|
+
KeyRecRepContent ::= SEQUENCE {
|
|
385
|
+
status PKIStatusInfo,
|
|
386
|
+
newSigCert [0] CMPCertificate OPTIONAL,
|
|
387
|
+
caCerts [1] SEQUENCE SIZE (1..MAX) OF
|
|
388
|
+
CMPCertificate OPTIONAL,
|
|
389
|
+
keyPairHist [2] SEQUENCE SIZE (1..MAX) OF
|
|
390
|
+
CertifiedKeyPair OPTIONAL
|
|
391
|
+
}
|
|
392
|
+
"""
|
|
393
|
+
componentType = namedtype.NamedTypes(
|
|
394
|
+
namedtype.NamedType('status', PKIStatusInfo()),
|
|
395
|
+
namedtype.OptionalNamedType(
|
|
396
|
+
'newSigCert', CMPCertificate().subtype(
|
|
397
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
|
398
|
+
)
|
|
399
|
+
),
|
|
400
|
+
namedtype.OptionalNamedType(
|
|
401
|
+
'caCerts', univ.SequenceOf(componentType=CMPCertificate()).subtype(
|
|
402
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1),
|
|
403
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
404
|
+
)
|
|
405
|
+
),
|
|
406
|
+
namedtype.OptionalNamedType('keyPairHist', univ.SequenceOf(componentType=CertifiedKeyPair()).subtype(
|
|
407
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2),
|
|
408
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX))
|
|
409
|
+
)
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
class CertResponse(univ.Sequence):
|
|
414
|
+
"""
|
|
415
|
+
CertResponse ::= SEQUENCE {
|
|
416
|
+
certReqId INTEGER,
|
|
417
|
+
status PKIStatusInfo,
|
|
418
|
+
certifiedKeyPair CertifiedKeyPair OPTIONAL,
|
|
419
|
+
rspInfo OCTET STRING OPTIONAL
|
|
420
|
+
}
|
|
421
|
+
"""
|
|
422
|
+
componentType = namedtype.NamedTypes(
|
|
423
|
+
namedtype.NamedType('certReqId', univ.Integer()),
|
|
424
|
+
namedtype.NamedType('status', PKIStatusInfo()),
|
|
425
|
+
namedtype.OptionalNamedType('certifiedKeyPair', CertifiedKeyPair()),
|
|
426
|
+
namedtype.OptionalNamedType('rspInfo', univ.OctetString())
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class CertRepMessage(univ.Sequence):
|
|
431
|
+
"""
|
|
432
|
+
CertRepMessage ::= SEQUENCE {
|
|
433
|
+
caPubs [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
|
|
434
|
+
OPTIONAL,
|
|
435
|
+
response SEQUENCE OF CertResponse
|
|
436
|
+
}
|
|
437
|
+
"""
|
|
438
|
+
componentType = namedtype.NamedTypes(
|
|
439
|
+
namedtype.OptionalNamedType(
|
|
440
|
+
'caPubs', univ.SequenceOf(
|
|
441
|
+
componentType=CMPCertificate()
|
|
442
|
+
).subtype(sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
|
443
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))
|
|
444
|
+
),
|
|
445
|
+
namedtype.NamedType('response', univ.SequenceOf(componentType=CertResponse()))
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
class POPODecKeyChallContent(univ.SequenceOf):
|
|
450
|
+
componentType = Challenge()
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class OOBCertHash(univ.Sequence):
|
|
454
|
+
"""
|
|
455
|
+
OOBCertHash ::= SEQUENCE {
|
|
456
|
+
hashAlg [0] AlgorithmIdentifier OPTIONAL,
|
|
457
|
+
certId [1] CertId OPTIONAL,
|
|
458
|
+
hashVal BIT STRING
|
|
459
|
+
}
|
|
460
|
+
"""
|
|
461
|
+
componentType = namedtype.NamedTypes(
|
|
462
|
+
namedtype.OptionalNamedType(
|
|
463
|
+
'hashAlg', rfc5280.AlgorithmIdentifier().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))
|
|
464
|
+
),
|
|
465
|
+
namedtype.OptionalNamedType(
|
|
466
|
+
'certId', rfc4211.CertId().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))
|
|
467
|
+
),
|
|
468
|
+
namedtype.NamedType('hashVal', univ.BitString())
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
|
473
|
+
# NestedMessageContent ::= PKIMessages
|
|
474
|
+
class NestedMessageContent(univ.SequenceOf):
|
|
475
|
+
"""
|
|
476
|
+
NestedMessageContent ::= PKIMessages
|
|
477
|
+
"""
|
|
478
|
+
componentType = univ.Any()
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
class DHBMParameter(univ.Sequence):
|
|
482
|
+
"""
|
|
483
|
+
DHBMParameter ::= SEQUENCE {
|
|
484
|
+
owf AlgorithmIdentifier,
|
|
485
|
+
-- AlgId for a One-Way Function (SHA-1 recommended)
|
|
486
|
+
mac AlgorithmIdentifier
|
|
487
|
+
-- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
|
|
488
|
+
} -- or HMAC [RFC2104, RFC2202])
|
|
489
|
+
"""
|
|
490
|
+
componentType = namedtype.NamedTypes(
|
|
491
|
+
namedtype.NamedType('owf', rfc5280.AlgorithmIdentifier()),
|
|
492
|
+
namedtype.NamedType('mac', rfc5280.AlgorithmIdentifier())
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
id_DHBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.30')
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
class PBMParameter(univ.Sequence):
|
|
500
|
+
"""
|
|
501
|
+
PBMParameter ::= SEQUENCE {
|
|
502
|
+
salt OCTET STRING,
|
|
503
|
+
owf AlgorithmIdentifier,
|
|
504
|
+
iterationCount INTEGER,
|
|
505
|
+
mac AlgorithmIdentifier
|
|
506
|
+
}
|
|
507
|
+
"""
|
|
508
|
+
componentType = namedtype.NamedTypes(
|
|
509
|
+
namedtype.NamedType(
|
|
510
|
+
'salt', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(0, 128))
|
|
511
|
+
),
|
|
512
|
+
namedtype.NamedType('owf', rfc5280.AlgorithmIdentifier()),
|
|
513
|
+
namedtype.NamedType('iterationCount', univ.Integer()),
|
|
514
|
+
namedtype.NamedType('mac', rfc5280.AlgorithmIdentifier())
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
id_PasswordBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.13')
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
class PKIProtection(univ.BitString):
|
|
522
|
+
pass
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
|
526
|
+
# NestedMessageContent ::= PKIMessages
|
|
527
|
+
nestedMessageContent = NestedMessageContent().subtype(
|
|
528
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 20))
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
class PKIBody(univ.Choice):
|
|
532
|
+
"""
|
|
533
|
+
PKIBody ::= CHOICE { -- message-specific body elements
|
|
534
|
+
ir [0] CertReqMessages, --Initialization Request
|
|
535
|
+
ip [1] CertRepMessage, --Initialization Response
|
|
536
|
+
cr [2] CertReqMessages, --Certification Request
|
|
537
|
+
cp [3] CertRepMessage, --Certification Response
|
|
538
|
+
p10cr [4] CertificationRequest, --imported from [PKCS10]
|
|
539
|
+
popdecc [5] POPODecKeyChallContent, --pop Challenge
|
|
540
|
+
popdecr [6] POPODecKeyRespContent, --pop Response
|
|
541
|
+
kur [7] CertReqMessages, --Key Update Request
|
|
542
|
+
kup [8] CertRepMessage, --Key Update Response
|
|
543
|
+
krr [9] CertReqMessages, --Key Recovery Request
|
|
544
|
+
krp [10] KeyRecRepContent, --Key Recovery Response
|
|
545
|
+
rr [11] RevReqContent, --Revocation Request
|
|
546
|
+
rp [12] RevRepContent, --Revocation Response
|
|
547
|
+
ccr [13] CertReqMessages, --Cross-Cert. Request
|
|
548
|
+
ccp [14] CertRepMessage, --Cross-Cert. Response
|
|
549
|
+
ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
|
|
550
|
+
cann [16] CertAnnContent, --Certificate Ann.
|
|
551
|
+
rann [17] RevAnnContent, --Revocation Ann.
|
|
552
|
+
crlann [18] CRLAnnContent, --CRL Announcement
|
|
553
|
+
pkiconf [19] PKIConfirmContent, --Confirmation
|
|
554
|
+
nested [20] NestedMessageContent, --Nested Message
|
|
555
|
+
genm [21] GenMsgContent, --General Message
|
|
556
|
+
genp [22] GenRepContent, --General Response
|
|
557
|
+
error [23] ErrorMsgContent, --Error Message
|
|
558
|
+
certConf [24] CertConfirmContent, --Certificate confirm
|
|
559
|
+
pollReq [25] PollReqContent, --Polling request
|
|
560
|
+
pollRep [26] PollRepContent --Polling response
|
|
561
|
+
|
|
562
|
+
"""
|
|
563
|
+
componentType = namedtype.NamedTypes(
|
|
564
|
+
namedtype.NamedType(
|
|
565
|
+
'ir', rfc4211.CertReqMessages().subtype(
|
|
566
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
|
567
|
+
)
|
|
568
|
+
),
|
|
569
|
+
namedtype.NamedType(
|
|
570
|
+
'ip', CertRepMessage().subtype(
|
|
571
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
|
572
|
+
)
|
|
573
|
+
),
|
|
574
|
+
namedtype.NamedType(
|
|
575
|
+
'cr', rfc4211.CertReqMessages().subtype(
|
|
576
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
|
|
577
|
+
)
|
|
578
|
+
),
|
|
579
|
+
namedtype.NamedType(
|
|
580
|
+
'cp', CertRepMessage().subtype(
|
|
581
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
|
|
582
|
+
)
|
|
583
|
+
),
|
|
584
|
+
namedtype.NamedType(
|
|
585
|
+
'p10cr', rfc6402.CertificationRequest().subtype(
|
|
586
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)
|
|
587
|
+
)
|
|
588
|
+
),
|
|
589
|
+
namedtype.NamedType(
|
|
590
|
+
'popdecc', POPODecKeyChallContent().subtype(
|
|
591
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5)
|
|
592
|
+
)
|
|
593
|
+
),
|
|
594
|
+
namedtype.NamedType(
|
|
595
|
+
'popdecr', POPODecKeyRespContent().subtype(
|
|
596
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)
|
|
597
|
+
)
|
|
598
|
+
),
|
|
599
|
+
namedtype.NamedType(
|
|
600
|
+
'kur', rfc4211.CertReqMessages().subtype(
|
|
601
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)
|
|
602
|
+
)
|
|
603
|
+
),
|
|
604
|
+
namedtype.NamedType(
|
|
605
|
+
'kup', CertRepMessage().subtype(
|
|
606
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)
|
|
607
|
+
)
|
|
608
|
+
),
|
|
609
|
+
namedtype.NamedType(
|
|
610
|
+
'krr', rfc4211.CertReqMessages().subtype(
|
|
611
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)
|
|
612
|
+
)
|
|
613
|
+
),
|
|
614
|
+
namedtype.NamedType(
|
|
615
|
+
'krp', KeyRecRepContent().subtype(
|
|
616
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 10)
|
|
617
|
+
)
|
|
618
|
+
),
|
|
619
|
+
namedtype.NamedType(
|
|
620
|
+
'rr', RevReqContent().subtype(
|
|
621
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 11)
|
|
622
|
+
)
|
|
623
|
+
),
|
|
624
|
+
namedtype.NamedType(
|
|
625
|
+
'rp', RevRepContent().subtype(
|
|
626
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 12)
|
|
627
|
+
)
|
|
628
|
+
),
|
|
629
|
+
namedtype.NamedType(
|
|
630
|
+
'ccr', rfc4211.CertReqMessages().subtype(
|
|
631
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 13)
|
|
632
|
+
)
|
|
633
|
+
),
|
|
634
|
+
namedtype.NamedType(
|
|
635
|
+
'ccp', CertRepMessage().subtype(
|
|
636
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 14)
|
|
637
|
+
)
|
|
638
|
+
),
|
|
639
|
+
namedtype.NamedType(
|
|
640
|
+
'ckuann', CAKeyUpdAnnContent().subtype(
|
|
641
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 15)
|
|
642
|
+
)
|
|
643
|
+
),
|
|
644
|
+
namedtype.NamedType(
|
|
645
|
+
'cann', CertAnnContent().subtype(
|
|
646
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 16)
|
|
647
|
+
)
|
|
648
|
+
),
|
|
649
|
+
namedtype.NamedType(
|
|
650
|
+
'rann', RevAnnContent().subtype(
|
|
651
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 17)
|
|
652
|
+
)
|
|
653
|
+
),
|
|
654
|
+
namedtype.NamedType(
|
|
655
|
+
'crlann', CRLAnnContent().subtype(
|
|
656
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 18)
|
|
657
|
+
)
|
|
658
|
+
),
|
|
659
|
+
namedtype.NamedType(
|
|
660
|
+
'pkiconf', PKIConfirmContent().subtype(
|
|
661
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 19)
|
|
662
|
+
)
|
|
663
|
+
),
|
|
664
|
+
namedtype.NamedType(
|
|
665
|
+
'nested', nestedMessageContent
|
|
666
|
+
),
|
|
667
|
+
# namedtype.NamedType('nested', NestedMessageContent().subtype(
|
|
668
|
+
# explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,20)
|
|
669
|
+
# )
|
|
670
|
+
# ),
|
|
671
|
+
namedtype.NamedType(
|
|
672
|
+
'genm', GenMsgContent().subtype(
|
|
673
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 21)
|
|
674
|
+
)
|
|
675
|
+
),
|
|
676
|
+
namedtype.NamedType(
|
|
677
|
+
'gen', GenRepContent().subtype(
|
|
678
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 22)
|
|
679
|
+
)
|
|
680
|
+
),
|
|
681
|
+
namedtype.NamedType(
|
|
682
|
+
'error', ErrorMsgContent().subtype(
|
|
683
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 23)
|
|
684
|
+
)
|
|
685
|
+
),
|
|
686
|
+
namedtype.NamedType(
|
|
687
|
+
'certConf', CertConfirmContent().subtype(
|
|
688
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 24)
|
|
689
|
+
)
|
|
690
|
+
),
|
|
691
|
+
namedtype.NamedType(
|
|
692
|
+
'pollReq', PollReqContent().subtype(
|
|
693
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 25)
|
|
694
|
+
)
|
|
695
|
+
),
|
|
696
|
+
namedtype.NamedType(
|
|
697
|
+
'pollRep', PollRepContent().subtype(
|
|
698
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 26)
|
|
699
|
+
)
|
|
700
|
+
)
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
class PKIHeader(univ.Sequence):
|
|
705
|
+
"""
|
|
706
|
+
PKIHeader ::= SEQUENCE {
|
|
707
|
+
pvno INTEGER { cmp1999(1), cmp2000(2) },
|
|
708
|
+
sender GeneralName,
|
|
709
|
+
recipient GeneralName,
|
|
710
|
+
messageTime [0] GeneralizedTime OPTIONAL,
|
|
711
|
+
protectionAlg [1] AlgorithmIdentifier OPTIONAL,
|
|
712
|
+
senderKID [2] KeyIdentifier OPTIONAL,
|
|
713
|
+
recipKID [3] KeyIdentifier OPTIONAL,
|
|
714
|
+
transactionID [4] OCTET STRING OPTIONAL,
|
|
715
|
+
senderNonce [5] OCTET STRING OPTIONAL,
|
|
716
|
+
recipNonce [6] OCTET STRING OPTIONAL,
|
|
717
|
+
freeText [7] PKIFreeText OPTIONAL,
|
|
718
|
+
generalInfo [8] SEQUENCE SIZE (1..MAX) OF
|
|
719
|
+
InfoTypeAndValue OPTIONAL
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
"""
|
|
723
|
+
componentType = namedtype.NamedTypes(
|
|
724
|
+
namedtype.NamedType(
|
|
725
|
+
'pvno', univ.Integer(
|
|
726
|
+
namedValues=namedval.NamedValues(('cmp1999', 1), ('cmp2000', 2))
|
|
727
|
+
)
|
|
728
|
+
),
|
|
729
|
+
namedtype.NamedType('sender', rfc5280.GeneralName()),
|
|
730
|
+
namedtype.NamedType('recipient', rfc5280.GeneralName()),
|
|
731
|
+
namedtype.OptionalNamedType('messageTime', useful.GeneralizedTime().subtype(
|
|
732
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
733
|
+
namedtype.OptionalNamedType('protectionAlg', rfc5280.AlgorithmIdentifier().subtype(
|
|
734
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
|
735
|
+
namedtype.OptionalNamedType('senderKID', rfc5280.KeyIdentifier().subtype(
|
|
736
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
|
737
|
+
namedtype.OptionalNamedType('recipKID', rfc5280.KeyIdentifier().subtype(
|
|
738
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
|
739
|
+
namedtype.OptionalNamedType('transactionID', univ.OctetString().subtype(
|
|
740
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
|
741
|
+
namedtype.OptionalNamedType('senderNonce', univ.OctetString().subtype(
|
|
742
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
|
|
743
|
+
namedtype.OptionalNamedType('recipNonce', univ.OctetString().subtype(
|
|
744
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
|
|
745
|
+
namedtype.OptionalNamedType('freeText', PKIFreeText().subtype(
|
|
746
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7))),
|
|
747
|
+
namedtype.OptionalNamedType('generalInfo',
|
|
748
|
+
univ.SequenceOf(
|
|
749
|
+
componentType=InfoTypeAndValue().subtype(
|
|
750
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
751
|
+
)
|
|
752
|
+
).subtype(
|
|
753
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))
|
|
754
|
+
)
|
|
755
|
+
)
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
class ProtectedPart(univ.Sequence):
|
|
759
|
+
"""
|
|
760
|
+
ProtectedPart ::= SEQUENCE {
|
|
761
|
+
header PKIHeader,
|
|
762
|
+
body PKIBody
|
|
763
|
+
}
|
|
764
|
+
"""
|
|
765
|
+
componentType = namedtype.NamedTypes(
|
|
766
|
+
namedtype.NamedType('header', PKIHeader()),
|
|
767
|
+
namedtype.NamedType('infoValue', PKIBody())
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
class PKIMessage(univ.Sequence):
|
|
772
|
+
"""
|
|
773
|
+
PKIMessage ::= SEQUENCE {
|
|
774
|
+
header PKIHeader,
|
|
775
|
+
body PKIBody,
|
|
776
|
+
protection [0] PKIProtection OPTIONAL,
|
|
777
|
+
extraCerts [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
|
|
778
|
+
OPTIONAL
|
|
779
|
+
}"""
|
|
780
|
+
componentType = namedtype.NamedTypes(
|
|
781
|
+
namedtype.NamedType('header', PKIHeader()),
|
|
782
|
+
namedtype.NamedType('body', PKIBody()),
|
|
783
|
+
namedtype.OptionalNamedType('protection', PKIProtection().subtype(
|
|
784
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
785
|
+
namedtype.OptionalNamedType('extraCerts',
|
|
786
|
+
univ.SequenceOf(
|
|
787
|
+
componentType=CMPCertificate()
|
|
788
|
+
).subtype(
|
|
789
|
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
|
790
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
|
791
|
+
)
|
|
792
|
+
)
|
|
793
|
+
)
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
class PKIMessages(univ.SequenceOf):
|
|
797
|
+
"""
|
|
798
|
+
PKIMessages ::= SEQUENCE SIZE (1..MAX) OF PKIMessage
|
|
799
|
+
"""
|
|
800
|
+
componentType = PKIMessage()
|
|
801
|
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
|
805
|
+
# NestedMessageContent ::= PKIMessages
|
|
806
|
+
NestedMessageContent._componentType = PKIMessages()
|
|
807
|
+
nestedMessageContent._componentType = PKIMessages()
|