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,400 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
5
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
8
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
9
|
+
#
|
|
10
|
+
# An Internet Attribute Certificate Profile for Authorization
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc5755.txt
|
|
14
|
+
# https://www.rfc-editor.org/rfc/rfc5912.txt (see Section 13)
|
|
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 opentype
|
|
22
|
+
from pyasn1.type import tag
|
|
23
|
+
from pyasn1.type import univ
|
|
24
|
+
from pyasn1.type import useful
|
|
25
|
+
|
|
26
|
+
from pyasn1_alt_modules import rfc5280
|
|
27
|
+
from pyasn1_alt_modules import rfc5652
|
|
28
|
+
from pyasn1_alt_modules import opentypemap
|
|
29
|
+
|
|
30
|
+
certificateAttributesMap = opentypemap.get('certificateAttributesMap')
|
|
31
|
+
|
|
32
|
+
certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
|
|
33
|
+
|
|
34
|
+
securityCategoryMap = opentypemap.get('securityCategoryMap')
|
|
35
|
+
|
|
36
|
+
MAX = float('inf')
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Imports from RFC 5652
|
|
40
|
+
|
|
41
|
+
ContentInfo = rfc5652.ContentInfo
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Imports from RFC 5280
|
|
45
|
+
|
|
46
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
47
|
+
|
|
48
|
+
Attribute = rfc5280.Attribute
|
|
49
|
+
|
|
50
|
+
AuthorityInfoAccessSyntax = rfc5280.AuthorityInfoAccessSyntax
|
|
51
|
+
|
|
52
|
+
AuthorityKeyIdentifier = rfc5280.AuthorityKeyIdentifier
|
|
53
|
+
|
|
54
|
+
CertificateSerialNumber = rfc5280.CertificateSerialNumber
|
|
55
|
+
|
|
56
|
+
CRLDistributionPoints = rfc5280.CRLDistributionPoints
|
|
57
|
+
|
|
58
|
+
Extensions = rfc5280.Extensions
|
|
59
|
+
|
|
60
|
+
Extension = rfc5280.Extension
|
|
61
|
+
|
|
62
|
+
GeneralNames = rfc5280.GeneralNames
|
|
63
|
+
|
|
64
|
+
GeneralName = rfc5280.GeneralName
|
|
65
|
+
|
|
66
|
+
UniqueIdentifier = rfc5280.UniqueIdentifier
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Object Identifier arcs
|
|
70
|
+
|
|
71
|
+
id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
|
|
72
|
+
|
|
73
|
+
id_pe = id_pkix + (1, )
|
|
74
|
+
|
|
75
|
+
id_kp = id_pkix + (3, )
|
|
76
|
+
|
|
77
|
+
id_aca = id_pkix + (10, )
|
|
78
|
+
|
|
79
|
+
id_ad = id_pkix + (48, )
|
|
80
|
+
|
|
81
|
+
id_at = univ.ObjectIdentifier((2, 5, 4, ))
|
|
82
|
+
|
|
83
|
+
id_ce = univ.ObjectIdentifier((2, 5, 29, ))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Attribute Certificate
|
|
87
|
+
|
|
88
|
+
class AttCertVersion(univ.Integer):
|
|
89
|
+
namedValues = namedval.NamedValues(
|
|
90
|
+
('v2', 1)
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class IssuerSerial(univ.Sequence):
|
|
95
|
+
componentType = namedtype.NamedTypes(
|
|
96
|
+
namedtype.NamedType('issuer', GeneralNames()),
|
|
97
|
+
namedtype.NamedType('serial', CertificateSerialNumber()),
|
|
98
|
+
namedtype.OptionalNamedType('issuerUID', UniqueIdentifier())
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class ObjectDigestInfo(univ.Sequence):
|
|
103
|
+
componentType = namedtype.NamedTypes(
|
|
104
|
+
namedtype.NamedType('digestedObjectType',
|
|
105
|
+
univ.Enumerated(namedValues=namedval.NamedValues(
|
|
106
|
+
('publicKey', 0),
|
|
107
|
+
('publicKeyCert', 1),
|
|
108
|
+
('otherObjectTypes', 2)))),
|
|
109
|
+
namedtype.OptionalNamedType('otherObjectTypeID',
|
|
110
|
+
univ.ObjectIdentifier()),
|
|
111
|
+
namedtype.NamedType('digestAlgorithm',
|
|
112
|
+
AlgorithmIdentifier()),
|
|
113
|
+
namedtype.NamedType('objectDigest',
|
|
114
|
+
univ.BitString())
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class Holder(univ.Sequence):
|
|
119
|
+
componentType = namedtype.NamedTypes(
|
|
120
|
+
namedtype.OptionalNamedType('baseCertificateID',
|
|
121
|
+
IssuerSerial().subtype(implicitTag=tag.Tag(
|
|
122
|
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
123
|
+
namedtype.OptionalNamedType('entityName',
|
|
124
|
+
GeneralNames().subtype(implicitTag=tag.Tag(
|
|
125
|
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
126
|
+
namedtype.OptionalNamedType('objectDigestInfo',
|
|
127
|
+
ObjectDigestInfo().subtype(implicitTag=tag.Tag(
|
|
128
|
+
tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class V2Form(univ.Sequence):
|
|
133
|
+
componentType = namedtype.NamedTypes(
|
|
134
|
+
namedtype.OptionalNamedType('issuerName',
|
|
135
|
+
GeneralNames()),
|
|
136
|
+
namedtype.OptionalNamedType('baseCertificateID',
|
|
137
|
+
IssuerSerial().subtype(implicitTag=tag.Tag(
|
|
138
|
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
139
|
+
namedtype.OptionalNamedType('objectDigestInfo',
|
|
140
|
+
ObjectDigestInfo().subtype(implicitTag=tag.Tag(
|
|
141
|
+
tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class AttCertIssuer(univ.Choice):
|
|
146
|
+
componentType = namedtype.NamedTypes(
|
|
147
|
+
namedtype.NamedType('v1Form', GeneralNames()),
|
|
148
|
+
namedtype.NamedType('v2Form', V2Form().subtype(implicitTag=tag.Tag(
|
|
149
|
+
tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class AttCertValidityPeriod(univ.Sequence):
|
|
154
|
+
componentType = namedtype.NamedTypes(
|
|
155
|
+
namedtype.NamedType('notBeforeTime', useful.GeneralizedTime()),
|
|
156
|
+
namedtype.NamedType('notAfterTime', useful.GeneralizedTime())
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class AttributeCertificateInfo(univ.Sequence):
|
|
161
|
+
componentType = namedtype.NamedTypes(
|
|
162
|
+
namedtype.NamedType('version',
|
|
163
|
+
AttCertVersion()),
|
|
164
|
+
namedtype.NamedType('holder',
|
|
165
|
+
Holder()),
|
|
166
|
+
namedtype.NamedType('issuer',
|
|
167
|
+
AttCertIssuer()),
|
|
168
|
+
namedtype.NamedType('signature',
|
|
169
|
+
AlgorithmIdentifier()),
|
|
170
|
+
namedtype.NamedType('serialNumber',
|
|
171
|
+
CertificateSerialNumber()),
|
|
172
|
+
namedtype.NamedType('attrCertValidityPeriod',
|
|
173
|
+
AttCertValidityPeriod()),
|
|
174
|
+
namedtype.NamedType('attributes',
|
|
175
|
+
univ.SequenceOf(componentType=Attribute())),
|
|
176
|
+
namedtype.OptionalNamedType('issuerUniqueID',
|
|
177
|
+
UniqueIdentifier()),
|
|
178
|
+
namedtype.OptionalNamedType('extensions',
|
|
179
|
+
Extensions())
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class AttributeCertificate(univ.Sequence):
|
|
184
|
+
componentType = namedtype.NamedTypes(
|
|
185
|
+
namedtype.NamedType('acinfo', AttributeCertificateInfo()),
|
|
186
|
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
|
187
|
+
namedtype.NamedType('signatureValue', univ.BitString())
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# Attribute Certificate Extensions
|
|
192
|
+
|
|
193
|
+
id_pe_ac_auditIdentity = id_pe + (4, )
|
|
194
|
+
|
|
195
|
+
id_ce_noRevAvail = id_ce + (56, )
|
|
196
|
+
|
|
197
|
+
id_ce_targetInformation = id_ce + (55, )
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class TargetCert(univ.Sequence):
|
|
201
|
+
componentType = namedtype.NamedTypes(
|
|
202
|
+
namedtype.NamedType('targetCertificate', IssuerSerial()),
|
|
203
|
+
namedtype.OptionalNamedType('targetName', GeneralName()),
|
|
204
|
+
namedtype.OptionalNamedType('certDigestInfo', ObjectDigestInfo())
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class Target(univ.Choice):
|
|
209
|
+
componentType = namedtype.NamedTypes(
|
|
210
|
+
namedtype.NamedType('targetName',
|
|
211
|
+
GeneralName().subtype(implicitTag=tag.Tag(
|
|
212
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
213
|
+
namedtype.NamedType('targetGroup',
|
|
214
|
+
GeneralName().subtype(implicitTag=tag.Tag(
|
|
215
|
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
216
|
+
namedtype.NamedType('targetCert',
|
|
217
|
+
TargetCert().subtype(implicitTag=tag.Tag(
|
|
218
|
+
tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class Targets(univ.SequenceOf):
|
|
223
|
+
componentType = Target()
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
id_pe_ac_proxying = id_pe + (10, )
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class ProxyInfo(univ.SequenceOf):
|
|
230
|
+
componentType = Targets()
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
id_pe_aaControls = id_pe + (6, )
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class AttrSpec(univ.SequenceOf):
|
|
237
|
+
componentType = univ.ObjectIdentifier()
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
class AAControls(univ.Sequence):
|
|
241
|
+
componentType = namedtype.NamedTypes(
|
|
242
|
+
namedtype.OptionalNamedType('pathLenConstraint',
|
|
243
|
+
univ.Integer().subtype(
|
|
244
|
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
|
|
245
|
+
namedtype.OptionalNamedType('permittedAttrs',
|
|
246
|
+
AttrSpec().subtype(implicitTag=tag.Tag(
|
|
247
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
248
|
+
namedtype.OptionalNamedType('excludedAttrs',
|
|
249
|
+
AttrSpec().subtype(implicitTag=tag.Tag(
|
|
250
|
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
251
|
+
namedtype.DefaultedNamedType('permitUnSpecified',
|
|
252
|
+
univ.Boolean().subtype(value=1))
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
# Attribute Certificate Attributes
|
|
257
|
+
|
|
258
|
+
id_aca_authenticationInfo = id_aca + (1, )
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
id_aca_accessIdentity = id_aca + (2, )
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class SvceAuthInfo(univ.Sequence):
|
|
265
|
+
componentType = namedtype.NamedTypes(
|
|
266
|
+
namedtype.NamedType('service', GeneralName()),
|
|
267
|
+
namedtype.NamedType('ident', GeneralName()),
|
|
268
|
+
namedtype.OptionalNamedType('authInfo', univ.OctetString())
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
id_aca_chargingIdentity = id_aca + (3, )
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
id_aca_group = id_aca + (4, )
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class IetfAttrSyntax(univ.Sequence):
|
|
279
|
+
componentType = namedtype.NamedTypes(
|
|
280
|
+
namedtype.OptionalNamedType('policyAuthority',
|
|
281
|
+
GeneralNames().subtype(implicitTag=tag.Tag(
|
|
282
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
283
|
+
namedtype.NamedType('values', univ.SequenceOf(
|
|
284
|
+
componentType=univ.Choice(componentType=namedtype.NamedTypes(
|
|
285
|
+
namedtype.NamedType('octets', univ.OctetString()),
|
|
286
|
+
namedtype.NamedType('oid', univ.ObjectIdentifier()),
|
|
287
|
+
namedtype.NamedType('string', char.UTF8String())
|
|
288
|
+
))
|
|
289
|
+
))
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
id_at_role = id_at + (72,)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class RoleSyntax(univ.Sequence):
|
|
297
|
+
componentType = namedtype.NamedTypes(
|
|
298
|
+
namedtype.OptionalNamedType('roleAuthority',
|
|
299
|
+
GeneralNames().subtype(implicitTag=tag.Tag(
|
|
300
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
301
|
+
namedtype.NamedType('roleName',
|
|
302
|
+
GeneralName().subtype(implicitTag=tag.Tag(
|
|
303
|
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class ClassList(univ.BitString):
|
|
308
|
+
namedValues = namedval.NamedValues(
|
|
309
|
+
('unmarked', 0),
|
|
310
|
+
('unclassified', 1),
|
|
311
|
+
('restricted', 2),
|
|
312
|
+
('confidential', 3),
|
|
313
|
+
('secret', 4),
|
|
314
|
+
('topSecret', 5)
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class SecurityCategory(univ.Sequence):
|
|
319
|
+
componentType = namedtype.NamedTypes(
|
|
320
|
+
namedtype.NamedType('type',
|
|
321
|
+
univ.ObjectIdentifier().subtype(implicitTag=tag.Tag(
|
|
322
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
323
|
+
namedtype.NamedType('value',
|
|
324
|
+
univ.Any().subtype(implicitTag=tag.Tag(
|
|
325
|
+
tag.tagClassContext, tag.tagFormatSimple, 1)),
|
|
326
|
+
openType=opentype.OpenType('type', securityCategoryMap))
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
id_at_clearance = univ.ObjectIdentifier((2, 5, 4, 55, ))
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
class Clearance(univ.Sequence):
|
|
334
|
+
componentType = namedtype.NamedTypes(
|
|
335
|
+
namedtype.NamedType('policyId',
|
|
336
|
+
univ.ObjectIdentifier()),
|
|
337
|
+
namedtype.DefaultedNamedType('classList',
|
|
338
|
+
ClassList().subtype(value='unclassified')),
|
|
339
|
+
namedtype.OptionalNamedType('securityCategories',
|
|
340
|
+
univ.SetOf(componentType=SecurityCategory()))
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
id_at_clearance_rfc3281 = univ.ObjectIdentifier((2, 5, 1, 5, 55, ))
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class Clearance_rfc3281(univ.Sequence):
|
|
348
|
+
componentType = namedtype.NamedTypes(
|
|
349
|
+
namedtype.NamedType('policyId',
|
|
350
|
+
univ.ObjectIdentifier().subtype(implicitTag=tag.Tag(
|
|
351
|
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
352
|
+
namedtype.DefaultedNamedType('classList',
|
|
353
|
+
ClassList().subtype(implicitTag=tag.Tag(
|
|
354
|
+
tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(
|
|
355
|
+
value='unclassified')),
|
|
356
|
+
namedtype.OptionalNamedType('securityCategories',
|
|
357
|
+
univ.SetOf(componentType=SecurityCategory()).subtype(
|
|
358
|
+
implicitTag=tag.Tag(
|
|
359
|
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
id_aca_encAttrs = id_aca + (6, )
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class ACClearAttrs(univ.Sequence):
|
|
367
|
+
componentType = namedtype.NamedTypes(
|
|
368
|
+
namedtype.NamedType('acIssuer', GeneralName()),
|
|
369
|
+
namedtype.NamedType('acSerial', univ.Integer()),
|
|
370
|
+
namedtype.NamedType('attrs', univ.SequenceOf(componentType=Attribute()))
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
# Update the Certificate Extensions Map
|
|
375
|
+
|
|
376
|
+
_certificateExtensionsMapUpdate = {
|
|
377
|
+
id_pe_ac_auditIdentity: univ.OctetString(),
|
|
378
|
+
id_ce_noRevAvail: univ.Null(),
|
|
379
|
+
id_ce_targetInformation: Targets(),
|
|
380
|
+
id_pe_ac_proxying: ProxyInfo(),
|
|
381
|
+
id_pe_aaControls: AAControls(),
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
# Update the Certificate Attributes Map
|
|
388
|
+
|
|
389
|
+
_certificateAttributesMapUpdate = {
|
|
390
|
+
id_aca_authenticationInfo: SvceAuthInfo(),
|
|
391
|
+
id_aca_accessIdentity: SvceAuthInfo(),
|
|
392
|
+
id_aca_chargingIdentity: IetfAttrSyntax(),
|
|
393
|
+
id_aca_group: IetfAttrSyntax(),
|
|
394
|
+
id_at_role: RoleSyntax(),
|
|
395
|
+
id_at_clearance: Clearance(),
|
|
396
|
+
id_at_clearance_rfc3281: Clearance_rfc3281(),
|
|
397
|
+
id_aca_encAttrs: ContentInfo(),
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
5
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
8
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
9
|
+
#
|
|
10
|
+
# Authority Clearance Constraints Certificate Extension
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc5913.txt
|
|
14
|
+
# https://www.rfc-editor.org/errata/eid5890
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
from pyasn1.type import constraint
|
|
18
|
+
from pyasn1.type import univ
|
|
19
|
+
|
|
20
|
+
from pyasn1_alt_modules import rfc5755
|
|
21
|
+
from pyasn1_alt_modules import opentypemap
|
|
22
|
+
|
|
23
|
+
certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
|
|
24
|
+
|
|
25
|
+
MAX = float('inf')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Authority Clearance Constraints Certificate Extension
|
|
29
|
+
|
|
30
|
+
id_pe_clearanceConstraints = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.21')
|
|
31
|
+
|
|
32
|
+
id_pe_authorityClearanceConstraints = id_pe_clearanceConstraints
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AuthorityClearanceConstraints(univ.SequenceOf):
|
|
36
|
+
componentType = rfc5755.Clearance()
|
|
37
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Update the Certificate Extensions Map
|
|
41
|
+
|
|
42
|
+
_certificateExtensionsMapUpdate = {
|
|
43
|
+
id_pe_clearanceConstraints: AuthorityClearanceConstraints(),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# This file is part of pyasn1-alt-modules software.
|
|
2
|
+
#
|
|
3
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
6
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
7
|
+
#
|
|
8
|
+
# Trust Anchor Format
|
|
9
|
+
#
|
|
10
|
+
# ASN.1 source from:
|
|
11
|
+
# https://www.rfc-editor.org/rfc/rfc5914.txt
|
|
12
|
+
|
|
13
|
+
from pyasn1.type import char
|
|
14
|
+
from pyasn1.type import constraint
|
|
15
|
+
from pyasn1.type import namedtype
|
|
16
|
+
from pyasn1.type import namedval
|
|
17
|
+
from pyasn1.type import tag
|
|
18
|
+
from pyasn1.type import univ
|
|
19
|
+
|
|
20
|
+
from pyasn1_alt_modules import rfc5280
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
MAX = float('inf')
|
|
24
|
+
|
|
25
|
+
Certificate = rfc5280.Certificate
|
|
26
|
+
|
|
27
|
+
Name = rfc5280.Name
|
|
28
|
+
|
|
29
|
+
Extensions = rfc5280.Extensions
|
|
30
|
+
|
|
31
|
+
SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
|
|
32
|
+
|
|
33
|
+
TBSCertificate = rfc5280.TBSCertificate
|
|
34
|
+
|
|
35
|
+
CertificatePolicies = rfc5280.CertificatePolicies
|
|
36
|
+
|
|
37
|
+
KeyIdentifier = rfc5280.KeyIdentifier
|
|
38
|
+
|
|
39
|
+
NameConstraints = rfc5280.NameConstraints
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CertPolicyFlags(univ.BitString):
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
CertPolicyFlags.namedValues = namedval.NamedValues(
|
|
46
|
+
('inhibitPolicyMapping', 0),
|
|
47
|
+
('requireExplicitPolicy', 1),
|
|
48
|
+
('inhibitAnyPolicy', 2)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class CertPathControls(univ.Sequence):
|
|
53
|
+
pass
|
|
54
|
+
|
|
55
|
+
CertPathControls.componentType = namedtype.NamedTypes(
|
|
56
|
+
namedtype.NamedType('taName', Name()),
|
|
57
|
+
namedtype.OptionalNamedType('certificate', Certificate().subtype(
|
|
58
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
59
|
+
namedtype.OptionalNamedType('policySet', CertificatePolicies().subtype(
|
|
60
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
61
|
+
namedtype.OptionalNamedType('policyFlags', CertPolicyFlags().subtype(
|
|
62
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
|
63
|
+
namedtype.OptionalNamedType('nameConstr', NameConstraints().subtype(
|
|
64
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
|
65
|
+
namedtype.OptionalNamedType('pathLenConstraint', univ.Integer().subtype(
|
|
66
|
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX)).subtype(
|
|
67
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class TrustAnchorTitle(char.UTF8String):
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
TrustAnchorTitle.subtypeSpec = constraint.ValueSizeConstraint(1, 64)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class TrustAnchorInfoVersion(univ.Integer):
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
TrustAnchorInfoVersion.namedValues = namedval.NamedValues(
|
|
81
|
+
('v1', 1)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class TrustAnchorInfo(univ.Sequence):
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
TrustAnchorInfo.componentType = namedtype.NamedTypes(
|
|
89
|
+
namedtype.DefaultedNamedType('version', TrustAnchorInfoVersion().subtype(value='v1')),
|
|
90
|
+
namedtype.NamedType('pubKey', SubjectPublicKeyInfo()),
|
|
91
|
+
namedtype.NamedType('keyId', KeyIdentifier()),
|
|
92
|
+
namedtype.OptionalNamedType('taTitle', TrustAnchorTitle()),
|
|
93
|
+
namedtype.OptionalNamedType('certPath', CertPathControls()),
|
|
94
|
+
namedtype.OptionalNamedType('exts', Extensions().subtype(explicitTag=tag.Tag(
|
|
95
|
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
96
|
+
namedtype.OptionalNamedType('taTitleLangTag', char.UTF8String().subtype(
|
|
97
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class TrustAnchorChoice(univ.Choice):
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
TrustAnchorChoice.componentType = namedtype.NamedTypes(
|
|
105
|
+
namedtype.NamedType('certificate', Certificate()),
|
|
106
|
+
namedtype.NamedType('tbsCert', TBSCertificate().subtype(
|
|
107
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
|
108
|
+
namedtype.NamedType('taInfo', TrustAnchorInfo().subtype(
|
|
109
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
id_ct_trustAnchorList = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.34')
|
|
114
|
+
|
|
115
|
+
class TrustAnchorList(univ.SequenceOf):
|
|
116
|
+
pass
|
|
117
|
+
|
|
118
|
+
TrustAnchorList.componentType = TrustAnchorChoice()
|
|
119
|
+
TrustAnchorList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# This file is part of pyasn1-alt-modules software.
|
|
2
|
+
#
|
|
3
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
6
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
7
|
+
#
|
|
8
|
+
# Elliptic Curve Private Key
|
|
9
|
+
#
|
|
10
|
+
# ASN.1 source from:
|
|
11
|
+
# https://www.rfc-editor.org/rfc/rfc5915.txt
|
|
12
|
+
|
|
13
|
+
from pyasn1.type import namedtype
|
|
14
|
+
from pyasn1.type import namedval
|
|
15
|
+
from pyasn1.type import tag
|
|
16
|
+
from pyasn1.type import univ
|
|
17
|
+
|
|
18
|
+
from pyasn1_alt_modules import rfc5480
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ECPrivateKey(univ.Sequence):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
ECPrivateKey.componentType = namedtype.NamedTypes(
|
|
25
|
+
namedtype.NamedType('version', univ.Integer(
|
|
26
|
+
namedValues=namedval.NamedValues(('ecPrivkeyVer1', 1)))),
|
|
27
|
+
namedtype.NamedType('privateKey', univ.OctetString()),
|
|
28
|
+
namedtype.OptionalNamedType('parameters', rfc5480.ECParameters().subtype(
|
|
29
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
30
|
+
namedtype.OptionalNamedType('publicKey', univ.BitString().subtype(
|
|
31
|
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
|
32
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
# Device Owner Attribute
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc5916.txt
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
from pyasn1.type import univ
|
|
17
|
+
|
|
18
|
+
from pyasn1_alt_modules import rfc5280
|
|
19
|
+
from pyasn1_alt_modules import opentypemap
|
|
20
|
+
|
|
21
|
+
certificateAttributesMap = opentypemap.get('certificateAttributesMap')
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Device Owner Attribute
|
|
25
|
+
|
|
26
|
+
id_deviceOwner = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 69))
|
|
27
|
+
|
|
28
|
+
at_deviceOwner = rfc5280.Attribute()
|
|
29
|
+
at_deviceOwner['type'] = id_deviceOwner
|
|
30
|
+
at_deviceOwner['values'][0] = univ.ObjectIdentifier()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Update the Certificate Attributes Map
|
|
34
|
+
|
|
35
|
+
_certificateAttributesMapUpdate = {
|
|
36
|
+
id_deviceOwner: univ.ObjectIdentifier(),
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
# Clearance Sponsor Attribute
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc5917.txt
|
|
14
|
+
# https://www.rfc-editor.org/errata/eid4558
|
|
15
|
+
# https://www.rfc-editor.org/errata/eid5883
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
from pyasn1.type import char
|
|
19
|
+
from pyasn1.type import constraint
|
|
20
|
+
from pyasn1.type import namedtype
|
|
21
|
+
from pyasn1.type import univ
|
|
22
|
+
|
|
23
|
+
from pyasn1_alt_modules import rfc5280
|
|
24
|
+
from pyasn1_alt_modules import opentypemap
|
|
25
|
+
|
|
26
|
+
certificateAttributesMap = opentypemap.get('certificateAttributesMap')
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# DirectoryString is the same as RFC 5280, except for two things:
|
|
30
|
+
# 1. the length is limited to 64;
|
|
31
|
+
# 2. only the 'utf8String' choice remains because the ASN.1
|
|
32
|
+
# specification says: ( WITH COMPONENTS { utf8String PRESENT } )
|
|
33
|
+
|
|
34
|
+
class DirectoryString(univ.Choice):
|
|
35
|
+
componentType = namedtype.NamedTypes(
|
|
36
|
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
|
37
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, 64))),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Clearance Sponsor Attribute
|
|
42
|
+
|
|
43
|
+
id_clearanceSponsor = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 68))
|
|
44
|
+
|
|
45
|
+
ub_clearance_sponsor = univ.Integer(64)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
at_clearanceSponsor = rfc5280.Attribute()
|
|
49
|
+
at_clearanceSponsor['type'] = id_clearanceSponsor
|
|
50
|
+
at_clearanceSponsor['values'][0] = DirectoryString()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Update the Certificate Attributes Map
|
|
54
|
+
|
|
55
|
+
_certificateAttributesMapUpdate = {
|
|
56
|
+
id_clearanceSponsor: DirectoryString(),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
certificateAttributesMap.update(_certificateAttributesMapUpdate)
|