koichi12 commited on
Commit
b1c5991
·
verified ·
1 Parent(s): 0b0d656

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .venv/lib/python3.11/site-packages/pyasn1_modules/__init__.py +2 -0
  2. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc1157.cpython-311.pyc +0 -0
  3. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2251.cpython-311.pyc +0 -0
  4. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2560.cpython-311.pyc +0 -0
  5. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2631.cpython-311.pyc +0 -0
  6. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc3657.cpython-311.pyc +0 -0
  7. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4043.cpython-311.pyc +0 -0
  8. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4490.cpython-311.pyc +0 -0
  9. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4683.cpython-311.pyc +0 -0
  10. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5751.cpython-311.pyc +0 -0
  11. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5917.cpython-311.pyc +0 -0
  12. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5990.cpython-311.pyc +0 -0
  13. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc6187.cpython-311.pyc +0 -0
  14. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc6210.cpython-311.pyc +0 -0
  15. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7585.cpython-311.pyc +0 -0
  16. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7633.cpython-311.pyc +0 -0
  17. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7773.cpython-311.pyc +0 -0
  18. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7914.cpython-311.pyc +0 -0
  19. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8017.cpython-311.pyc +0 -0
  20. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8103.cpython-311.pyc +0 -0
  21. .venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8692.cpython-311.pyc +0 -0
  22. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc1157.py +126 -0
  23. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2251.py +563 -0
  24. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2314.py +48 -0
  25. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2437.py +69 -0
  26. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2560.py +225 -0
  27. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2634.py +336 -0
  28. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2986.py +75 -0
  29. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3125.py +469 -0
  30. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3279.py +260 -0
  31. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3281.py +331 -0
  32. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3370.py +146 -0
  33. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3414.py +28 -0
  34. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3820.py +65 -0
  35. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3852.py +706 -0
  36. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4043.py +43 -0
  37. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4073.py +59 -0
  38. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4211.py +396 -0
  39. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4334.py +75 -0
  40. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4357.py +477 -0
  41. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4387.py +23 -0
  42. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4490.py +113 -0
  43. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4491.py +44 -0
  44. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4683.py +72 -0
  45. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5083.py +52 -0
  46. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5084.py +97 -0
  47. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5275.py +404 -0
  48. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5280.py +1658 -0
  49. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5697.py +70 -0
  50. .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5751.py +124 -0
.venv/lib/python3.11/site-packages/pyasn1_modules/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # http://www.python.org/dev/peps/pep-0396/
2
+ __version__ = '0.4.1'
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc1157.cpython-311.pyc ADDED
Binary file (7.17 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2251.cpython-311.pyc ADDED
Binary file (37.3 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2560.cpython-311.pyc ADDED
Binary file (15.4 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc2631.cpython-311.pyc ADDED
Binary file (2.1 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc3657.cpython-311.pyc ADDED
Binary file (2.2 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4043.cpython-311.pyc ADDED
Binary file (1.36 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4490.cpython-311.pyc ADDED
Binary file (4.47 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc4683.cpython-311.pyc ADDED
Binary file (2.73 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5751.cpython-311.pyc ADDED
Binary file (4.3 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5917.cpython-311.pyc ADDED
Binary file (1.68 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc5990.cpython-311.pyc ADDED
Binary file (7.7 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc6187.cpython-311.pyc ADDED
Binary file (471 Bytes). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc6210.cpython-311.pyc ADDED
Binary file (1.23 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7585.cpython-311.pyc ADDED
Binary file (1.32 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7633.cpython-311.pyc ADDED
Binary file (954 Bytes). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7773.cpython-311.pyc ADDED
Binary file (1.85 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc7914.cpython-311.pyc ADDED
Binary file (2.14 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8017.cpython-311.pyc ADDED
Binary file (5.98 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8103.cpython-311.pyc ADDED
Binary file (1.39 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/__pycache__/rfc8692.cpython-311.pyc ADDED
Binary file (1.77 kB). View file
 
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc1157.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # SNMPv1 message syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://www.ietf.org/rfc/rfc1157.txt
11
+ #
12
+ # Sample captures from:
13
+ # http://wiki.wireshark.org/SampleCaptures/
14
+ #
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_modules import rfc1155
21
+
22
+
23
+ class Version(univ.Integer):
24
+ namedValues = namedval.NamedValues(
25
+ ('version-1', 0)
26
+ )
27
+ defaultValue = 0
28
+
29
+
30
+ class Community(univ.OctetString):
31
+ pass
32
+
33
+
34
+ class RequestID(univ.Integer):
35
+ pass
36
+
37
+
38
+ class ErrorStatus(univ.Integer):
39
+ namedValues = namedval.NamedValues(
40
+ ('noError', 0),
41
+ ('tooBig', 1),
42
+ ('noSuchName', 2),
43
+ ('badValue', 3),
44
+ ('readOnly', 4),
45
+ ('genErr', 5)
46
+ )
47
+
48
+
49
+ class ErrorIndex(univ.Integer):
50
+ pass
51
+
52
+
53
+ class VarBind(univ.Sequence):
54
+ componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('name', rfc1155.ObjectName()),
56
+ namedtype.NamedType('value', rfc1155.ObjectSyntax())
57
+ )
58
+
59
+
60
+ class VarBindList(univ.SequenceOf):
61
+ componentType = VarBind()
62
+
63
+
64
+ class _RequestBase(univ.Sequence):
65
+ componentType = namedtype.NamedTypes(
66
+ namedtype.NamedType('request-id', RequestID()),
67
+ namedtype.NamedType('error-status', ErrorStatus()),
68
+ namedtype.NamedType('error-index', ErrorIndex()),
69
+ namedtype.NamedType('variable-bindings', VarBindList())
70
+ )
71
+
72
+
73
+ class GetRequestPDU(_RequestBase):
74
+ tagSet = _RequestBase.tagSet.tagImplicitly(
75
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
76
+ )
77
+
78
+
79
+ class GetNextRequestPDU(_RequestBase):
80
+ tagSet = _RequestBase.tagSet.tagImplicitly(
81
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
82
+ )
83
+
84
+
85
+ class GetResponsePDU(_RequestBase):
86
+ tagSet = _RequestBase.tagSet.tagImplicitly(
87
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
88
+ )
89
+
90
+
91
+ class SetRequestPDU(_RequestBase):
92
+ tagSet = _RequestBase.tagSet.tagImplicitly(
93
+ tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
94
+ )
95
+
96
+
97
+ class TrapPDU(univ.Sequence):
98
+ componentType = namedtype.NamedTypes(
99
+ namedtype.NamedType('enterprise', univ.ObjectIdentifier()),
100
+ namedtype.NamedType('agent-addr', rfc1155.NetworkAddress()),
101
+ namedtype.NamedType('generic-trap', univ.Integer().clone(
102
+ namedValues=namedval.NamedValues(('coldStart', 0), ('warmStart', 1), ('linkDown', 2), ('linkUp', 3),
103
+ ('authenticationFailure', 4), ('egpNeighborLoss', 5),
104
+ ('enterpriseSpecific', 6)))),
105
+ namedtype.NamedType('specific-trap', univ.Integer()),
106
+ namedtype.NamedType('time-stamp', rfc1155.TimeTicks()),
107
+ namedtype.NamedType('variable-bindings', VarBindList())
108
+ )
109
+
110
+
111
+ class Pdus(univ.Choice):
112
+ componentType = namedtype.NamedTypes(
113
+ namedtype.NamedType('get-request', GetRequestPDU()),
114
+ namedtype.NamedType('get-next-request', GetNextRequestPDU()),
115
+ namedtype.NamedType('get-response', GetResponsePDU()),
116
+ namedtype.NamedType('set-request', SetRequestPDU()),
117
+ namedtype.NamedType('trap', TrapPDU())
118
+ )
119
+
120
+
121
+ class Message(univ.Sequence):
122
+ componentType = namedtype.NamedTypes(
123
+ namedtype.NamedType('version', Version()),
124
+ namedtype.NamedType('community', Community()),
125
+ namedtype.NamedType('data', Pdus())
126
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2251.py ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # LDAP message syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/ldap.asn
11
+ #
12
+ # Sample captures from:
13
+ # http://wiki.wireshark.org/SampleCaptures/
14
+ #
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import namedval
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+
21
+ maxInt = univ.Integer(2147483647)
22
+
23
+
24
+ class LDAPString(univ.OctetString):
25
+ pass
26
+
27
+
28
+ class LDAPOID(univ.OctetString):
29
+ pass
30
+
31
+
32
+ class LDAPDN(LDAPString):
33
+ pass
34
+
35
+
36
+ class RelativeLDAPDN(LDAPString):
37
+ pass
38
+
39
+
40
+ class AttributeType(LDAPString):
41
+ pass
42
+
43
+
44
+ class AttributeDescription(LDAPString):
45
+ pass
46
+
47
+
48
+ class AttributeDescriptionList(univ.SequenceOf):
49
+ componentType = AttributeDescription()
50
+
51
+
52
+ class AttributeValue(univ.OctetString):
53
+ pass
54
+
55
+
56
+ class AssertionValue(univ.OctetString):
57
+ pass
58
+
59
+
60
+ class AttributeValueAssertion(univ.Sequence):
61
+ componentType = namedtype.NamedTypes(
62
+ namedtype.NamedType('attributeDesc', AttributeDescription()),
63
+ namedtype.NamedType('assertionValue', AssertionValue())
64
+ )
65
+
66
+
67
+ class Attribute(univ.Sequence):
68
+ componentType = namedtype.NamedTypes(
69
+ namedtype.NamedType('type', AttributeDescription()),
70
+ namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
71
+ )
72
+
73
+
74
+ class MatchingRuleId(LDAPString):
75
+ pass
76
+
77
+
78
+ class Control(univ.Sequence):
79
+ componentType = namedtype.NamedTypes(
80
+ namedtype.NamedType('controlType', LDAPOID()),
81
+ namedtype.DefaultedNamedType('criticality', univ.Boolean('False')),
82
+ namedtype.OptionalNamedType('controlValue', univ.OctetString())
83
+ )
84
+
85
+
86
+ class Controls(univ.SequenceOf):
87
+ componentType = Control()
88
+
89
+
90
+ class LDAPURL(LDAPString):
91
+ pass
92
+
93
+
94
+ class Referral(univ.SequenceOf):
95
+ componentType = LDAPURL()
96
+
97
+
98
+ class SaslCredentials(univ.Sequence):
99
+ componentType = namedtype.NamedTypes(
100
+ namedtype.NamedType('mechanism', LDAPString()),
101
+ namedtype.OptionalNamedType('credentials', univ.OctetString())
102
+ )
103
+
104
+
105
+ class AuthenticationChoice(univ.Choice):
106
+ componentType = namedtype.NamedTypes(
107
+ namedtype.NamedType('simple', univ.OctetString().subtype(
108
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
109
+ namedtype.NamedType('reserved-1', univ.OctetString().subtype(
110
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
111
+ namedtype.NamedType('reserved-2', univ.OctetString().subtype(
112
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
113
+ namedtype.NamedType('sasl',
114
+ SaslCredentials().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
115
+ )
116
+
117
+
118
+ class BindRequest(univ.Sequence):
119
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
120
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 0)
121
+ )
122
+ componentType = namedtype.NamedTypes(
123
+ namedtype.NamedType('version', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 127))),
124
+ namedtype.NamedType('name', LDAPDN()),
125
+ namedtype.NamedType('authentication', AuthenticationChoice())
126
+ )
127
+
128
+
129
+ class PartialAttributeList(univ.SequenceOf):
130
+ componentType = univ.Sequence(
131
+ componentType=namedtype.NamedTypes(
132
+ namedtype.NamedType('type', AttributeDescription()),
133
+ namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
134
+ )
135
+ )
136
+
137
+
138
+ class SearchResultEntry(univ.Sequence):
139
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
140
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 4)
141
+ )
142
+ componentType = namedtype.NamedTypes(
143
+ namedtype.NamedType('objectName', LDAPDN()),
144
+ namedtype.NamedType('attributes', PartialAttributeList())
145
+ )
146
+
147
+
148
+ class MatchingRuleAssertion(univ.Sequence):
149
+ componentType = namedtype.NamedTypes(
150
+ namedtype.OptionalNamedType('matchingRule', MatchingRuleId().subtype(
151
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
152
+ namedtype.OptionalNamedType('type', AttributeDescription().subtype(
153
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
154
+ namedtype.NamedType('matchValue',
155
+ AssertionValue().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
156
+ namedtype.DefaultedNamedType('dnAttributes', univ.Boolean('False').subtype(
157
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
158
+ )
159
+
160
+
161
+ class SubstringFilter(univ.Sequence):
162
+ componentType = namedtype.NamedTypes(
163
+ namedtype.NamedType('type', AttributeDescription()),
164
+ namedtype.NamedType('substrings',
165
+ univ.SequenceOf(
166
+ componentType=univ.Choice(
167
+ componentType=namedtype.NamedTypes(
168
+ namedtype.NamedType(
169
+ 'initial', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
170
+ ),
171
+ namedtype.NamedType(
172
+ 'any', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))
173
+ ),
174
+ namedtype.NamedType(
175
+ 'final', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))
176
+ )
177
+ )
178
+ )
179
+ )
180
+ )
181
+ )
182
+
183
+
184
+ # Ugly hack to handle recursive Filter reference (up to 3-levels deep).
185
+
186
+ class Filter3(univ.Choice):
187
+ componentType = namedtype.NamedTypes(
188
+ namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
189
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
190
+ namedtype.NamedType('substrings', SubstringFilter().subtype(
191
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
192
+ namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
193
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
194
+ namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
195
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
196
+ namedtype.NamedType('present', AttributeDescription().subtype(
197
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
198
+ namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
199
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
200
+ namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
201
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
202
+ )
203
+
204
+
205
+ class Filter2(univ.Choice):
206
+ componentType = namedtype.NamedTypes(
207
+ namedtype.NamedType('and', univ.SetOf(componentType=Filter3()).subtype(
208
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
209
+ namedtype.NamedType('or', univ.SetOf(componentType=Filter3()).subtype(
210
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
211
+ namedtype.NamedType('not',
212
+ Filter3().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
213
+ namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
214
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
215
+ namedtype.NamedType('substrings', SubstringFilter().subtype(
216
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
217
+ namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
218
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
219
+ namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
220
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
221
+ namedtype.NamedType('present', AttributeDescription().subtype(
222
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
223
+ namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
224
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
225
+ namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
226
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
227
+ )
228
+
229
+
230
+ class Filter(univ.Choice):
231
+ componentType = namedtype.NamedTypes(
232
+ namedtype.NamedType('and', univ.SetOf(componentType=Filter2()).subtype(
233
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
234
+ namedtype.NamedType('or', univ.SetOf(componentType=Filter2()).subtype(
235
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
236
+ namedtype.NamedType('not',
237
+ Filter2().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
238
+ namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
239
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
240
+ namedtype.NamedType('substrings', SubstringFilter().subtype(
241
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
242
+ namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
243
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
244
+ namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
245
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
246
+ namedtype.NamedType('present', AttributeDescription().subtype(
247
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
248
+ namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
249
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
250
+ namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
251
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
252
+ )
253
+
254
+
255
+ # End of Filter hack
256
+
257
+ class SearchRequest(univ.Sequence):
258
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
259
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 3)
260
+ )
261
+ componentType = namedtype.NamedTypes(
262
+ namedtype.NamedType('baseObject', LDAPDN()),
263
+ namedtype.NamedType('scope', univ.Enumerated(
264
+ namedValues=namedval.NamedValues(('baseObject', 0), ('singleLevel', 1), ('wholeSubtree', 2)))),
265
+ namedtype.NamedType('derefAliases', univ.Enumerated(
266
+ namedValues=namedval.NamedValues(('neverDerefAliases', 0), ('derefInSearching', 1),
267
+ ('derefFindingBaseObj', 2), ('derefAlways', 3)))),
268
+ namedtype.NamedType('sizeLimit',
269
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, maxInt))),
270
+ namedtype.NamedType('timeLimit',
271
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, maxInt))),
272
+ namedtype.NamedType('typesOnly', univ.Boolean()),
273
+ namedtype.NamedType('filter', Filter()),
274
+ namedtype.NamedType('attributes', AttributeDescriptionList())
275
+ )
276
+
277
+
278
+ class UnbindRequest(univ.Null):
279
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
280
+ tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)
281
+ )
282
+
283
+
284
+ class BindResponse(univ.Sequence):
285
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
286
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1)
287
+ )
288
+ componentType = namedtype.NamedTypes(
289
+ namedtype.NamedType('resultCode', univ.Enumerated(
290
+ namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
291
+ ('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
292
+ ('compareTrue', 6), ('authMethodNotSupported', 7),
293
+ ('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
294
+ ('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
295
+ ('confidentialityRequired', 13), ('saslBindInProgress', 14),
296
+ ('noSuchAttribute', 16), ('undefinedAttributeType', 17),
297
+ ('inappropriateMatching', 18), ('constraintViolation', 19),
298
+ ('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
299
+ ('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
300
+ ('reserved-35', 35), ('aliasDereferencingProblem', 36),
301
+ ('inappropriateAuthentication', 48), ('invalidCredentials', 49),
302
+ ('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
303
+ ('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
304
+ ('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
305
+ ('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
306
+ ('objectClassModsProhibited', 69), ('reserved-70', 70),
307
+ ('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
308
+ ('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
309
+ ('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
310
+ ('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
311
+ namedtype.NamedType('matchedDN', LDAPDN()),
312
+ namedtype.NamedType('errorMessage', LDAPString()),
313
+ namedtype.OptionalNamedType('referral', Referral().subtype(
314
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
315
+ namedtype.OptionalNamedType('serverSaslCreds', univ.OctetString().subtype(
316
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)))
317
+ )
318
+
319
+
320
+ class LDAPResult(univ.Sequence):
321
+ componentType = namedtype.NamedTypes(
322
+ namedtype.NamedType('resultCode', univ.Enumerated(
323
+ namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
324
+ ('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
325
+ ('compareTrue', 6), ('authMethodNotSupported', 7),
326
+ ('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
327
+ ('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
328
+ ('confidentialityRequired', 13), ('saslBindInProgress', 14),
329
+ ('noSuchAttribute', 16), ('undefinedAttributeType', 17),
330
+ ('inappropriateMatching', 18), ('constraintViolation', 19),
331
+ ('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
332
+ ('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
333
+ ('reserved-35', 35), ('aliasDereferencingProblem', 36),
334
+ ('inappropriateAuthentication', 48), ('invalidCredentials', 49),
335
+ ('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
336
+ ('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
337
+ ('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
338
+ ('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
339
+ ('objectClassModsProhibited', 69), ('reserved-70', 70),
340
+ ('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
341
+ ('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
342
+ ('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
343
+ ('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
344
+ namedtype.NamedType('matchedDN', LDAPDN()),
345
+ namedtype.NamedType('errorMessage', LDAPString()),
346
+ namedtype.OptionalNamedType('referral', Referral().subtype(
347
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
348
+ )
349
+
350
+
351
+ class SearchResultReference(univ.SequenceOf):
352
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
353
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 19)
354
+ )
355
+ componentType = LDAPURL()
356
+
357
+
358
+ class SearchResultDone(LDAPResult):
359
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
360
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 5)
361
+ )
362
+
363
+
364
+ class AttributeTypeAndValues(univ.Sequence):
365
+ componentType = namedtype.NamedTypes(
366
+ namedtype.NamedType('type', AttributeDescription()),
367
+ namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
368
+ )
369
+
370
+
371
+ class ModifyRequest(univ.Sequence):
372
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
373
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 6)
374
+ )
375
+ componentType = namedtype.NamedTypes(
376
+ namedtype.NamedType('object', LDAPDN()),
377
+ namedtype.NamedType('modification',
378
+ univ.SequenceOf(
379
+ componentType=univ.Sequence(
380
+ componentType=namedtype.NamedTypes(
381
+ namedtype.NamedType(
382
+ 'operation', univ.Enumerated(namedValues=namedval.NamedValues(('add', 0), ('delete', 1), ('replace', 2)))
383
+ ),
384
+ namedtype.NamedType('modification', AttributeTypeAndValues())))
385
+ )
386
+ )
387
+ )
388
+
389
+
390
+ class ModifyResponse(LDAPResult):
391
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
392
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 7)
393
+ )
394
+
395
+
396
+ class AttributeList(univ.SequenceOf):
397
+ componentType = univ.Sequence(
398
+ componentType=namedtype.NamedTypes(
399
+ namedtype.NamedType('type', AttributeDescription()),
400
+ namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
401
+ )
402
+ )
403
+
404
+
405
+ class AddRequest(univ.Sequence):
406
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
407
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 8)
408
+ )
409
+ componentType = namedtype.NamedTypes(
410
+ namedtype.NamedType('entry', LDAPDN()),
411
+ namedtype.NamedType('attributes', AttributeList())
412
+ )
413
+
414
+
415
+ class AddResponse(LDAPResult):
416
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
417
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 9)
418
+ )
419
+
420
+
421
+ class DelRequest(LDAPResult):
422
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
423
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 10)
424
+ )
425
+
426
+
427
+ class DelResponse(LDAPResult):
428
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
429
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 11)
430
+ )
431
+
432
+
433
+ class ModifyDNRequest(univ.Sequence):
434
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
435
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 12)
436
+ )
437
+ componentType = namedtype.NamedTypes(
438
+ namedtype.NamedType('entry', LDAPDN()),
439
+ namedtype.NamedType('newrdn', RelativeLDAPDN()),
440
+ namedtype.NamedType('deleteoldrdn', univ.Boolean()),
441
+ namedtype.OptionalNamedType('newSuperior',
442
+ LDAPDN().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
443
+
444
+ )
445
+
446
+
447
+ class ModifyDNResponse(LDAPResult):
448
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
449
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 13)
450
+ )
451
+
452
+
453
+ class CompareRequest(univ.Sequence):
454
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
455
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 14)
456
+ )
457
+ componentType = namedtype.NamedTypes(
458
+ namedtype.NamedType('entry', LDAPDN()),
459
+ namedtype.NamedType('ava', AttributeValueAssertion())
460
+ )
461
+
462
+
463
+ class CompareResponse(LDAPResult):
464
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
465
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 15)
466
+ )
467
+
468
+
469
+ class AbandonRequest(LDAPResult):
470
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
471
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 16)
472
+ )
473
+
474
+
475
+ class ExtendedRequest(univ.Sequence):
476
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
477
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 23)
478
+ )
479
+ componentType = namedtype.NamedTypes(
480
+ namedtype.NamedType('requestName',
481
+ LDAPOID().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
482
+ namedtype.OptionalNamedType('requestValue', univ.OctetString().subtype(
483
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
484
+ )
485
+
486
+
487
+ class ExtendedResponse(univ.Sequence):
488
+ tagSet = univ.Sequence.tagSet.tagImplicitly(
489
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 24)
490
+ )
491
+ componentType = namedtype.NamedTypes(
492
+ namedtype.NamedType('resultCode', univ.Enumerated(
493
+ namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
494
+ ('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
495
+ ('compareTrue', 6), ('authMethodNotSupported', 7),
496
+ ('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
497
+ ('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
498
+ ('confidentialityRequired', 13), ('saslBindInProgress', 14),
499
+ ('noSuchAttribute', 16), ('undefinedAttributeType', 17),
500
+ ('inappropriateMatching', 18), ('constraintViolation', 19),
501
+ ('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
502
+ ('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
503
+ ('reserved-35', 35), ('aliasDereferencingProblem', 36),
504
+ ('inappropriateAuthentication', 48), ('invalidCredentials', 49),
505
+ ('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
506
+ ('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
507
+ ('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
508
+ ('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
509
+ ('objectClassModsProhibited', 69), ('reserved-70', 70),
510
+ ('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
511
+ ('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
512
+ ('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
513
+ ('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
514
+ namedtype.NamedType('matchedDN', LDAPDN()),
515
+ namedtype.NamedType('errorMessage', LDAPString()),
516
+ namedtype.OptionalNamedType('referral', Referral().subtype(
517
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
518
+
519
+ namedtype.OptionalNamedType('responseName', LDAPOID().subtype(
520
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 10))),
521
+ namedtype.OptionalNamedType('response', univ.OctetString().subtype(
522
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 11)))
523
+ )
524
+
525
+
526
+ class MessageID(univ.Integer):
527
+ subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
528
+ 0, maxInt
529
+ )
530
+
531
+
532
+ class LDAPMessage(univ.Sequence):
533
+ componentType = namedtype.NamedTypes(
534
+ namedtype.NamedType('messageID', MessageID()),
535
+ namedtype.NamedType(
536
+ 'protocolOp', univ.Choice(
537
+ componentType=namedtype.NamedTypes(
538
+ namedtype.NamedType('bindRequest', BindRequest()),
539
+ namedtype.NamedType('bindResponse', BindResponse()),
540
+ namedtype.NamedType('unbindRequest', UnbindRequest()),
541
+ namedtype.NamedType('searchRequest', SearchRequest()),
542
+ namedtype.NamedType('searchResEntry', SearchResultEntry()),
543
+ namedtype.NamedType('searchResDone', SearchResultDone()),
544
+ namedtype.NamedType('searchResRef', SearchResultReference()),
545
+ namedtype.NamedType('modifyRequest', ModifyRequest()),
546
+ namedtype.NamedType('modifyResponse', ModifyResponse()),
547
+ namedtype.NamedType('addRequest', AddRequest()),
548
+ namedtype.NamedType('addResponse', AddResponse()),
549
+ namedtype.NamedType('delRequest', DelRequest()),
550
+ namedtype.NamedType('delResponse', DelResponse()),
551
+ namedtype.NamedType('modDNRequest', ModifyDNRequest()),
552
+ namedtype.NamedType('modDNResponse', ModifyDNResponse()),
553
+ namedtype.NamedType('compareRequest', CompareRequest()),
554
+ namedtype.NamedType('compareResponse', CompareResponse()),
555
+ namedtype.NamedType('abandonRequest', AbandonRequest()),
556
+ namedtype.NamedType('extendedReq', ExtendedRequest()),
557
+ namedtype.NamedType('extendedResp', ExtendedResponse())
558
+ )
559
+ )
560
+ ),
561
+ namedtype.OptionalNamedType('controls', Controls().subtype(
562
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
563
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2314.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # PKCS#10 syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://tools.ietf.org/html/rfc2314
11
+ #
12
+ # Sample captures could be obtained with "openssl req" command
13
+ #
14
+ from pyasn1_modules.rfc2459 import *
15
+
16
+
17
+ class Attributes(univ.SetOf):
18
+ componentType = Attribute()
19
+
20
+
21
+ class Version(univ.Integer):
22
+ pass
23
+
24
+
25
+ class CertificationRequestInfo(univ.Sequence):
26
+ componentType = namedtype.NamedTypes(
27
+ namedtype.NamedType('version', Version()),
28
+ namedtype.NamedType('subject', Name()),
29
+ namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
30
+ namedtype.NamedType('attributes',
31
+ Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
32
+ )
33
+
34
+
35
+ class Signature(univ.BitString):
36
+ pass
37
+
38
+
39
+ class SignatureAlgorithmIdentifier(AlgorithmIdentifier):
40
+ pass
41
+
42
+
43
+ class CertificationRequest(univ.Sequence):
44
+ componentType = namedtype.NamedTypes(
45
+ namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
46
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
47
+ namedtype.NamedType('signature', Signature())
48
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2437.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # PKCS#1 syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2.asn
11
+ #
12
+ # Sample captures could be obtained with "openssl genrsa" command
13
+ #
14
+ from pyasn1.type import namedtype
15
+ from pyasn1.type import tag
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules.rfc2459 import AlgorithmIdentifier
19
+
20
+ pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
21
+ rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
22
+ md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
23
+ md4WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.3')
24
+ md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
25
+ sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
26
+ rsaOAEPEncryptionSET = univ.ObjectIdentifier('1.2.840.113549.1.1.6')
27
+ id_RSAES_OAEP = univ.ObjectIdentifier('1.2.840.113549.1.1.7')
28
+ id_mgf1 = univ.ObjectIdentifier('1.2.840.113549.1.1.8')
29
+ id_pSpecified = univ.ObjectIdentifier('1.2.840.113549.1.1.9')
30
+ id_sha1 = univ.ObjectIdentifier('1.3.14.3.2.26')
31
+
32
+ MAX = float('inf')
33
+
34
+
35
+ class Version(univ.Integer):
36
+ pass
37
+
38
+
39
+ class RSAPrivateKey(univ.Sequence):
40
+ componentType = namedtype.NamedTypes(
41
+ namedtype.NamedType('version', Version()),
42
+ namedtype.NamedType('modulus', univ.Integer()),
43
+ namedtype.NamedType('publicExponent', univ.Integer()),
44
+ namedtype.NamedType('privateExponent', univ.Integer()),
45
+ namedtype.NamedType('prime1', univ.Integer()),
46
+ namedtype.NamedType('prime2', univ.Integer()),
47
+ namedtype.NamedType('exponent1', univ.Integer()),
48
+ namedtype.NamedType('exponent2', univ.Integer()),
49
+ namedtype.NamedType('coefficient', univ.Integer())
50
+ )
51
+
52
+
53
+ class RSAPublicKey(univ.Sequence):
54
+ componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('modulus', univ.Integer()),
56
+ namedtype.NamedType('publicExponent', univ.Integer())
57
+ )
58
+
59
+
60
+ # XXX defaults not set
61
+ class RSAES_OAEP_params(univ.Sequence):
62
+ componentType = namedtype.NamedTypes(
63
+ namedtype.NamedType('hashFunc', AlgorithmIdentifier().subtype(
64
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
65
+ namedtype.NamedType('maskGenFunc', AlgorithmIdentifier().subtype(
66
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
67
+ namedtype.NamedType('pSourceFunc', AlgorithmIdentifier().subtype(
68
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
69
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2560.py ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # OCSP request/response syntax
8
+ #
9
+ # Derived from a minimal OCSP library (RFC2560) code written by
10
+ # Bud P. Bruegger <bud@ancitel.it>
11
+ # Copyright: Ancitel, S.p.a, Rome, Italy
12
+ # License: BSD
13
+ #
14
+
15
+ #
16
+ # current limitations:
17
+ # * request and response works only for a single certificate
18
+ # * only some values are parsed out of the response
19
+ # * the request does't set a nonce nor signature
20
+ # * there is no signature validation of the response
21
+ # * dates are left as strings in GeneralizedTime format -- datetime.datetime
22
+ # would be nicer
23
+ #
24
+ from pyasn1.type import namedtype
25
+ from pyasn1.type import namedval
26
+ from pyasn1.type import tag
27
+ from pyasn1.type import univ
28
+ from pyasn1.type import useful
29
+
30
+ from pyasn1_modules import rfc2459
31
+
32
+
33
+ # Start of OCSP module definitions
34
+
35
+ # This should be in directory Authentication Framework (X.509) module
36
+
37
+ class CRLReason(univ.Enumerated):
38
+ namedValues = namedval.NamedValues(
39
+ ('unspecified', 0),
40
+ ('keyCompromise', 1),
41
+ ('cACompromise', 2),
42
+ ('affiliationChanged', 3),
43
+ ('superseded', 4),
44
+ ('cessationOfOperation', 5),
45
+ ('certificateHold', 6),
46
+ ('removeFromCRL', 8),
47
+ ('privilegeWithdrawn', 9),
48
+ ('aACompromise', 10)
49
+ )
50
+
51
+
52
+ # end of directory Authentication Framework (X.509) module
53
+
54
+ # This should be in PKIX Certificate Extensions module
55
+
56
+ class GeneralName(univ.OctetString):
57
+ pass
58
+
59
+
60
+ # end of PKIX Certificate Extensions module
61
+
62
+ id_kp_OCSPSigning = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 3, 9))
63
+ id_pkix_ocsp = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1))
64
+ id_pkix_ocsp_basic = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 1))
65
+ id_pkix_ocsp_nonce = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 2))
66
+ id_pkix_ocsp_crl = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 3))
67
+ id_pkix_ocsp_response = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 4))
68
+ id_pkix_ocsp_nocheck = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 5))
69
+ id_pkix_ocsp_archive_cutoff = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 6))
70
+ id_pkix_ocsp_service_locator = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 7))
71
+
72
+
73
+ class AcceptableResponses(univ.SequenceOf):
74
+ componentType = univ.ObjectIdentifier()
75
+
76
+
77
+ class ArchiveCutoff(useful.GeneralizedTime):
78
+ pass
79
+
80
+
81
+ class UnknownInfo(univ.Null):
82
+ pass
83
+
84
+
85
+ class RevokedInfo(univ.Sequence):
86
+ componentType = namedtype.NamedTypes(
87
+ namedtype.NamedType('revocationTime', useful.GeneralizedTime()),
88
+ namedtype.OptionalNamedType('revocationReason', CRLReason().subtype(
89
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
90
+ )
91
+
92
+
93
+ class CertID(univ.Sequence):
94
+ componentType = namedtype.NamedTypes(
95
+ namedtype.NamedType('hashAlgorithm', rfc2459.AlgorithmIdentifier()),
96
+ namedtype.NamedType('issuerNameHash', univ.OctetString()),
97
+ namedtype.NamedType('issuerKeyHash', univ.OctetString()),
98
+ namedtype.NamedType('serialNumber', rfc2459.CertificateSerialNumber())
99
+ )
100
+
101
+
102
+ class CertStatus(univ.Choice):
103
+ componentType = namedtype.NamedTypes(
104
+ namedtype.NamedType('good',
105
+ univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
106
+ namedtype.NamedType('revoked',
107
+ RevokedInfo().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
108
+ namedtype.NamedType('unknown',
109
+ UnknownInfo().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
110
+ )
111
+
112
+
113
+ class SingleResponse(univ.Sequence):
114
+ componentType = namedtype.NamedTypes(
115
+ namedtype.NamedType('certID', CertID()),
116
+ namedtype.NamedType('certStatus', CertStatus()),
117
+ namedtype.NamedType('thisUpdate', useful.GeneralizedTime()),
118
+ namedtype.OptionalNamedType('nextUpdate', useful.GeneralizedTime().subtype(
119
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
120
+ namedtype.OptionalNamedType('singleExtensions', rfc2459.Extensions().subtype(
121
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
122
+ )
123
+
124
+
125
+ class KeyHash(univ.OctetString):
126
+ pass
127
+
128
+
129
+ class ResponderID(univ.Choice):
130
+ componentType = namedtype.NamedTypes(
131
+ namedtype.NamedType('byName',
132
+ rfc2459.Name().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
133
+ namedtype.NamedType('byKey',
134
+ KeyHash().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
135
+ )
136
+
137
+
138
+ class Version(univ.Integer):
139
+ namedValues = namedval.NamedValues(('v1', 0))
140
+
141
+
142
+ class ResponseData(univ.Sequence):
143
+ componentType = namedtype.NamedTypes(
144
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
145
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
146
+ namedtype.NamedType('responderID', ResponderID()),
147
+ namedtype.NamedType('producedAt', useful.GeneralizedTime()),
148
+ namedtype.NamedType('responses', univ.SequenceOf(componentType=SingleResponse())),
149
+ namedtype.OptionalNamedType('responseExtensions', rfc2459.Extensions().subtype(
150
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
151
+ )
152
+
153
+
154
+ class BasicOCSPResponse(univ.Sequence):
155
+ componentType = namedtype.NamedTypes(
156
+ namedtype.NamedType('tbsResponseData', ResponseData()),
157
+ namedtype.NamedType('signatureAlgorithm', rfc2459.AlgorithmIdentifier()),
158
+ namedtype.NamedType('signature', univ.BitString()),
159
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(componentType=rfc2459.Certificate()).subtype(
160
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
161
+ )
162
+
163
+
164
+ class ResponseBytes(univ.Sequence):
165
+ componentType = namedtype.NamedTypes(
166
+ namedtype.NamedType('responseType', univ.ObjectIdentifier()),
167
+ namedtype.NamedType('response', univ.OctetString())
168
+ )
169
+
170
+
171
+ class OCSPResponseStatus(univ.Enumerated):
172
+ namedValues = namedval.NamedValues(
173
+ ('successful', 0),
174
+ ('malformedRequest', 1),
175
+ ('internalError', 2),
176
+ ('tryLater', 3),
177
+ ('undefinedStatus', 4), # should never occur
178
+ ('sigRequired', 5),
179
+ ('unauthorized', 6)
180
+ )
181
+
182
+
183
+ class OCSPResponse(univ.Sequence):
184
+ componentType = namedtype.NamedTypes(
185
+ namedtype.NamedType('responseStatus', OCSPResponseStatus()),
186
+ namedtype.OptionalNamedType('responseBytes', ResponseBytes().subtype(
187
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
188
+ )
189
+
190
+
191
+ class Request(univ.Sequence):
192
+ componentType = namedtype.NamedTypes(
193
+ namedtype.NamedType('reqCert', CertID()),
194
+ namedtype.OptionalNamedType('singleRequestExtensions', rfc2459.Extensions().subtype(
195
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
196
+ )
197
+
198
+
199
+ class Signature(univ.Sequence):
200
+ componentType = namedtype.NamedTypes(
201
+ namedtype.NamedType('signatureAlgorithm', rfc2459.AlgorithmIdentifier()),
202
+ namedtype.NamedType('signature', univ.BitString()),
203
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(componentType=rfc2459.Certificate()).subtype(
204
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
205
+ )
206
+
207
+
208
+ class TBSRequest(univ.Sequence):
209
+ componentType = namedtype.NamedTypes(
210
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
211
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
212
+ namedtype.OptionalNamedType('requestorName', GeneralName().subtype(
213
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
214
+ namedtype.NamedType('requestList', univ.SequenceOf(componentType=Request())),
215
+ namedtype.OptionalNamedType('requestExtensions', rfc2459.Extensions().subtype(
216
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
217
+ )
218
+
219
+
220
+ class OCSPRequest(univ.Sequence):
221
+ componentType = namedtype.NamedTypes(
222
+ namedtype.NamedType('tbsRequest', TBSRequest()),
223
+ namedtype.OptionalNamedType('optionalSignature', Signature().subtype(
224
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
225
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2634.py ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add a map for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Enhanced Security Services for S/MIME
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc2634.txt
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import constraint
18
+ from pyasn1.type import namedval
19
+ from pyasn1.type import namedtype
20
+ from pyasn1.type import tag
21
+ from pyasn1.type import univ
22
+ from pyasn1.type import useful
23
+
24
+ from pyasn1_modules import rfc5652
25
+ from pyasn1_modules import rfc5280
26
+
27
+ MAX = float('inf')
28
+
29
+ ContentType = rfc5652.ContentType
30
+
31
+ IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber
32
+
33
+ SubjectKeyIdentifier = rfc5652.SubjectKeyIdentifier
34
+
35
+ PolicyInformation = rfc5280.PolicyInformation
36
+
37
+ GeneralNames = rfc5280.GeneralNames
38
+
39
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
40
+
41
+
42
+ # Signing Certificate Attribute
43
+ # Warning: It is better to use SigningCertificateV2 from RFC 5035
44
+
45
+ id_aa_signingCertificate = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.12')
46
+
47
+ class Hash(univ.OctetString):
48
+ pass # SHA-1 hash of entire certificate; RFC 5035 supports other hash algorithms
49
+
50
+
51
+ class IssuerSerial(univ.Sequence):
52
+ pass
53
+
54
+ IssuerSerial.componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('issuer', GeneralNames()),
56
+ namedtype.NamedType('serialNumber', CertificateSerialNumber())
57
+ )
58
+
59
+
60
+ class ESSCertID(univ.Sequence):
61
+ pass
62
+
63
+ ESSCertID.componentType = namedtype.NamedTypes(
64
+ namedtype.NamedType('certHash', Hash()),
65
+ namedtype.OptionalNamedType('issuerSerial', IssuerSerial())
66
+ )
67
+
68
+
69
+ class SigningCertificate(univ.Sequence):
70
+ pass
71
+
72
+ SigningCertificate.componentType = namedtype.NamedTypes(
73
+ namedtype.NamedType('certs', univ.SequenceOf(
74
+ componentType=ESSCertID())),
75
+ namedtype.OptionalNamedType('policies', univ.SequenceOf(
76
+ componentType=PolicyInformation()))
77
+ )
78
+
79
+
80
+ # Mail List Expansion History Attribute
81
+
82
+ id_aa_mlExpandHistory = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.3')
83
+
84
+ ub_ml_expansion_history = univ.Integer(64)
85
+
86
+
87
+ class EntityIdentifier(univ.Choice):
88
+ pass
89
+
90
+ EntityIdentifier.componentType = namedtype.NamedTypes(
91
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
92
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier())
93
+ )
94
+
95
+
96
+ class MLReceiptPolicy(univ.Choice):
97
+ pass
98
+
99
+ MLReceiptPolicy.componentType = namedtype.NamedTypes(
100
+ namedtype.NamedType('none', univ.Null().subtype(implicitTag=tag.Tag(
101
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
102
+ namedtype.NamedType('insteadOf', univ.SequenceOf(
103
+ componentType=GeneralNames()).subtype(
104
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
105
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
106
+ namedtype.NamedType('inAdditionTo', univ.SequenceOf(
107
+ componentType=GeneralNames()).subtype(
108
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
109
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
110
+ )
111
+
112
+
113
+ class MLData(univ.Sequence):
114
+ pass
115
+
116
+ MLData.componentType = namedtype.NamedTypes(
117
+ namedtype.NamedType('mailListIdentifier', EntityIdentifier()),
118
+ namedtype.NamedType('expansionTime', useful.GeneralizedTime()),
119
+ namedtype.OptionalNamedType('mlReceiptPolicy', MLReceiptPolicy())
120
+ )
121
+
122
+ class MLExpansionHistory(univ.SequenceOf):
123
+ pass
124
+
125
+ MLExpansionHistory.componentType = MLData()
126
+ MLExpansionHistory.sizeSpec = constraint.ValueSizeConstraint(1, ub_ml_expansion_history)
127
+
128
+
129
+ # ESS Security Label Attribute
130
+
131
+ id_aa_securityLabel = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.2')
132
+
133
+ ub_privacy_mark_length = univ.Integer(128)
134
+
135
+ ub_security_categories = univ.Integer(64)
136
+
137
+ ub_integer_options = univ.Integer(256)
138
+
139
+
140
+ class ESSPrivacyMark(univ.Choice):
141
+ pass
142
+
143
+ ESSPrivacyMark.componentType = namedtype.NamedTypes(
144
+ namedtype.NamedType('pString', char.PrintableString().subtype(
145
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_privacy_mark_length))),
146
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
147
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
148
+ )
149
+
150
+
151
+ class SecurityClassification(univ.Integer):
152
+ pass
153
+
154
+ SecurityClassification.subtypeSpec=constraint.ValueRangeConstraint(0, ub_integer_options)
155
+
156
+ SecurityClassification.namedValues = namedval.NamedValues(
157
+ ('unmarked', 0),
158
+ ('unclassified', 1),
159
+ ('restricted', 2),
160
+ ('confidential', 3),
161
+ ('secret', 4),
162
+ ('top-secret', 5)
163
+ )
164
+
165
+
166
+ class SecurityPolicyIdentifier(univ.ObjectIdentifier):
167
+ pass
168
+
169
+
170
+ class SecurityCategory(univ.Sequence):
171
+ pass
172
+
173
+ SecurityCategory.componentType = namedtype.NamedTypes(
174
+ namedtype.NamedType('type', univ.ObjectIdentifier().subtype(
175
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
176
+ namedtype.NamedType('value', univ.Any().subtype(implicitTag=tag.Tag(
177
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
178
+ )
179
+
180
+
181
+ class SecurityCategories(univ.SetOf):
182
+ pass
183
+
184
+ SecurityCategories.componentType = SecurityCategory()
185
+ SecurityCategories.sizeSpec = constraint.ValueSizeConstraint(1, ub_security_categories)
186
+
187
+
188
+ class ESSSecurityLabel(univ.Set):
189
+ pass
190
+
191
+ ESSSecurityLabel.componentType = namedtype.NamedTypes(
192
+ namedtype.NamedType('security-policy-identifier', SecurityPolicyIdentifier()),
193
+ namedtype.OptionalNamedType('security-classification', SecurityClassification()),
194
+ namedtype.OptionalNamedType('privacy-mark', ESSPrivacyMark()),
195
+ namedtype.OptionalNamedType('security-categories', SecurityCategories())
196
+ )
197
+
198
+
199
+ # Equivalent Labels Attribute
200
+
201
+ id_aa_equivalentLabels = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.9')
202
+
203
+ class EquivalentLabels(univ.SequenceOf):
204
+ pass
205
+
206
+ EquivalentLabels.componentType = ESSSecurityLabel()
207
+
208
+
209
+ # Content Identifier Attribute
210
+
211
+ id_aa_contentIdentifier = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.7')
212
+
213
+ class ContentIdentifier(univ.OctetString):
214
+ pass
215
+
216
+
217
+ # Content Reference Attribute
218
+
219
+ id_aa_contentReference = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.10')
220
+
221
+ class ContentReference(univ.Sequence):
222
+ pass
223
+
224
+ ContentReference.componentType = namedtype.NamedTypes(
225
+ namedtype.NamedType('contentType', ContentType()),
226
+ namedtype.NamedType('signedContentIdentifier', ContentIdentifier()),
227
+ namedtype.NamedType('originatorSignatureValue', univ.OctetString())
228
+ )
229
+
230
+
231
+ # Message Signature Digest Attribute
232
+
233
+ id_aa_msgSigDigest = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.5')
234
+
235
+ class MsgSigDigest(univ.OctetString):
236
+ pass
237
+
238
+
239
+ # Content Hints Attribute
240
+
241
+ id_aa_contentHint = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.4')
242
+
243
+ class ContentHints(univ.Sequence):
244
+ pass
245
+
246
+ ContentHints.componentType = namedtype.NamedTypes(
247
+ namedtype.OptionalNamedType('contentDescription', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
248
+ namedtype.NamedType('contentType', ContentType())
249
+ )
250
+
251
+
252
+ # Receipt Request Attribute
253
+
254
+ class AllOrFirstTier(univ.Integer):
255
+ pass
256
+
257
+ AllOrFirstTier.namedValues = namedval.NamedValues(
258
+ ('allReceipts', 0),
259
+ ('firstTierRecipients', 1)
260
+ )
261
+
262
+
263
+ class ReceiptsFrom(univ.Choice):
264
+ pass
265
+
266
+ ReceiptsFrom.componentType = namedtype.NamedTypes(
267
+ namedtype.NamedType('allOrFirstTier', AllOrFirstTier().subtype(
268
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
269
+ namedtype.NamedType('receiptList', univ.SequenceOf(
270
+ componentType=GeneralNames()).subtype(implicitTag=tag.Tag(
271
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
272
+ )
273
+
274
+
275
+ id_aa_receiptRequest = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.1')
276
+
277
+ ub_receiptsTo = univ.Integer(16)
278
+
279
+ class ReceiptRequest(univ.Sequence):
280
+ pass
281
+
282
+ ReceiptRequest.componentType = namedtype.NamedTypes(
283
+ namedtype.NamedType('signedContentIdentifier', ContentIdentifier()),
284
+ namedtype.NamedType('receiptsFrom', ReceiptsFrom()),
285
+ namedtype.NamedType('receiptsTo', univ.SequenceOf(componentType=GeneralNames()).subtype(sizeSpec=constraint.ValueSizeConstraint(1, ub_receiptsTo)))
286
+ )
287
+
288
+ # Receipt Content Type
289
+
290
+ class ESSVersion(univ.Integer):
291
+ pass
292
+
293
+ ESSVersion.namedValues = namedval.NamedValues(
294
+ ('v1', 1)
295
+ )
296
+
297
+
298
+ id_ct_receipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.1')
299
+
300
+ class Receipt(univ.Sequence):
301
+ pass
302
+
303
+ Receipt.componentType = namedtype.NamedTypes(
304
+ namedtype.NamedType('version', ESSVersion()),
305
+ namedtype.NamedType('contentType', ContentType()),
306
+ namedtype.NamedType('signedContentIdentifier', ContentIdentifier()),
307
+ namedtype.NamedType('originatorSignatureValue', univ.OctetString())
308
+ )
309
+
310
+
311
+ # Map of Attribute Type to the Attribute structure is added to the
312
+ # ones that are in rfc5652.py
313
+
314
+ _cmsAttributesMapUpdate = {
315
+ id_aa_signingCertificate: SigningCertificate(),
316
+ id_aa_mlExpandHistory: MLExpansionHistory(),
317
+ id_aa_securityLabel: ESSSecurityLabel(),
318
+ id_aa_equivalentLabels: EquivalentLabels(),
319
+ id_aa_contentIdentifier: ContentIdentifier(),
320
+ id_aa_contentReference: ContentReference(),
321
+ id_aa_msgSigDigest: MsgSigDigest(),
322
+ id_aa_contentHint: ContentHints(),
323
+ id_aa_receiptRequest: ReceiptRequest(),
324
+ }
325
+
326
+ rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
327
+
328
+
329
+ # Map of Content Type OIDs to Content Types is added to the
330
+ # ones that are in rfc5652.py
331
+
332
+ _cmsContentTypesMapUpdate = {
333
+ id_ct_receipt: Receipt(),
334
+ }
335
+
336
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2986.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-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
+ # License: http://snmplabs.com/pyasn1/license.html
11
+ #
12
+ # PKCS #10: Certification Request Syntax Specification
13
+ #
14
+ # ASN.1 source from:
15
+ # https://www.rfc-editor.org/rfc/rfc2986.txt
16
+ #
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+
21
+ from pyasn1_modules import rfc5280
22
+
23
+ MAX = float('inf')
24
+
25
+
26
+ AttributeType = rfc5280.AttributeType
27
+
28
+ AttributeValue = rfc5280.AttributeValue
29
+
30
+ AttributeTypeAndValue = rfc5280.AttributeTypeAndValue
31
+
32
+ Attribute = rfc5280.Attribute
33
+
34
+ RelativeDistinguishedName = rfc5280.RelativeDistinguishedName
35
+
36
+ RDNSequence = rfc5280.RDNSequence
37
+
38
+ Name = rfc5280.Name
39
+
40
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
41
+
42
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
43
+
44
+
45
+ class Attributes(univ.SetOf):
46
+ pass
47
+
48
+
49
+ Attributes.componentType = Attribute()
50
+
51
+
52
+ class CertificationRequestInfo(univ.Sequence):
53
+ pass
54
+
55
+
56
+ CertificationRequestInfo.componentType = namedtype.NamedTypes(
57
+ namedtype.NamedType('version', univ.Integer()),
58
+ namedtype.NamedType('subject', Name()),
59
+ namedtype.NamedType('subjectPKInfo', SubjectPublicKeyInfo()),
60
+ namedtype.NamedType('attributes',
61
+ Attributes().subtype(implicitTag=tag.Tag(
62
+ tag.tagClassContext, tag.tagFormatSimple, 0))
63
+ )
64
+ )
65
+
66
+
67
+ class CertificationRequest(univ.Sequence):
68
+ pass
69
+
70
+
71
+ CertificationRequest.componentType = namedtype.NamedTypes(
72
+ namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
73
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
74
+ namedtype.NamedType('signature', univ.BitString())
75
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3125.py ADDED
@@ -0,0 +1,469 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Electronic Signature Policies
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc3125.txt
13
+ # https://www.rfc-editor.org/errata/eid5901
14
+ # https://www.rfc-editor.org/errata/eid5902
15
+ #
16
+
17
+ from pyasn1.type import constraint
18
+ from pyasn1.type import namedtype
19
+ from pyasn1.type import namedval
20
+ from pyasn1.type import tag
21
+ from pyasn1.type import useful
22
+ from pyasn1.type import univ
23
+
24
+ from pyasn1_modules import rfc5280
25
+
26
+ MAX = float('inf')
27
+
28
+
29
+ # Imports from RFC 5280
30
+
31
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
32
+
33
+ Attribute = rfc5280.Attribute
34
+
35
+ AttributeType = rfc5280.AttributeType
36
+
37
+ AttributeTypeAndValue = rfc5280.AttributeTypeAndValue
38
+
39
+ AttributeValue = rfc5280.AttributeValue
40
+
41
+ Certificate = rfc5280.Certificate
42
+
43
+ CertificateList = rfc5280.CertificateList
44
+
45
+ DirectoryString = rfc5280.DirectoryString
46
+
47
+ GeneralName = rfc5280.GeneralName
48
+
49
+ GeneralNames = rfc5280.GeneralNames
50
+
51
+ Name = rfc5280.Name
52
+
53
+ PolicyInformation = rfc5280.PolicyInformation
54
+
55
+
56
+ # Electronic Signature Policies
57
+
58
+ class CertPolicyId(univ.ObjectIdentifier):
59
+ pass
60
+
61
+
62
+ class AcceptablePolicySet(univ.SequenceOf):
63
+ componentType = CertPolicyId()
64
+
65
+
66
+ class SignPolExtn(univ.Sequence):
67
+ componentType = namedtype.NamedTypes(
68
+ namedtype.NamedType('extnID', univ.ObjectIdentifier()),
69
+ namedtype.NamedType('extnValue', univ.OctetString())
70
+ )
71
+
72
+
73
+ class SignPolExtensions(univ.SequenceOf):
74
+ componentType = SignPolExtn()
75
+
76
+
77
+ class AlgAndLength(univ.Sequence):
78
+ componentType = namedtype.NamedTypes(
79
+ namedtype.NamedType('algID', univ.ObjectIdentifier()),
80
+ namedtype.OptionalNamedType('minKeyLength', univ.Integer()),
81
+ namedtype.OptionalNamedType('other', SignPolExtensions())
82
+ )
83
+
84
+
85
+ class AlgorithmConstraints(univ.SequenceOf):
86
+ componentType = AlgAndLength()
87
+
88
+
89
+ class AlgorithmConstraintSet(univ.Sequence):
90
+ componentType = namedtype.NamedTypes(
91
+ namedtype.OptionalNamedType('signerAlgorithmConstraints',
92
+ AlgorithmConstraints().subtype(explicitTag=tag.Tag(
93
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
94
+ namedtype.OptionalNamedType('eeCertAlgorithmConstraints',
95
+ AlgorithmConstraints().subtype(explicitTag=tag.Tag(
96
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
97
+ namedtype.OptionalNamedType('caCertAlgorithmConstraints',
98
+ AlgorithmConstraints().subtype(explicitTag=tag.Tag(
99
+ tag.tagClassContext, tag.tagFormatSimple, 2))),
100
+ namedtype.OptionalNamedType('aaCertAlgorithmConstraints',
101
+ AlgorithmConstraints().subtype(explicitTag=tag.Tag(
102
+ tag.tagClassContext, tag.tagFormatSimple, 3))),
103
+ namedtype.OptionalNamedType('tsaCertAlgorithmConstraints',
104
+ AlgorithmConstraints().subtype(explicitTag=tag.Tag(
105
+ tag.tagClassContext, tag.tagFormatSimple, 4)))
106
+ )
107
+
108
+
109
+ class AttributeValueConstraints(univ.SequenceOf):
110
+ componentType = AttributeTypeAndValue()
111
+
112
+
113
+ class AttributeTypeConstraints(univ.SequenceOf):
114
+ componentType = AttributeType()
115
+
116
+
117
+ class AttributeConstraints(univ.Sequence):
118
+ componentType = namedtype.NamedTypes(
119
+ namedtype.OptionalNamedType('attributeTypeConstarints',
120
+ AttributeTypeConstraints().subtype(explicitTag=tag.Tag(
121
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
122
+ namedtype.OptionalNamedType('attributeValueConstarints',
123
+ AttributeValueConstraints().subtype(explicitTag=tag.Tag(
124
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
125
+ )
126
+
127
+
128
+ class HowCertAttribute(univ.Enumerated):
129
+ namedValues = namedval.NamedValues(
130
+ ('claimedAttribute', 0),
131
+ ('certifiedAttribtes', 1),
132
+ ('either', 2)
133
+ )
134
+
135
+
136
+ class SkipCerts(univ.Integer):
137
+ subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
138
+
139
+
140
+ class PolicyConstraints(univ.Sequence):
141
+ componentType = namedtype.NamedTypes(
142
+ namedtype.OptionalNamedType('requireExplicitPolicy',
143
+ SkipCerts().subtype(explicitTag=tag.Tag(
144
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
145
+ namedtype.OptionalNamedType('inhibitPolicyMapping',
146
+ SkipCerts().subtype(explicitTag=tag.Tag(
147
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
148
+ )
149
+
150
+
151
+ class BaseDistance(univ.Integer):
152
+ subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
153
+
154
+
155
+ class GeneralSubtree(univ.Sequence):
156
+ componentType = namedtype.NamedTypes(
157
+ namedtype.NamedType('base', GeneralName()),
158
+ namedtype.DefaultedNamedType('minimum',
159
+ BaseDistance().subtype(explicitTag=tag.Tag(
160
+ tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(
161
+ value=0)),
162
+ namedtype.OptionalNamedType('maximum',
163
+ BaseDistance().subtype(explicitTag=tag.Tag(
164
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
165
+ )
166
+
167
+
168
+ class GeneralSubtrees(univ.SequenceOf):
169
+ componentType = GeneralSubtree()
170
+ subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
171
+
172
+
173
+ class NameConstraints(univ.Sequence):
174
+ componentType = namedtype.NamedTypes(
175
+ namedtype.OptionalNamedType('permittedSubtrees',
176
+ GeneralSubtrees().subtype(explicitTag=tag.Tag(
177
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
178
+ namedtype.OptionalNamedType('excludedSubtrees',
179
+ GeneralSubtrees().subtype(explicitTag=tag.Tag(
180
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
181
+ )
182
+
183
+
184
+ class PathLenConstraint(univ.Integer):
185
+ subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
186
+
187
+
188
+ class CertificateTrustPoint(univ.Sequence):
189
+ componentType = namedtype.NamedTypes(
190
+ namedtype.NamedType('trustpoint', Certificate()),
191
+ namedtype.OptionalNamedType('pathLenConstraint',
192
+ PathLenConstraint().subtype(explicitTag=tag.Tag(
193
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
194
+ namedtype.OptionalNamedType('acceptablePolicySet',
195
+ AcceptablePolicySet().subtype(explicitTag=tag.Tag(
196
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
197
+ namedtype.OptionalNamedType('nameConstraints',
198
+ NameConstraints().subtype(explicitTag=tag.Tag(
199
+ tag.tagClassContext, tag.tagFormatConstructed, 2))),
200
+ namedtype.OptionalNamedType('policyConstraints',
201
+ PolicyConstraints().subtype(explicitTag=tag.Tag(
202
+ tag.tagClassContext, tag.tagFormatConstructed, 3)))
203
+ )
204
+
205
+
206
+ class CertificateTrustTrees(univ.SequenceOf):
207
+ componentType = CertificateTrustPoint()
208
+
209
+
210
+ class EnuRevReq(univ.Enumerated):
211
+ namedValues = namedval.NamedValues(
212
+ ('clrCheck', 0),
213
+ ('ocspCheck', 1),
214
+ ('bothCheck', 2),
215
+ ('eitherCheck', 3),
216
+ ('noCheck', 4),
217
+ ('other', 5)
218
+ )
219
+
220
+
221
+ class RevReq(univ.Sequence):
222
+ componentType = namedtype.NamedTypes(
223
+ namedtype.NamedType('enuRevReq', EnuRevReq()),
224
+ namedtype.OptionalNamedType('exRevReq', SignPolExtensions())
225
+ )
226
+
227
+
228
+ class CertRevReq(univ.Sequence):
229
+ componentType = namedtype.NamedTypes(
230
+ namedtype.NamedType('endCertRevReq', RevReq()),
231
+ namedtype.NamedType('caCerts',
232
+ RevReq().subtype(explicitTag=tag.Tag(
233
+ tag.tagClassContext, tag.tagFormatConstructed, 0)))
234
+ )
235
+
236
+
237
+ class AttributeTrustCondition(univ.Sequence):
238
+ componentType = namedtype.NamedTypes(
239
+ namedtype.NamedType('attributeMandated', univ.Boolean()),
240
+ namedtype.NamedType('howCertAttribute', HowCertAttribute()),
241
+ namedtype.OptionalNamedType('attrCertificateTrustTrees',
242
+ CertificateTrustTrees().subtype(explicitTag=tag.Tag(
243
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
244
+ namedtype.OptionalNamedType('attrRevReq',
245
+ CertRevReq().subtype(explicitTag=tag.Tag(
246
+ tag.tagClassContext, tag.tagFormatConstructed, 1))),
247
+ namedtype.OptionalNamedType('attributeConstraints',
248
+ AttributeConstraints().subtype(explicitTag=tag.Tag(
249
+ tag.tagClassContext, tag.tagFormatConstructed, 2)))
250
+ )
251
+
252
+
253
+ class CMSAttrs(univ.SequenceOf):
254
+ componentType = univ.ObjectIdentifier()
255
+
256
+
257
+ class CertInfoReq(univ.Enumerated):
258
+ namedValues = namedval.NamedValues(
259
+ ('none', 0),
260
+ ('signerOnly', 1),
261
+ ('fullPath', 2)
262
+ )
263
+
264
+
265
+ class CertRefReq(univ.Enumerated):
266
+ namedValues = namedval.NamedValues(
267
+ ('signerOnly', 1),
268
+ ('fullPath', 2)
269
+ )
270
+
271
+
272
+ class DeltaTime(univ.Sequence):
273
+ componentType = namedtype.NamedTypes(
274
+ namedtype.NamedType('deltaSeconds', univ.Integer()),
275
+ namedtype.NamedType('deltaMinutes', univ.Integer()),
276
+ namedtype.NamedType('deltaHours', univ.Integer()),
277
+ namedtype.NamedType('deltaDays', univ.Integer())
278
+ )
279
+
280
+
281
+ class TimestampTrustCondition(univ.Sequence):
282
+ componentType = namedtype.NamedTypes(
283
+ namedtype.OptionalNamedType('ttsCertificateTrustTrees',
284
+ CertificateTrustTrees().subtype(explicitTag=tag.Tag(
285
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
286
+ namedtype.OptionalNamedType('ttsRevReq',
287
+ CertRevReq().subtype(explicitTag=tag.Tag(
288
+ tag.tagClassContext, tag.tagFormatConstructed, 1))),
289
+ namedtype.OptionalNamedType('ttsNameConstraints',
290
+ NameConstraints().subtype(explicitTag=tag.Tag(
291
+ tag.tagClassContext, tag.tagFormatConstructed, 2))),
292
+ namedtype.OptionalNamedType('cautionPeriod',
293
+ DeltaTime().subtype(explicitTag=tag.Tag(
294
+ tag.tagClassContext, tag.tagFormatConstructed, 3))),
295
+ namedtype.OptionalNamedType('signatureTimestampDelay',
296
+ DeltaTime().subtype(explicitTag=tag.Tag(
297
+ tag.tagClassContext, tag.tagFormatConstructed, 4)))
298
+ )
299
+
300
+
301
+ class SignerRules(univ.Sequence):
302
+ componentType = namedtype.NamedTypes(
303
+ namedtype.OptionalNamedType('externalSignedData', univ.Boolean()),
304
+ namedtype.NamedType('mandatedSignedAttr', CMSAttrs()),
305
+ namedtype.NamedType('mandatedUnsignedAttr', CMSAttrs()),
306
+ namedtype.DefaultedNamedType('mandatedCertificateRef',
307
+ CertRefReq().subtype(explicitTag=tag.Tag(
308
+ tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(
309
+ value='signerOnly')),
310
+ namedtype.DefaultedNamedType('mandatedCertificateInfo',
311
+ CertInfoReq().subtype(explicitTag=tag.Tag(
312
+ tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(
313
+ value='none')),
314
+ namedtype.OptionalNamedType('signPolExtensions',
315
+ SignPolExtensions().subtype(explicitTag=tag.Tag(
316
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
317
+ )
318
+
319
+
320
+ class MandatedUnsignedAttr(CMSAttrs):
321
+ pass
322
+
323
+
324
+ class VerifierRules(univ.Sequence):
325
+ componentType = namedtype.NamedTypes(
326
+ namedtype.NamedType('mandatedUnsignedAttr', MandatedUnsignedAttr()),
327
+ namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
328
+ )
329
+
330
+
331
+ class SignerAndVerifierRules(univ.Sequence):
332
+ componentType = namedtype.NamedTypes(
333
+ namedtype.NamedType('signerRules', SignerRules()),
334
+ namedtype.NamedType('verifierRules', VerifierRules())
335
+ )
336
+
337
+
338
+ class SigningCertTrustCondition(univ.Sequence):
339
+ componentType = namedtype.NamedTypes(
340
+ namedtype.NamedType('signerTrustTrees', CertificateTrustTrees()),
341
+ namedtype.NamedType('signerRevReq', CertRevReq())
342
+ )
343
+
344
+
345
+ class CommitmentTypeIdentifier(univ.ObjectIdentifier):
346
+ pass
347
+
348
+
349
+ class FieldOfApplication(DirectoryString):
350
+ pass
351
+
352
+
353
+ class CommitmentType(univ.Sequence):
354
+ componentType = namedtype.NamedTypes(
355
+ namedtype.NamedType('identifier', CommitmentTypeIdentifier()),
356
+ namedtype.OptionalNamedType('fieldOfApplication',
357
+ FieldOfApplication().subtype(explicitTag=tag.Tag(
358
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
359
+ namedtype.OptionalNamedType('semantics',
360
+ DirectoryString().subtype(explicitTag=tag.Tag(
361
+ tag.tagClassContext, tag.tagFormatSimple, 1)))
362
+ )
363
+
364
+
365
+ class SelectedCommitmentTypes(univ.SequenceOf):
366
+ componentType = univ.Choice(componentType=namedtype.NamedTypes(
367
+ namedtype.NamedType('empty', univ.Null()),
368
+ namedtype.NamedType('recognizedCommitmentType', CommitmentType())
369
+ ))
370
+
371
+
372
+ class CommitmentRule(univ.Sequence):
373
+ componentType = namedtype.NamedTypes(
374
+ namedtype.NamedType('selCommitmentTypes', SelectedCommitmentTypes()),
375
+ namedtype.OptionalNamedType('signerAndVeriferRules',
376
+ SignerAndVerifierRules().subtype(explicitTag=tag.Tag(
377
+ tag.tagClassContext, tag.tagFormatConstructed, 0))),
378
+ namedtype.OptionalNamedType('signingCertTrustCondition',
379
+ SigningCertTrustCondition().subtype(explicitTag=tag.Tag(
380
+ tag.tagClassContext, tag.tagFormatConstructed, 1))),
381
+ namedtype.OptionalNamedType('timeStampTrustCondition',
382
+ TimestampTrustCondition().subtype(explicitTag=tag.Tag(
383
+ tag.tagClassContext, tag.tagFormatConstructed, 2))),
384
+ namedtype.OptionalNamedType('attributeTrustCondition',
385
+ AttributeTrustCondition().subtype(explicitTag=tag.Tag(
386
+ tag.tagClassContext, tag.tagFormatConstructed, 3))),
387
+ namedtype.OptionalNamedType('algorithmConstraintSet',
388
+ AlgorithmConstraintSet().subtype(explicitTag=tag.Tag(
389
+ tag.tagClassContext, tag.tagFormatConstructed, 4))),
390
+ namedtype.OptionalNamedType('signPolExtensions',
391
+ SignPolExtensions().subtype(explicitTag=tag.Tag(
392
+ tag.tagClassContext, tag.tagFormatSimple, 5)))
393
+ )
394
+
395
+
396
+ class CommitmentRules(univ.SequenceOf):
397
+ componentType = CommitmentRule()
398
+
399
+
400
+ class CommonRules(univ.Sequence):
401
+ componentType = namedtype.NamedTypes(
402
+ namedtype.OptionalNamedType('signerAndVeriferRules',
403
+ SignerAndVerifierRules().subtype(explicitTag=tag.Tag(
404
+ tag.tagClassContext, tag.tagFormatConstructed, 0))),
405
+ namedtype.OptionalNamedType('signingCertTrustCondition',
406
+ SigningCertTrustCondition().subtype(explicitTag=tag.Tag(
407
+ tag.tagClassContext, tag.tagFormatConstructed, 1))),
408
+ namedtype.OptionalNamedType('timeStampTrustCondition',
409
+ TimestampTrustCondition().subtype(explicitTag=tag.Tag(
410
+ tag.tagClassContext, tag.tagFormatConstructed, 2))),
411
+ namedtype.OptionalNamedType('attributeTrustCondition',
412
+ AttributeTrustCondition().subtype(explicitTag=tag.Tag(
413
+ tag.tagClassContext, tag.tagFormatConstructed, 3))),
414
+ namedtype.OptionalNamedType('algorithmConstraintSet',
415
+ AlgorithmConstraintSet().subtype(explicitTag=tag.Tag(
416
+ tag.tagClassContext, tag.tagFormatConstructed, 4))),
417
+ namedtype.OptionalNamedType('signPolExtensions',
418
+ SignPolExtensions().subtype(explicitTag=tag.Tag(
419
+ tag.tagClassContext, tag.tagFormatSimple, 5)))
420
+ )
421
+
422
+
423
+ class PolicyIssuerName(GeneralNames):
424
+ pass
425
+
426
+
427
+ class SignPolicyHash(univ.OctetString):
428
+ pass
429
+
430
+
431
+ class SignPolicyId(univ.ObjectIdentifier):
432
+ pass
433
+
434
+
435
+ class SigningPeriod(univ.Sequence):
436
+ componentType = namedtype.NamedTypes(
437
+ namedtype.NamedType('notBefore', useful.GeneralizedTime()),
438
+ namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime())
439
+ )
440
+
441
+
442
+ class SignatureValidationPolicy(univ.Sequence):
443
+ componentType = namedtype.NamedTypes(
444
+ namedtype.NamedType('signingPeriod', SigningPeriod()),
445
+ namedtype.NamedType('commonRules', CommonRules()),
446
+ namedtype.NamedType('commitmentRules', CommitmentRules()),
447
+ namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
448
+ )
449
+
450
+
451
+ class SignPolicyInfo(univ.Sequence):
452
+ componentType = namedtype.NamedTypes(
453
+ namedtype.NamedType('signPolicyIdentifier', SignPolicyId()),
454
+ namedtype.NamedType('dateOfIssue', useful.GeneralizedTime()),
455
+ namedtype.NamedType('policyIssuerName', PolicyIssuerName()),
456
+ namedtype.NamedType('fieldOfApplication', FieldOfApplication()),
457
+ namedtype.NamedType('signatureValidationPolicy', SignatureValidationPolicy()),
458
+ namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
459
+ )
460
+
461
+
462
+ class SignaturePolicy(univ.Sequence):
463
+ componentType = namedtype.NamedTypes(
464
+ namedtype.NamedType('signPolicyHashAlg', AlgorithmIdentifier()),
465
+ namedtype.NamedType('signPolicyInfo', SignPolicyInfo()),
466
+ namedtype.OptionalNamedType('signPolicyHash', SignPolicyHash())
467
+ )
468
+
469
+
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3279.py ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules.
3
+ #
4
+ # Copyright (c) 2017, Danielle Madeley <danielle@madeley.id.au>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # Modified by Russ Housley to add maps for use with opentypes.
8
+ #
9
+ # Algorithms and Identifiers for Internet X.509 Certificates and CRLs
10
+ #
11
+ # Derived from RFC 3279:
12
+ # https://www.rfc-editor.org/rfc/rfc3279.txt
13
+ #
14
+ from pyasn1.type import namedtype
15
+ from pyasn1.type import namedval
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules import rfc5280
19
+
20
+
21
+ def _OID(*components):
22
+ output = []
23
+ for x in tuple(components):
24
+ if isinstance(x, univ.ObjectIdentifier):
25
+ output.extend(list(x))
26
+ else:
27
+ output.append(int(x))
28
+
29
+ return univ.ObjectIdentifier(output)
30
+
31
+
32
+ md2 = _OID(1, 2, 840, 113549, 2, 2)
33
+ md5 = _OID(1, 2, 840, 113549, 2, 5)
34
+ id_sha1 = _OID(1, 3, 14, 3, 2, 26)
35
+ id_dsa = _OID(1, 2, 840, 10040, 4, 1)
36
+
37
+
38
+ class DSAPublicKey(univ.Integer):
39
+ pass
40
+
41
+
42
+ class Dss_Parms(univ.Sequence):
43
+ componentType = namedtype.NamedTypes(
44
+ namedtype.NamedType('p', univ.Integer()),
45
+ namedtype.NamedType('q', univ.Integer()),
46
+ namedtype.NamedType('g', univ.Integer())
47
+ )
48
+
49
+
50
+ id_dsa_with_sha1 = _OID(1, 2, 840, 10040, 4, 3)
51
+
52
+
53
+ class Dss_Sig_Value(univ.Sequence):
54
+ componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('r', univ.Integer()),
56
+ namedtype.NamedType('s', univ.Integer())
57
+ )
58
+
59
+
60
+ pkcs_1 = _OID(1, 2, 840, 113549, 1, 1)
61
+ rsaEncryption = _OID(pkcs_1, 1)
62
+ md2WithRSAEncryption = _OID(pkcs_1, 2)
63
+ md5WithRSAEncryption = _OID(pkcs_1, 4)
64
+ sha1WithRSAEncryption = _OID(pkcs_1, 5)
65
+
66
+
67
+ class RSAPublicKey(univ.Sequence):
68
+ componentType = namedtype.NamedTypes(
69
+ namedtype.NamedType('modulus', univ.Integer()),
70
+ namedtype.NamedType('publicExponent', univ.Integer())
71
+ )
72
+
73
+
74
+ dhpublicnumber = _OID(1, 2, 840, 10046, 2, 1)
75
+
76
+
77
+ class DHPublicKey(univ.Integer):
78
+ pass
79
+
80
+
81
+ class ValidationParms(univ.Sequence):
82
+ componentType = namedtype.NamedTypes(
83
+ namedtype.NamedType('seed', univ.BitString()),
84
+ namedtype.NamedType('pgenCounter', univ.Integer())
85
+ )
86
+
87
+
88
+ class DomainParameters(univ.Sequence):
89
+ componentType = namedtype.NamedTypes(
90
+ namedtype.NamedType('p', univ.Integer()),
91
+ namedtype.NamedType('g', univ.Integer()),
92
+ namedtype.NamedType('q', univ.Integer()),
93
+ namedtype.OptionalNamedType('j', univ.Integer()),
94
+ namedtype.OptionalNamedType('validationParms', ValidationParms())
95
+ )
96
+
97
+
98
+ id_keyExchangeAlgorithm = _OID(2, 16, 840, 1, 101, 2, 1, 1, 22)
99
+
100
+
101
+ class KEA_Parms_Id(univ.OctetString):
102
+ pass
103
+
104
+
105
+ ansi_X9_62 = _OID(1, 2, 840, 10045)
106
+
107
+
108
+ class FieldID(univ.Sequence):
109
+ componentType = namedtype.NamedTypes(
110
+ namedtype.NamedType('fieldType', univ.ObjectIdentifier()),
111
+ namedtype.NamedType('parameters', univ.Any())
112
+ )
113
+
114
+
115
+ id_ecSigType = _OID(ansi_X9_62, 4)
116
+ ecdsa_with_SHA1 = _OID(id_ecSigType, 1)
117
+
118
+
119
+ class ECDSA_Sig_Value(univ.Sequence):
120
+ componentType = namedtype.NamedTypes(
121
+ namedtype.NamedType('r', univ.Integer()),
122
+ namedtype.NamedType('s', univ.Integer())
123
+ )
124
+
125
+
126
+ id_fieldType = _OID(ansi_X9_62, 1)
127
+ prime_field = _OID(id_fieldType, 1)
128
+
129
+
130
+ class Prime_p(univ.Integer):
131
+ pass
132
+
133
+
134
+ characteristic_two_field = _OID(id_fieldType, 2)
135
+
136
+
137
+ class Characteristic_two(univ.Sequence):
138
+ componentType = namedtype.NamedTypes(
139
+ namedtype.NamedType('m', univ.Integer()),
140
+ namedtype.NamedType('basis', univ.ObjectIdentifier()),
141
+ namedtype.NamedType('parameters', univ.Any())
142
+ )
143
+
144
+
145
+ id_characteristic_two_basis = _OID(characteristic_two_field, 3)
146
+ gnBasis = _OID(id_characteristic_two_basis, 1)
147
+ tpBasis = _OID(id_characteristic_two_basis, 2)
148
+
149
+
150
+ class Trinomial(univ.Integer):
151
+ pass
152
+
153
+
154
+ ppBasis = _OID(id_characteristic_two_basis, 3)
155
+
156
+
157
+ class Pentanomial(univ.Sequence):
158
+ componentType = namedtype.NamedTypes(
159
+ namedtype.NamedType('k1', univ.Integer()),
160
+ namedtype.NamedType('k2', univ.Integer()),
161
+ namedtype.NamedType('k3', univ.Integer())
162
+ )
163
+
164
+
165
+ class FieldElement(univ.OctetString):
166
+ pass
167
+
168
+
169
+ class ECPoint(univ.OctetString):
170
+ pass
171
+
172
+
173
+ class Curve(univ.Sequence):
174
+ componentType = namedtype.NamedTypes(
175
+ namedtype.NamedType('a', FieldElement()),
176
+ namedtype.NamedType('b', FieldElement()),
177
+ namedtype.OptionalNamedType('seed', univ.BitString())
178
+ )
179
+
180
+
181
+ class ECPVer(univ.Integer):
182
+ namedValues = namedval.NamedValues(
183
+ ('ecpVer1', 1)
184
+ )
185
+
186
+
187
+ class ECParameters(univ.Sequence):
188
+ componentType = namedtype.NamedTypes(
189
+ namedtype.NamedType('version', ECPVer()),
190
+ namedtype.NamedType('fieldID', FieldID()),
191
+ namedtype.NamedType('curve', Curve()),
192
+ namedtype.NamedType('base', ECPoint()),
193
+ namedtype.NamedType('order', univ.Integer()),
194
+ namedtype.OptionalNamedType('cofactor', univ.Integer())
195
+ )
196
+
197
+
198
+ class EcpkParameters(univ.Choice):
199
+ componentType = namedtype.NamedTypes(
200
+ namedtype.NamedType('ecParameters', ECParameters()),
201
+ namedtype.NamedType('namedCurve', univ.ObjectIdentifier()),
202
+ namedtype.NamedType('implicitlyCA', univ.Null())
203
+ )
204
+
205
+
206
+ id_publicKeyType = _OID(ansi_X9_62, 2)
207
+ id_ecPublicKey = _OID(id_publicKeyType, 1)
208
+
209
+ ellipticCurve = _OID(ansi_X9_62, 3)
210
+
211
+ c_TwoCurve = _OID(ellipticCurve, 0)
212
+ c2pnb163v1 = _OID(c_TwoCurve, 1)
213
+ c2pnb163v2 = _OID(c_TwoCurve, 2)
214
+ c2pnb163v3 = _OID(c_TwoCurve, 3)
215
+ c2pnb176w1 = _OID(c_TwoCurve, 4)
216
+ c2tnb191v1 = _OID(c_TwoCurve, 5)
217
+ c2tnb191v2 = _OID(c_TwoCurve, 6)
218
+ c2tnb191v3 = _OID(c_TwoCurve, 7)
219
+ c2onb191v4 = _OID(c_TwoCurve, 8)
220
+ c2onb191v5 = _OID(c_TwoCurve, 9)
221
+ c2pnb208w1 = _OID(c_TwoCurve, 10)
222
+ c2tnb239v1 = _OID(c_TwoCurve, 11)
223
+ c2tnb239v2 = _OID(c_TwoCurve, 12)
224
+ c2tnb239v3 = _OID(c_TwoCurve, 13)
225
+ c2onb239v4 = _OID(c_TwoCurve, 14)
226
+ c2onb239v5 = _OID(c_TwoCurve, 15)
227
+ c2pnb272w1 = _OID(c_TwoCurve, 16)
228
+ c2pnb304w1 = _OID(c_TwoCurve, 17)
229
+ c2tnb359v1 = _OID(c_TwoCurve, 18)
230
+ c2pnb368w1 = _OID(c_TwoCurve, 19)
231
+ c2tnb431r1 = _OID(c_TwoCurve, 20)
232
+
233
+ primeCurve = _OID(ellipticCurve, 1)
234
+ prime192v1 = _OID(primeCurve, 1)
235
+ prime192v2 = _OID(primeCurve, 2)
236
+ prime192v3 = _OID(primeCurve, 3)
237
+ prime239v1 = _OID(primeCurve, 4)
238
+ prime239v2 = _OID(primeCurve, 5)
239
+ prime239v3 = _OID(primeCurve, 6)
240
+ prime256v1 = _OID(primeCurve, 7)
241
+
242
+
243
+ # Map of Algorithm Identifier OIDs to Parameters added to the
244
+ # ones in rfc5280.py. Do not add OIDs with absent paramaters.
245
+
246
+ _algorithmIdentifierMapUpdate = {
247
+ md2: univ.Null(""),
248
+ md5: univ.Null(""),
249
+ id_sha1: univ.Null(""),
250
+ id_dsa: Dss_Parms(),
251
+ rsaEncryption: univ.Null(""),
252
+ md2WithRSAEncryption: univ.Null(""),
253
+ md5WithRSAEncryption: univ.Null(""),
254
+ sha1WithRSAEncryption: univ.Null(""),
255
+ dhpublicnumber: DomainParameters(),
256
+ id_keyExchangeAlgorithm: KEA_Parms_Id(),
257
+ id_ecPublicKey: EcpkParameters(),
258
+ }
259
+
260
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3281.py ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # An Internet Attribute Certificate Profile for Authorization
10
+ #
11
+ # ASN.1 source from:
12
+ # http://www.ietf.org/rfc/rfc3281.txt
13
+ #
14
+ from pyasn1.type import char
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import namedval
18
+ from pyasn1.type import tag
19
+ from pyasn1.type import univ
20
+ from pyasn1.type import useful
21
+
22
+ from pyasn1_modules import rfc3280
23
+
24
+ MAX = float('inf')
25
+
26
+
27
+ def _buildOid(*components):
28
+ output = []
29
+ for x in tuple(components):
30
+ if isinstance(x, univ.ObjectIdentifier):
31
+ output.extend(list(x))
32
+ else:
33
+ output.append(int(x))
34
+
35
+ return univ.ObjectIdentifier(output)
36
+
37
+
38
+ class ObjectDigestInfo(univ.Sequence):
39
+ pass
40
+
41
+
42
+ ObjectDigestInfo.componentType = namedtype.NamedTypes(
43
+ namedtype.NamedType('digestedObjectType', univ.Enumerated(
44
+ namedValues=namedval.NamedValues(('publicKey', 0), ('publicKeyCert', 1), ('otherObjectTypes', 2)))),
45
+ namedtype.OptionalNamedType('otherObjectTypeID', univ.ObjectIdentifier()),
46
+ namedtype.NamedType('digestAlgorithm', rfc3280.AlgorithmIdentifier()),
47
+ namedtype.NamedType('objectDigest', univ.BitString())
48
+ )
49
+
50
+
51
+ class IssuerSerial(univ.Sequence):
52
+ pass
53
+
54
+
55
+ IssuerSerial.componentType = namedtype.NamedTypes(
56
+ namedtype.NamedType('issuer', rfc3280.GeneralNames()),
57
+ namedtype.NamedType('serial', rfc3280.CertificateSerialNumber()),
58
+ namedtype.OptionalNamedType('issuerUID', rfc3280.UniqueIdentifier())
59
+ )
60
+
61
+
62
+ class TargetCert(univ.Sequence):
63
+ pass
64
+
65
+
66
+ TargetCert.componentType = namedtype.NamedTypes(
67
+ namedtype.NamedType('targetCertificate', IssuerSerial()),
68
+ namedtype.OptionalNamedType('targetName', rfc3280.GeneralName()),
69
+ namedtype.OptionalNamedType('certDigestInfo', ObjectDigestInfo())
70
+ )
71
+
72
+
73
+ class Target(univ.Choice):
74
+ pass
75
+
76
+
77
+ Target.componentType = namedtype.NamedTypes(
78
+ namedtype.NamedType('targetName', rfc3280.GeneralName().subtype(
79
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
80
+ namedtype.NamedType('targetGroup', rfc3280.GeneralName().subtype(
81
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
82
+ namedtype.NamedType('targetCert',
83
+ TargetCert().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
84
+ )
85
+
86
+
87
+ class Targets(univ.SequenceOf):
88
+ pass
89
+
90
+
91
+ Targets.componentType = Target()
92
+
93
+
94
+ class ProxyInfo(univ.SequenceOf):
95
+ pass
96
+
97
+
98
+ ProxyInfo.componentType = Targets()
99
+
100
+ id_at_role = _buildOid(rfc3280.id_at, 72)
101
+
102
+ id_pe_aaControls = _buildOid(rfc3280.id_pe, 6)
103
+
104
+ id_ce_targetInformation = _buildOid(rfc3280.id_ce, 55)
105
+
106
+ id_pe_ac_auditIdentity = _buildOid(rfc3280.id_pe, 4)
107
+
108
+
109
+ class ClassList(univ.BitString):
110
+ pass
111
+
112
+
113
+ ClassList.namedValues = namedval.NamedValues(
114
+ ('unmarked', 0),
115
+ ('unclassified', 1),
116
+ ('restricted', 2),
117
+ ('confidential', 3),
118
+ ('secret', 4),
119
+ ('topSecret', 5)
120
+ )
121
+
122
+
123
+ class SecurityCategory(univ.Sequence):
124
+ pass
125
+
126
+
127
+ SecurityCategory.componentType = namedtype.NamedTypes(
128
+ namedtype.NamedType('type', univ.ObjectIdentifier().subtype(
129
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
130
+ namedtype.NamedType('value', univ.Any().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
131
+ )
132
+
133
+
134
+ class Clearance(univ.Sequence):
135
+ pass
136
+
137
+
138
+ Clearance.componentType = namedtype.NamedTypes(
139
+ namedtype.NamedType('policyId', univ.ObjectIdentifier().subtype(
140
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
141
+ namedtype.DefaultedNamedType('classList',
142
+ ClassList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
143
+ tag.tagFormatSimple, 1)).subtype(
144
+ value="unclassified")),
145
+ namedtype.OptionalNamedType('securityCategories', univ.SetOf(componentType=SecurityCategory()).subtype(
146
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
147
+ )
148
+
149
+
150
+ class AttCertVersion(univ.Integer):
151
+ pass
152
+
153
+
154
+ AttCertVersion.namedValues = namedval.NamedValues(
155
+ ('v2', 1)
156
+ )
157
+
158
+ id_aca = _buildOid(rfc3280.id_pkix, 10)
159
+
160
+ id_at_clearance = _buildOid(2, 5, 1, 5, 55)
161
+
162
+
163
+ class AttrSpec(univ.SequenceOf):
164
+ pass
165
+
166
+
167
+ AttrSpec.componentType = univ.ObjectIdentifier()
168
+
169
+
170
+ class AAControls(univ.Sequence):
171
+ pass
172
+
173
+
174
+ AAControls.componentType = namedtype.NamedTypes(
175
+ namedtype.OptionalNamedType('pathLenConstraint',
176
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
177
+ namedtype.OptionalNamedType('permittedAttrs',
178
+ AttrSpec().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
179
+ namedtype.OptionalNamedType('excludedAttrs',
180
+ AttrSpec().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
181
+ namedtype.DefaultedNamedType('permitUnSpecified', univ.Boolean().subtype(value=1))
182
+ )
183
+
184
+
185
+ class AttCertValidityPeriod(univ.Sequence):
186
+ pass
187
+
188
+
189
+ AttCertValidityPeriod.componentType = namedtype.NamedTypes(
190
+ namedtype.NamedType('notBeforeTime', useful.GeneralizedTime()),
191
+ namedtype.NamedType('notAfterTime', useful.GeneralizedTime())
192
+ )
193
+
194
+
195
+ id_aca_authenticationInfo = _buildOid(id_aca, 1)
196
+
197
+
198
+ class V2Form(univ.Sequence):
199
+ pass
200
+
201
+
202
+ V2Form.componentType = namedtype.NamedTypes(
203
+ namedtype.OptionalNamedType('issuerName', rfc3280.GeneralNames()),
204
+ namedtype.OptionalNamedType('baseCertificateID', IssuerSerial().subtype(
205
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
206
+ namedtype.OptionalNamedType('objectDigestInfo', ObjectDigestInfo().subtype(
207
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
208
+ )
209
+
210
+
211
+ class AttCertIssuer(univ.Choice):
212
+ pass
213
+
214
+
215
+ AttCertIssuer.componentType = namedtype.NamedTypes(
216
+ namedtype.NamedType('v1Form', rfc3280.GeneralNames()),
217
+ namedtype.NamedType('v2Form',
218
+ V2Form().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
219
+ )
220
+
221
+
222
+ class Holder(univ.Sequence):
223
+ pass
224
+
225
+
226
+ Holder.componentType = namedtype.NamedTypes(
227
+ namedtype.OptionalNamedType('baseCertificateID', IssuerSerial().subtype(
228
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
229
+ namedtype.OptionalNamedType('entityName', rfc3280.GeneralNames().subtype(
230
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
231
+ namedtype.OptionalNamedType('objectDigestInfo', ObjectDigestInfo().subtype(
232
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
233
+ )
234
+
235
+
236
+ class AttributeCertificateInfo(univ.Sequence):
237
+ pass
238
+
239
+
240
+ AttributeCertificateInfo.componentType = namedtype.NamedTypes(
241
+ namedtype.NamedType('version', AttCertVersion()),
242
+ namedtype.NamedType('holder', Holder()),
243
+ namedtype.NamedType('issuer', AttCertIssuer()),
244
+ namedtype.NamedType('signature', rfc3280.AlgorithmIdentifier()),
245
+ namedtype.NamedType('serialNumber', rfc3280.CertificateSerialNumber()),
246
+ namedtype.NamedType('attrCertValidityPeriod', AttCertValidityPeriod()),
247
+ namedtype.NamedType('attributes', univ.SequenceOf(componentType=rfc3280.Attribute())),
248
+ namedtype.OptionalNamedType('issuerUniqueID', rfc3280.UniqueIdentifier()),
249
+ namedtype.OptionalNamedType('extensions', rfc3280.Extensions())
250
+ )
251
+
252
+
253
+ class AttributeCertificate(univ.Sequence):
254
+ pass
255
+
256
+
257
+ AttributeCertificate.componentType = namedtype.NamedTypes(
258
+ namedtype.NamedType('acinfo', AttributeCertificateInfo()),
259
+ namedtype.NamedType('signatureAlgorithm', rfc3280.AlgorithmIdentifier()),
260
+ namedtype.NamedType('signatureValue', univ.BitString())
261
+ )
262
+
263
+ id_mod = _buildOid(rfc3280.id_pkix, 0)
264
+
265
+ id_mod_attribute_cert = _buildOid(id_mod, 12)
266
+
267
+ id_aca_accessIdentity = _buildOid(id_aca, 2)
268
+
269
+
270
+ class RoleSyntax(univ.Sequence):
271
+ pass
272
+
273
+
274
+ RoleSyntax.componentType = namedtype.NamedTypes(
275
+ namedtype.OptionalNamedType('roleAuthority', rfc3280.GeneralNames().subtype(
276
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
277
+ namedtype.NamedType('roleName',
278
+ rfc3280.GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
279
+ )
280
+
281
+ id_aca_chargingIdentity = _buildOid(id_aca, 3)
282
+
283
+
284
+ class ACClearAttrs(univ.Sequence):
285
+ pass
286
+
287
+
288
+ ACClearAttrs.componentType = namedtype.NamedTypes(
289
+ namedtype.NamedType('acIssuer', rfc3280.GeneralName()),
290
+ namedtype.NamedType('acSerial', univ.Integer()),
291
+ namedtype.NamedType('attrs', univ.SequenceOf(componentType=rfc3280.Attribute()))
292
+ )
293
+
294
+ id_aca_group = _buildOid(id_aca, 4)
295
+
296
+ id_pe_ac_proxying = _buildOid(rfc3280.id_pe, 10)
297
+
298
+
299
+ class SvceAuthInfo(univ.Sequence):
300
+ pass
301
+
302
+
303
+ SvceAuthInfo.componentType = namedtype.NamedTypes(
304
+ namedtype.NamedType('service', rfc3280.GeneralName()),
305
+ namedtype.NamedType('ident', rfc3280.GeneralName()),
306
+ namedtype.OptionalNamedType('authInfo', univ.OctetString())
307
+ )
308
+
309
+
310
+ class IetfAttrSyntax(univ.Sequence):
311
+ pass
312
+
313
+
314
+ IetfAttrSyntax.componentType = namedtype.NamedTypes(
315
+ namedtype.OptionalNamedType(
316
+ 'policyAuthority', rfc3280.GeneralNames().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
317
+ ),
318
+ namedtype.NamedType(
319
+ 'values', univ.SequenceOf(
320
+ componentType=univ.Choice(
321
+ componentType=namedtype.NamedTypes(
322
+ namedtype.NamedType('octets', univ.OctetString()),
323
+ namedtype.NamedType('oid', univ.ObjectIdentifier()),
324
+ namedtype.NamedType('string', char.UTF8String())
325
+ )
326
+ )
327
+ )
328
+ )
329
+ )
330
+
331
+ id_aca_encAttrs = _buildOid(id_aca, 6)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3370.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Cryptographic Message Syntax (CMS) Algorithms
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc3370.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+
17
+ from pyasn1_modules import rfc3279
18
+ from pyasn1_modules import rfc5280
19
+ from pyasn1_modules import rfc5751
20
+ from pyasn1_modules import rfc5753
21
+ from pyasn1_modules import rfc5990
22
+ from pyasn1_modules import rfc8018
23
+
24
+
25
+ # Imports from RFC 5280
26
+
27
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
28
+
29
+
30
+ # Imports from RFC 3279
31
+
32
+ dhpublicnumber = rfc3279.dhpublicnumber
33
+
34
+ dh_public_number = dhpublicnumber
35
+
36
+ DHPublicKey = rfc3279.DHPublicKey
37
+
38
+ DomainParameters = rfc3279.DomainParameters
39
+
40
+ DHDomainParameters = DomainParameters
41
+
42
+ Dss_Parms = rfc3279.Dss_Parms
43
+
44
+ Dss_Sig_Value = rfc3279.Dss_Sig_Value
45
+
46
+ md5 = rfc3279.md5
47
+
48
+ md5WithRSAEncryption = rfc3279.md5WithRSAEncryption
49
+
50
+ RSAPublicKey = rfc3279.RSAPublicKey
51
+
52
+ rsaEncryption = rfc3279.rsaEncryption
53
+
54
+ ValidationParms = rfc3279.ValidationParms
55
+
56
+ id_dsa = rfc3279.id_dsa
57
+
58
+ id_dsa_with_sha1 = rfc3279.id_dsa_with_sha1
59
+
60
+ id_sha1 = rfc3279.id_sha1
61
+
62
+ sha_1 = id_sha1
63
+
64
+ sha1WithRSAEncryption = rfc3279.sha1WithRSAEncryption
65
+
66
+
67
+ # Imports from RFC 5753
68
+
69
+ CBCParameter = rfc5753.CBCParameter
70
+
71
+ CBCParameter = rfc5753.IV
72
+
73
+ KeyWrapAlgorithm = rfc5753.KeyWrapAlgorithm
74
+
75
+
76
+ # Imports from RFC 5990
77
+
78
+ id_alg_CMS3DESwrap = rfc5990.id_alg_CMS3DESwrap
79
+
80
+
81
+ # Imports from RFC 8018
82
+
83
+ des_EDE3_CBC = rfc8018.des_EDE3_CBC
84
+
85
+ des_ede3_cbc = des_EDE3_CBC
86
+
87
+ rc2CBC = rfc8018.rc2CBC
88
+
89
+ rc2_cbc = rc2CBC
90
+
91
+ RC2_CBC_Parameter = rfc8018.RC2_CBC_Parameter
92
+
93
+ RC2CBCParameter = RC2_CBC_Parameter
94
+
95
+ PBKDF2_params = rfc8018.PBKDF2_params
96
+
97
+ id_PBKDF2 = rfc8018.id_PBKDF2
98
+
99
+
100
+ # The few things that are not already defined elsewhere
101
+
102
+ hMAC_SHA1 = univ.ObjectIdentifier('1.3.6.1.5.5.8.1.2')
103
+
104
+
105
+ id_alg_ESDH = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.5')
106
+
107
+
108
+ id_alg_SSDH = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.10')
109
+
110
+
111
+ id_alg_CMSRC2wrap = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.7')
112
+
113
+
114
+ class RC2ParameterVersion(univ.Integer):
115
+ pass
116
+
117
+
118
+ class RC2wrapParameter(RC2ParameterVersion):
119
+ pass
120
+
121
+
122
+ class Dss_Pub_Key(univ.Integer):
123
+ pass
124
+
125
+
126
+ # Update the Algorithm Identifier map in rfc5280.py.
127
+
128
+ _algorithmIdentifierMapUpdate = {
129
+ hMAC_SHA1: univ.Null(""),
130
+ id_alg_CMSRC2wrap: RC2wrapParameter(),
131
+ id_alg_ESDH: KeyWrapAlgorithm(),
132
+ id_alg_SSDH: KeyWrapAlgorithm(),
133
+ }
134
+
135
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
136
+
137
+
138
+ # Update the S/MIME Capabilities map in rfc5751.py.
139
+
140
+ _smimeCapabilityMapUpdate = {
141
+ id_alg_CMSRC2wrap: RC2wrapParameter(),
142
+ id_alg_ESDH: KeyWrapAlgorithm(),
143
+ id_alg_SSDH: KeyWrapAlgorithm(),
144
+ }
145
+
146
+ rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3414.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # License: http://snmplabs.com/pyasn1/license.html
6
+ #
7
+ # SNMPv3 message syntax
8
+ #
9
+ # ASN.1 source from:
10
+ # http://www.ietf.org/rfc/rfc3414.txt
11
+ #
12
+ from pyasn1.type import constraint
13
+ from pyasn1.type import namedtype
14
+ from pyasn1.type import univ
15
+
16
+
17
+ class UsmSecurityParameters(univ.Sequence):
18
+ componentType = namedtype.NamedTypes(
19
+ namedtype.NamedType('msgAuthoritativeEngineID', univ.OctetString()),
20
+ namedtype.NamedType('msgAuthoritativeEngineBoots',
21
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
22
+ namedtype.NamedType('msgAuthoritativeEngineTime',
23
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
24
+ namedtype.NamedType('msgUserName',
25
+ univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(0, 32))),
26
+ namedtype.NamedType('msgAuthenticationParameters', univ.OctetString()),
27
+ namedtype.NamedType('msgPrivacyParameters', univ.OctetString())
28
+ )
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3820.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Diffie-Hellman Key Agreement
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc3820.txt
13
+ #
14
+
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules import rfc5280
19
+
20
+
21
+
22
+ class ProxyCertPathLengthConstraint(univ.Integer):
23
+ pass
24
+
25
+
26
+ class ProxyPolicy(univ.Sequence):
27
+ componentType = namedtype.NamedTypes(
28
+ namedtype.NamedType('policyLanguage', univ.ObjectIdentifier()),
29
+ namedtype.OptionalNamedType('policy', univ.OctetString())
30
+ )
31
+
32
+
33
+ class ProxyCertInfoExtension(univ.Sequence):
34
+ componentType = namedtype.NamedTypes(
35
+ namedtype.OptionalNamedType('pCPathLenConstraint',
36
+ ProxyCertPathLengthConstraint()),
37
+ namedtype.NamedType('proxyPolicy', ProxyPolicy())
38
+ )
39
+
40
+
41
+ id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
42
+
43
+
44
+ id_pe = id_pkix + (1, )
45
+
46
+ id_pe_proxyCertInfo = id_pe + (14, )
47
+
48
+
49
+ id_ppl = id_pkix + (21, )
50
+
51
+ id_ppl_anyLanguage = id_ppl + (0, )
52
+
53
+ id_ppl_inheritAll = id_ppl + (1, )
54
+
55
+ id_ppl_independent = id_ppl + (2, )
56
+
57
+
58
+ # Map of Certificate Extension OIDs to Extensions added to the
59
+ # ones that are in rfc5280.py
60
+
61
+ _certificateExtensionsMapUpdate = {
62
+ id_pe_proxyCertInfo: ProxyCertInfoExtension(),
63
+ }
64
+
65
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3852.py ADDED
@@ -0,0 +1,706 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Cryptographic Message Syntax (CMS)
10
+ #
11
+ # ASN.1 source from:
12
+ # http://www.ietf.org/rfc/rfc3852.txt
13
+ #
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
+ from pyasn1.type import useful
20
+
21
+ from pyasn1_modules import rfc3280
22
+ from pyasn1_modules import rfc3281
23
+
24
+ MAX = float('inf')
25
+
26
+
27
+ def _buildOid(*components):
28
+ output = []
29
+ for x in tuple(components):
30
+ if isinstance(x, univ.ObjectIdentifier):
31
+ output.extend(list(x))
32
+ else:
33
+ output.append(int(x))
34
+
35
+ return univ.ObjectIdentifier(output)
36
+
37
+
38
+ class AttributeValue(univ.Any):
39
+ pass
40
+
41
+
42
+ class Attribute(univ.Sequence):
43
+ pass
44
+
45
+
46
+ Attribute.componentType = namedtype.NamedTypes(
47
+ namedtype.NamedType('attrType', univ.ObjectIdentifier()),
48
+ namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()))
49
+ )
50
+
51
+
52
+ class SignedAttributes(univ.SetOf):
53
+ pass
54
+
55
+
56
+ SignedAttributes.componentType = Attribute()
57
+ SignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
58
+
59
+
60
+ class OtherRevocationInfoFormat(univ.Sequence):
61
+ pass
62
+
63
+
64
+ OtherRevocationInfoFormat.componentType = namedtype.NamedTypes(
65
+ namedtype.NamedType('otherRevInfoFormat', univ.ObjectIdentifier()),
66
+ namedtype.NamedType('otherRevInfo', univ.Any())
67
+ )
68
+
69
+
70
+ class RevocationInfoChoice(univ.Choice):
71
+ pass
72
+
73
+
74
+ RevocationInfoChoice.componentType = namedtype.NamedTypes(
75
+ namedtype.NamedType('crl', rfc3280.CertificateList()),
76
+ namedtype.NamedType('other', OtherRevocationInfoFormat().subtype(
77
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
78
+ )
79
+
80
+
81
+ class RevocationInfoChoices(univ.SetOf):
82
+ pass
83
+
84
+
85
+ RevocationInfoChoices.componentType = RevocationInfoChoice()
86
+
87
+
88
+ class OtherKeyAttribute(univ.Sequence):
89
+ pass
90
+
91
+
92
+ OtherKeyAttribute.componentType = namedtype.NamedTypes(
93
+ namedtype.NamedType('keyAttrId', univ.ObjectIdentifier()),
94
+ namedtype.OptionalNamedType('keyAttr', univ.Any())
95
+ )
96
+
97
+ id_signedData = _buildOid(1, 2, 840, 113549, 1, 7, 2)
98
+
99
+
100
+ class KeyEncryptionAlgorithmIdentifier(rfc3280.AlgorithmIdentifier):
101
+ pass
102
+
103
+
104
+ class EncryptedKey(univ.OctetString):
105
+ pass
106
+
107
+
108
+ class CMSVersion(univ.Integer):
109
+ pass
110
+
111
+
112
+ CMSVersion.namedValues = namedval.NamedValues(
113
+ ('v0', 0),
114
+ ('v1', 1),
115
+ ('v2', 2),
116
+ ('v3', 3),
117
+ ('v4', 4),
118
+ ('v5', 5)
119
+ )
120
+
121
+
122
+ class KEKIdentifier(univ.Sequence):
123
+ pass
124
+
125
+
126
+ KEKIdentifier.componentType = namedtype.NamedTypes(
127
+ namedtype.NamedType('keyIdentifier', univ.OctetString()),
128
+ namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
129
+ namedtype.OptionalNamedType('other', OtherKeyAttribute())
130
+ )
131
+
132
+
133
+ class KEKRecipientInfo(univ.Sequence):
134
+ pass
135
+
136
+
137
+ KEKRecipientInfo.componentType = namedtype.NamedTypes(
138
+ namedtype.NamedType('version', CMSVersion()),
139
+ namedtype.NamedType('kekid', KEKIdentifier()),
140
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
141
+ namedtype.NamedType('encryptedKey', EncryptedKey())
142
+ )
143
+
144
+
145
+ class KeyDerivationAlgorithmIdentifier(rfc3280.AlgorithmIdentifier):
146
+ pass
147
+
148
+
149
+ class PasswordRecipientInfo(univ.Sequence):
150
+ pass
151
+
152
+
153
+ PasswordRecipientInfo.componentType = namedtype.NamedTypes(
154
+ namedtype.NamedType('version', CMSVersion()),
155
+ namedtype.OptionalNamedType('keyDerivationAlgorithm', KeyDerivationAlgorithmIdentifier().subtype(
156
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
157
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
158
+ namedtype.NamedType('encryptedKey', EncryptedKey())
159
+ )
160
+
161
+
162
+ class OtherRecipientInfo(univ.Sequence):
163
+ pass
164
+
165
+
166
+ OtherRecipientInfo.componentType = namedtype.NamedTypes(
167
+ namedtype.NamedType('oriType', univ.ObjectIdentifier()),
168
+ namedtype.NamedType('oriValue', univ.Any())
169
+ )
170
+
171
+
172
+ class IssuerAndSerialNumber(univ.Sequence):
173
+ pass
174
+
175
+
176
+ IssuerAndSerialNumber.componentType = namedtype.NamedTypes(
177
+ namedtype.NamedType('issuer', rfc3280.Name()),
178
+ namedtype.NamedType('serialNumber', rfc3280.CertificateSerialNumber())
179
+ )
180
+
181
+
182
+ class SubjectKeyIdentifier(univ.OctetString):
183
+ pass
184
+
185
+
186
+ class RecipientKeyIdentifier(univ.Sequence):
187
+ pass
188
+
189
+
190
+ RecipientKeyIdentifier.componentType = namedtype.NamedTypes(
191
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier()),
192
+ namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
193
+ namedtype.OptionalNamedType('other', OtherKeyAttribute())
194
+ )
195
+
196
+
197
+ class KeyAgreeRecipientIdentifier(univ.Choice):
198
+ pass
199
+
200
+
201
+ KeyAgreeRecipientIdentifier.componentType = namedtype.NamedTypes(
202
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
203
+ namedtype.NamedType('rKeyId', RecipientKeyIdentifier().subtype(
204
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
205
+ )
206
+
207
+
208
+ class RecipientEncryptedKey(univ.Sequence):
209
+ pass
210
+
211
+
212
+ RecipientEncryptedKey.componentType = namedtype.NamedTypes(
213
+ namedtype.NamedType('rid', KeyAgreeRecipientIdentifier()),
214
+ namedtype.NamedType('encryptedKey', EncryptedKey())
215
+ )
216
+
217
+
218
+ class RecipientEncryptedKeys(univ.SequenceOf):
219
+ pass
220
+
221
+
222
+ RecipientEncryptedKeys.componentType = RecipientEncryptedKey()
223
+
224
+
225
+ class UserKeyingMaterial(univ.OctetString):
226
+ pass
227
+
228
+
229
+ class OriginatorPublicKey(univ.Sequence):
230
+ pass
231
+
232
+
233
+ OriginatorPublicKey.componentType = namedtype.NamedTypes(
234
+ namedtype.NamedType('algorithm', rfc3280.AlgorithmIdentifier()),
235
+ namedtype.NamedType('publicKey', univ.BitString())
236
+ )
237
+
238
+
239
+ class OriginatorIdentifierOrKey(univ.Choice):
240
+ pass
241
+
242
+
243
+ OriginatorIdentifierOrKey.componentType = namedtype.NamedTypes(
244
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
245
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
246
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
247
+ namedtype.NamedType('originatorKey', OriginatorPublicKey().subtype(
248
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
249
+ )
250
+
251
+
252
+ class KeyAgreeRecipientInfo(univ.Sequence):
253
+ pass
254
+
255
+
256
+ KeyAgreeRecipientInfo.componentType = namedtype.NamedTypes(
257
+ namedtype.NamedType('version', CMSVersion()),
258
+ namedtype.NamedType('originator', OriginatorIdentifierOrKey().subtype(
259
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
260
+ namedtype.OptionalNamedType('ukm', UserKeyingMaterial().subtype(
261
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
262
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
263
+ namedtype.NamedType('recipientEncryptedKeys', RecipientEncryptedKeys())
264
+ )
265
+
266
+
267
+ class RecipientIdentifier(univ.Choice):
268
+ pass
269
+
270
+
271
+ RecipientIdentifier.componentType = namedtype.NamedTypes(
272
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
273
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
274
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
275
+ )
276
+
277
+
278
+ class KeyTransRecipientInfo(univ.Sequence):
279
+ pass
280
+
281
+
282
+ KeyTransRecipientInfo.componentType = namedtype.NamedTypes(
283
+ namedtype.NamedType('version', CMSVersion()),
284
+ namedtype.NamedType('rid', RecipientIdentifier()),
285
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
286
+ namedtype.NamedType('encryptedKey', EncryptedKey())
287
+ )
288
+
289
+
290
+ class RecipientInfo(univ.Choice):
291
+ pass
292
+
293
+
294
+ RecipientInfo.componentType = namedtype.NamedTypes(
295
+ namedtype.NamedType('ktri', KeyTransRecipientInfo()),
296
+ namedtype.NamedType('kari', KeyAgreeRecipientInfo().subtype(
297
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
298
+ namedtype.NamedType('kekri', KEKRecipientInfo().subtype(
299
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
300
+ namedtype.NamedType('pwri', PasswordRecipientInfo().subtype(
301
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
302
+ namedtype.NamedType('ori', OtherRecipientInfo().subtype(
303
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
304
+ )
305
+
306
+
307
+ class RecipientInfos(univ.SetOf):
308
+ pass
309
+
310
+
311
+ RecipientInfos.componentType = RecipientInfo()
312
+ RecipientInfos.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
313
+
314
+
315
+ class DigestAlgorithmIdentifier(rfc3280.AlgorithmIdentifier):
316
+ pass
317
+
318
+
319
+ class Signature(univ.BitString):
320
+ pass
321
+
322
+
323
+ class SignerIdentifier(univ.Choice):
324
+ pass
325
+
326
+
327
+ SignerIdentifier.componentType = namedtype.NamedTypes(
328
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
329
+ namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
330
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
331
+ )
332
+
333
+
334
+ class UnprotectedAttributes(univ.SetOf):
335
+ pass
336
+
337
+
338
+ UnprotectedAttributes.componentType = Attribute()
339
+ UnprotectedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
340
+
341
+
342
+ class ContentType(univ.ObjectIdentifier):
343
+ pass
344
+
345
+
346
+ class EncryptedContent(univ.OctetString):
347
+ pass
348
+
349
+
350
+ class ContentEncryptionAlgorithmIdentifier(rfc3280.AlgorithmIdentifier):
351
+ pass
352
+
353
+
354
+ class EncryptedContentInfo(univ.Sequence):
355
+ pass
356
+
357
+
358
+ EncryptedContentInfo.componentType = namedtype.NamedTypes(
359
+ namedtype.NamedType('contentType', ContentType()),
360
+ namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
361
+ namedtype.OptionalNamedType('encryptedContent', EncryptedContent().subtype(
362
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
363
+ )
364
+
365
+
366
+ class EncryptedData(univ.Sequence):
367
+ pass
368
+
369
+
370
+ EncryptedData.componentType = namedtype.NamedTypes(
371
+ namedtype.NamedType('version', CMSVersion()),
372
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
373
+ namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
374
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
375
+ )
376
+
377
+ id_contentType = _buildOid(1, 2, 840, 113549, 1, 9, 3)
378
+
379
+ id_data = _buildOid(1, 2, 840, 113549, 1, 7, 1)
380
+
381
+ id_messageDigest = _buildOid(1, 2, 840, 113549, 1, 9, 4)
382
+
383
+
384
+ class DigestAlgorithmIdentifiers(univ.SetOf):
385
+ pass
386
+
387
+
388
+ DigestAlgorithmIdentifiers.componentType = DigestAlgorithmIdentifier()
389
+
390
+
391
+ class EncapsulatedContentInfo(univ.Sequence):
392
+ pass
393
+
394
+
395
+ EncapsulatedContentInfo.componentType = namedtype.NamedTypes(
396
+ namedtype.NamedType('eContentType', ContentType()),
397
+ namedtype.OptionalNamedType('eContent', univ.OctetString().subtype(
398
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
399
+ )
400
+
401
+
402
+ class Digest(univ.OctetString):
403
+ pass
404
+
405
+
406
+ class DigestedData(univ.Sequence):
407
+ pass
408
+
409
+
410
+ DigestedData.componentType = namedtype.NamedTypes(
411
+ namedtype.NamedType('version', CMSVersion()),
412
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
413
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
414
+ namedtype.NamedType('digest', Digest())
415
+ )
416
+
417
+
418
+ class ContentInfo(univ.Sequence):
419
+ pass
420
+
421
+
422
+ ContentInfo.componentType = namedtype.NamedTypes(
423
+ namedtype.NamedType('contentType', ContentType()),
424
+ namedtype.NamedType('content', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
425
+ )
426
+
427
+
428
+ class UnauthAttributes(univ.SetOf):
429
+ pass
430
+
431
+
432
+ UnauthAttributes.componentType = Attribute()
433
+ UnauthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
434
+
435
+
436
+ class ExtendedCertificateInfo(univ.Sequence):
437
+ pass
438
+
439
+
440
+ ExtendedCertificateInfo.componentType = namedtype.NamedTypes(
441
+ namedtype.NamedType('version', CMSVersion()),
442
+ namedtype.NamedType('certificate', rfc3280.Certificate()),
443
+ namedtype.NamedType('attributes', UnauthAttributes())
444
+ )
445
+
446
+
447
+ class SignatureAlgorithmIdentifier(rfc3280.AlgorithmIdentifier):
448
+ pass
449
+
450
+
451
+ class ExtendedCertificate(univ.Sequence):
452
+ pass
453
+
454
+
455
+ ExtendedCertificate.componentType = namedtype.NamedTypes(
456
+ namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
457
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
458
+ namedtype.NamedType('signature', Signature())
459
+ )
460
+
461
+
462
+ class OtherCertificateFormat(univ.Sequence):
463
+ pass
464
+
465
+
466
+ OtherCertificateFormat.componentType = namedtype.NamedTypes(
467
+ namedtype.NamedType('otherCertFormat', univ.ObjectIdentifier()),
468
+ namedtype.NamedType('otherCert', univ.Any())
469
+ )
470
+
471
+
472
+ class AttributeCertificateV2(rfc3281.AttributeCertificate):
473
+ pass
474
+
475
+
476
+ class AttCertVersionV1(univ.Integer):
477
+ pass
478
+
479
+
480
+ AttCertVersionV1.namedValues = namedval.NamedValues(
481
+ ('v1', 0)
482
+ )
483
+
484
+
485
+ class AttributeCertificateInfoV1(univ.Sequence):
486
+ pass
487
+
488
+
489
+ AttributeCertificateInfoV1.componentType = namedtype.NamedTypes(
490
+ namedtype.DefaultedNamedType('version', AttCertVersionV1().subtype(value="v1")),
491
+ namedtype.NamedType(
492
+ 'subject', univ.Choice(
493
+ componentType=namedtype.NamedTypes(
494
+ namedtype.NamedType('baseCertificateID', rfc3281.IssuerSerial().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
495
+ namedtype.NamedType('subjectName', rfc3280.GeneralNames().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
496
+ )
497
+ )
498
+ ),
499
+ namedtype.NamedType('issuer', rfc3280.GeneralNames()),
500
+ namedtype.NamedType('signature', rfc3280.AlgorithmIdentifier()),
501
+ namedtype.NamedType('serialNumber', rfc3280.CertificateSerialNumber()),
502
+ namedtype.NamedType('attCertValidityPeriod', rfc3281.AttCertValidityPeriod()),
503
+ namedtype.NamedType('attributes', univ.SequenceOf(componentType=rfc3280.Attribute())),
504
+ namedtype.OptionalNamedType('issuerUniqueID', rfc3280.UniqueIdentifier()),
505
+ namedtype.OptionalNamedType('extensions', rfc3280.Extensions())
506
+ )
507
+
508
+
509
+ class AttributeCertificateV1(univ.Sequence):
510
+ pass
511
+
512
+
513
+ AttributeCertificateV1.componentType = namedtype.NamedTypes(
514
+ namedtype.NamedType('acInfo', AttributeCertificateInfoV1()),
515
+ namedtype.NamedType('signatureAlgorithm', rfc3280.AlgorithmIdentifier()),
516
+ namedtype.NamedType('signature', univ.BitString())
517
+ )
518
+
519
+
520
+ class CertificateChoices(univ.Choice):
521
+ pass
522
+
523
+
524
+ CertificateChoices.componentType = namedtype.NamedTypes(
525
+ namedtype.NamedType('certificate', rfc3280.Certificate()),
526
+ namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
527
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
528
+ namedtype.NamedType('v1AttrCert', AttributeCertificateV1().subtype(
529
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
530
+ namedtype.NamedType('v2AttrCert', AttributeCertificateV2().subtype(
531
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
532
+ namedtype.NamedType('other', OtherCertificateFormat().subtype(
533
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
534
+ )
535
+
536
+
537
+ class CertificateSet(univ.SetOf):
538
+ pass
539
+
540
+
541
+ CertificateSet.componentType = CertificateChoices()
542
+
543
+
544
+ class MessageAuthenticationCode(univ.OctetString):
545
+ pass
546
+
547
+
548
+ class UnsignedAttributes(univ.SetOf):
549
+ pass
550
+
551
+
552
+ UnsignedAttributes.componentType = Attribute()
553
+ UnsignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
554
+
555
+
556
+ class SignatureValue(univ.OctetString):
557
+ pass
558
+
559
+
560
+ class SignerInfo(univ.Sequence):
561
+ pass
562
+
563
+
564
+ SignerInfo.componentType = namedtype.NamedTypes(
565
+ namedtype.NamedType('version', CMSVersion()),
566
+ namedtype.NamedType('sid', SignerIdentifier()),
567
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
568
+ namedtype.OptionalNamedType('signedAttrs', SignedAttributes().subtype(
569
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
570
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
571
+ namedtype.NamedType('signature', SignatureValue()),
572
+ namedtype.OptionalNamedType('unsignedAttrs', UnsignedAttributes().subtype(
573
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
574
+ )
575
+
576
+
577
+ class SignerInfos(univ.SetOf):
578
+ pass
579
+
580
+
581
+ SignerInfos.componentType = SignerInfo()
582
+
583
+
584
+ class SignedData(univ.Sequence):
585
+ pass
586
+
587
+
588
+ SignedData.componentType = namedtype.NamedTypes(
589
+ namedtype.NamedType('version', CMSVersion()),
590
+ namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
591
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
592
+ namedtype.OptionalNamedType('certificates', CertificateSet().subtype(
593
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
594
+ namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
595
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
596
+ namedtype.NamedType('signerInfos', SignerInfos())
597
+ )
598
+
599
+
600
+ class MessageAuthenticationCodeAlgorithm(rfc3280.AlgorithmIdentifier):
601
+ pass
602
+
603
+
604
+ class MessageDigest(univ.OctetString):
605
+ pass
606
+
607
+
608
+ class Time(univ.Choice):
609
+ pass
610
+
611
+
612
+ Time.componentType = namedtype.NamedTypes(
613
+ namedtype.NamedType('utcTime', useful.UTCTime()),
614
+ namedtype.NamedType('generalTime', useful.GeneralizedTime())
615
+ )
616
+
617
+
618
+ class OriginatorInfo(univ.Sequence):
619
+ pass
620
+
621
+
622
+ OriginatorInfo.componentType = namedtype.NamedTypes(
623
+ namedtype.OptionalNamedType('certs', CertificateSet().subtype(
624
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
625
+ namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
626
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
627
+ )
628
+
629
+
630
+ class AuthAttributes(univ.SetOf):
631
+ pass
632
+
633
+
634
+ AuthAttributes.componentType = Attribute()
635
+ AuthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
636
+
637
+
638
+ class AuthenticatedData(univ.Sequence):
639
+ pass
640
+
641
+
642
+ AuthenticatedData.componentType = namedtype.NamedTypes(
643
+ namedtype.NamedType('version', CMSVersion()),
644
+ namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
645
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
646
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
647
+ namedtype.NamedType('macAlgorithm', MessageAuthenticationCodeAlgorithm()),
648
+ namedtype.OptionalNamedType('digestAlgorithm', DigestAlgorithmIdentifier().subtype(
649
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
650
+ namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
651
+ namedtype.OptionalNamedType('authAttrs', AuthAttributes().subtype(
652
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
653
+ namedtype.NamedType('mac', MessageAuthenticationCode()),
654
+ namedtype.OptionalNamedType('unauthAttrs', UnauthAttributes().subtype(
655
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
656
+ )
657
+
658
+ id_ct_contentInfo = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 6)
659
+
660
+ id_envelopedData = _buildOid(1, 2, 840, 113549, 1, 7, 3)
661
+
662
+
663
+ class EnvelopedData(univ.Sequence):
664
+ pass
665
+
666
+
667
+ EnvelopedData.componentType = namedtype.NamedTypes(
668
+ namedtype.NamedType('version', CMSVersion()),
669
+ namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
670
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
671
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
672
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
673
+ namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
674
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
675
+ )
676
+
677
+
678
+ class Countersignature(SignerInfo):
679
+ pass
680
+
681
+
682
+ id_digestedData = _buildOid(1, 2, 840, 113549, 1, 7, 5)
683
+
684
+ id_signingTime = _buildOid(1, 2, 840, 113549, 1, 9, 5)
685
+
686
+
687
+ class ExtendedCertificateOrCertificate(univ.Choice):
688
+ pass
689
+
690
+
691
+ ExtendedCertificateOrCertificate.componentType = namedtype.NamedTypes(
692
+ namedtype.NamedType('certificate', rfc3280.Certificate()),
693
+ namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
694
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
695
+ )
696
+
697
+ id_encryptedData = _buildOid(1, 2, 840, 113549, 1, 7, 6)
698
+
699
+ id_ct_authData = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 2)
700
+
701
+
702
+ class SigningTime(Time):
703
+ pass
704
+
705
+
706
+ id_countersignature = _buildOid(1, 2, 840, 113549, 1, 9, 6)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4043.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Internet X.509 Public Key Infrastructure Permanent Identifier
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4043.txt
13
+ #
14
+
15
+ from pyasn1.type import char
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5280
20
+
21
+
22
+ id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
23
+
24
+ id_on = id_pkix + (8, )
25
+
26
+ id_on_permanentIdentifier = id_on + (3, )
27
+
28
+
29
+ class PermanentIdentifier(univ.Sequence):
30
+ componentType = namedtype.NamedTypes(
31
+ namedtype.OptionalNamedType('identifierValue', char.UTF8String()),
32
+ namedtype.OptionalNamedType('assigner', univ.ObjectIdentifier())
33
+ )
34
+
35
+
36
+ # Map of Other Name OIDs to Other Name is added to the
37
+ # ones that are in rfc5280.py
38
+
39
+ _anotherNameMapUpdate = {
40
+ id_on_permanentIdentifier: PermanentIdentifier(),
41
+ }
42
+
43
+ rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4073.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with some assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add a map for use with opentypes.
6
+ #
7
+ # Copyright (c) 2019, Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Protecting Multiple Contents with the CMS
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4073.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc5652
21
+
22
+ MAX = float('inf')
23
+
24
+
25
+ # Content Collection Content Type and Object Identifier
26
+
27
+ id_ct_contentCollection = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.19')
28
+
29
+ class ContentCollection(univ.SequenceOf):
30
+ pass
31
+
32
+ ContentCollection.componentType = rfc5652.ContentInfo()
33
+ ContentCollection.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
34
+
35
+
36
+ # Content With Attributes Content Type and Object Identifier
37
+
38
+ id_ct_contentWithAttrs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.20')
39
+
40
+ class ContentWithAttributes(univ.Sequence):
41
+ pass
42
+
43
+ ContentWithAttributes.componentType = namedtype.NamedTypes(
44
+ namedtype.NamedType('content', rfc5652.ContentInfo()),
45
+ namedtype.NamedType('attrs', univ.SequenceOf(
46
+ componentType=rfc5652.Attribute()).subtype(
47
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
48
+ )
49
+
50
+
51
+ # Map of Content Type OIDs to Content Types is added to the
52
+ # ones that are in rfc5652.py
53
+
54
+ _cmsContentTypesMapUpdate = {
55
+ id_ct_contentCollection: ContentCollection(),
56
+ id_ct_contentWithAttrs: ContentWithAttributes(),
57
+ }
58
+
59
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4211.py ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Internet X.509 Public Key Infrastructure Certificate Request
10
+ # Message Format (CRMF)
11
+ #
12
+ # ASN.1 source from:
13
+ # http://www.ietf.org/rfc/rfc4211.txt
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
+
22
+ from pyasn1_modules import rfc3280
23
+ from pyasn1_modules import rfc3852
24
+
25
+ MAX = float('inf')
26
+
27
+
28
+ def _buildOid(*components):
29
+ output = []
30
+ for x in tuple(components):
31
+ if isinstance(x, univ.ObjectIdentifier):
32
+ output.extend(list(x))
33
+ else:
34
+ output.append(int(x))
35
+
36
+ return univ.ObjectIdentifier(output)
37
+
38
+
39
+ id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7)
40
+
41
+ id_pkip = _buildOid(id_pkix, 5)
42
+
43
+ id_regCtrl = _buildOid(id_pkip, 1)
44
+
45
+
46
+ class SinglePubInfo(univ.Sequence):
47
+ pass
48
+
49
+
50
+ SinglePubInfo.componentType = namedtype.NamedTypes(
51
+ namedtype.NamedType('pubMethod', univ.Integer(
52
+ namedValues=namedval.NamedValues(('dontCare', 0), ('x500', 1), ('web', 2), ('ldap', 3)))),
53
+ namedtype.OptionalNamedType('pubLocation', rfc3280.GeneralName())
54
+ )
55
+
56
+
57
+ class UTF8Pairs(char.UTF8String):
58
+ pass
59
+
60
+
61
+ class PKMACValue(univ.Sequence):
62
+ pass
63
+
64
+
65
+ PKMACValue.componentType = namedtype.NamedTypes(
66
+ namedtype.NamedType('algId', rfc3280.AlgorithmIdentifier()),
67
+ namedtype.NamedType('value', univ.BitString())
68
+ )
69
+
70
+
71
+ class POPOSigningKeyInput(univ.Sequence):
72
+ pass
73
+
74
+
75
+ POPOSigningKeyInput.componentType = namedtype.NamedTypes(
76
+ namedtype.NamedType(
77
+ 'authInfo', univ.Choice(
78
+ componentType=namedtype.NamedTypes(
79
+ namedtype.NamedType(
80
+ 'sender', rfc3280.GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))
81
+ ),
82
+ namedtype.NamedType(
83
+ 'publicKeyMAC', PKMACValue()
84
+ )
85
+ )
86
+ )
87
+ ),
88
+ namedtype.NamedType('publicKey', rfc3280.SubjectPublicKeyInfo())
89
+ )
90
+
91
+
92
+ class POPOSigningKey(univ.Sequence):
93
+ pass
94
+
95
+
96
+ POPOSigningKey.componentType = namedtype.NamedTypes(
97
+ namedtype.OptionalNamedType('poposkInput', POPOSigningKeyInput().subtype(
98
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
99
+ namedtype.NamedType('algorithmIdentifier', rfc3280.AlgorithmIdentifier()),
100
+ namedtype.NamedType('signature', univ.BitString())
101
+ )
102
+
103
+
104
+ class Attributes(univ.SetOf):
105
+ pass
106
+
107
+
108
+ Attributes.componentType = rfc3280.Attribute()
109
+
110
+
111
+ class PrivateKeyInfo(univ.Sequence):
112
+ pass
113
+
114
+
115
+ PrivateKeyInfo.componentType = namedtype.NamedTypes(
116
+ namedtype.NamedType('version', univ.Integer()),
117
+ namedtype.NamedType('privateKeyAlgorithm', rfc3280.AlgorithmIdentifier()),
118
+ namedtype.NamedType('privateKey', univ.OctetString()),
119
+ namedtype.OptionalNamedType('attributes',
120
+ Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
121
+ )
122
+
123
+
124
+ class EncryptedValue(univ.Sequence):
125
+ pass
126
+
127
+
128
+ EncryptedValue.componentType = namedtype.NamedTypes(
129
+ namedtype.OptionalNamedType('intendedAlg', rfc3280.AlgorithmIdentifier().subtype(
130
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
131
+ namedtype.OptionalNamedType('symmAlg', rfc3280.AlgorithmIdentifier().subtype(
132
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
133
+ namedtype.OptionalNamedType('encSymmKey', univ.BitString().subtype(
134
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
135
+ namedtype.OptionalNamedType('keyAlg', rfc3280.AlgorithmIdentifier().subtype(
136
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
137
+ namedtype.OptionalNamedType('valueHint', univ.OctetString().subtype(
138
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
139
+ namedtype.NamedType('encValue', univ.BitString())
140
+ )
141
+
142
+
143
+ class EncryptedKey(univ.Choice):
144
+ pass
145
+
146
+
147
+ EncryptedKey.componentType = namedtype.NamedTypes(
148
+ namedtype.NamedType('encryptedValue', EncryptedValue()),
149
+ namedtype.NamedType('envelopedData', rfc3852.EnvelopedData().subtype(
150
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
151
+ )
152
+
153
+
154
+ class KeyGenParameters(univ.OctetString):
155
+ pass
156
+
157
+
158
+ class PKIArchiveOptions(univ.Choice):
159
+ pass
160
+
161
+
162
+ PKIArchiveOptions.componentType = namedtype.NamedTypes(
163
+ namedtype.NamedType('encryptedPrivKey',
164
+ EncryptedKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
165
+ namedtype.NamedType('keyGenParameters',
166
+ KeyGenParameters().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
167
+ namedtype.NamedType('archiveRemGenPrivKey',
168
+ univ.Boolean().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
169
+ )
170
+
171
+ id_regCtrl_authenticator = _buildOid(id_regCtrl, 2)
172
+
173
+ id_regInfo = _buildOid(id_pkip, 2)
174
+
175
+ id_regInfo_certReq = _buildOid(id_regInfo, 2)
176
+
177
+
178
+ class ProtocolEncrKey(rfc3280.SubjectPublicKeyInfo):
179
+ pass
180
+
181
+
182
+ class Authenticator(char.UTF8String):
183
+ pass
184
+
185
+
186
+ class SubsequentMessage(univ.Integer):
187
+ pass
188
+
189
+
190
+ SubsequentMessage.namedValues = namedval.NamedValues(
191
+ ('encrCert', 0),
192
+ ('challengeResp', 1)
193
+ )
194
+
195
+
196
+ class AttributeTypeAndValue(univ.Sequence):
197
+ pass
198
+
199
+
200
+ AttributeTypeAndValue.componentType = namedtype.NamedTypes(
201
+ namedtype.NamedType('type', univ.ObjectIdentifier()),
202
+ namedtype.NamedType('value', univ.Any())
203
+ )
204
+
205
+
206
+ class POPOPrivKey(univ.Choice):
207
+ pass
208
+
209
+
210
+ POPOPrivKey.componentType = namedtype.NamedTypes(
211
+ namedtype.NamedType('thisMessage',
212
+ univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
213
+ namedtype.NamedType('subsequentMessage',
214
+ SubsequentMessage().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
215
+ namedtype.NamedType('dhMAC',
216
+ univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
217
+ namedtype.NamedType('agreeMAC',
218
+ PKMACValue().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
219
+ namedtype.NamedType('encryptedKey', rfc3852.EnvelopedData().subtype(
220
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
221
+ )
222
+
223
+
224
+ class ProofOfPossession(univ.Choice):
225
+ pass
226
+
227
+
228
+ ProofOfPossession.componentType = namedtype.NamedTypes(
229
+ namedtype.NamedType('raVerified',
230
+ univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
231
+ namedtype.NamedType('signature', POPOSigningKey().subtype(
232
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
233
+ namedtype.NamedType('keyEncipherment',
234
+ POPOPrivKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
235
+ namedtype.NamedType('keyAgreement',
236
+ POPOPrivKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
237
+ )
238
+
239
+
240
+ class OptionalValidity(univ.Sequence):
241
+ pass
242
+
243
+
244
+ OptionalValidity.componentType = namedtype.NamedTypes(
245
+ namedtype.OptionalNamedType('notBefore', rfc3280.Time().subtype(
246
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
247
+ namedtype.OptionalNamedType('notAfter', rfc3280.Time().subtype(
248
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
249
+ )
250
+
251
+
252
+ class CertTemplate(univ.Sequence):
253
+ pass
254
+
255
+
256
+ CertTemplate.componentType = namedtype.NamedTypes(
257
+ namedtype.OptionalNamedType('version', rfc3280.Version().subtype(
258
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
259
+ namedtype.OptionalNamedType('serialNumber', univ.Integer().subtype(
260
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
261
+ namedtype.OptionalNamedType('signingAlg', rfc3280.AlgorithmIdentifier().subtype(
262
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
263
+ namedtype.OptionalNamedType('issuer', rfc3280.Name().subtype(
264
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
265
+ namedtype.OptionalNamedType('validity', OptionalValidity().subtype(
266
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
267
+ namedtype.OptionalNamedType('subject', rfc3280.Name().subtype(
268
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
269
+ namedtype.OptionalNamedType('publicKey', rfc3280.SubjectPublicKeyInfo().subtype(
270
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
271
+ namedtype.OptionalNamedType('issuerUID', rfc3280.UniqueIdentifier().subtype(
272
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
273
+ namedtype.OptionalNamedType('subjectUID', rfc3280.UniqueIdentifier().subtype(
274
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))),
275
+ namedtype.OptionalNamedType('extensions', rfc3280.Extensions().subtype(
276
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 9)))
277
+ )
278
+
279
+
280
+ class Controls(univ.SequenceOf):
281
+ pass
282
+
283
+
284
+ Controls.componentType = AttributeTypeAndValue()
285
+ Controls.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
286
+
287
+
288
+ class CertRequest(univ.Sequence):
289
+ pass
290
+
291
+
292
+ CertRequest.componentType = namedtype.NamedTypes(
293
+ namedtype.NamedType('certReqId', univ.Integer()),
294
+ namedtype.NamedType('certTemplate', CertTemplate()),
295
+ namedtype.OptionalNamedType('controls', Controls())
296
+ )
297
+
298
+
299
+ class CertReqMsg(univ.Sequence):
300
+ pass
301
+
302
+
303
+ CertReqMsg.componentType = namedtype.NamedTypes(
304
+ namedtype.NamedType('certReq', CertRequest()),
305
+ namedtype.OptionalNamedType('popo', ProofOfPossession()),
306
+ namedtype.OptionalNamedType('regInfo', univ.SequenceOf(componentType=AttributeTypeAndValue()))
307
+ )
308
+
309
+
310
+ class CertReqMessages(univ.SequenceOf):
311
+ pass
312
+
313
+
314
+ CertReqMessages.componentType = CertReqMsg()
315
+ CertReqMessages.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
316
+
317
+
318
+ class CertReq(CertRequest):
319
+ pass
320
+
321
+
322
+ id_regCtrl_pkiPublicationInfo = _buildOid(id_regCtrl, 3)
323
+
324
+
325
+ class CertId(univ.Sequence):
326
+ pass
327
+
328
+
329
+ CertId.componentType = namedtype.NamedTypes(
330
+ namedtype.NamedType('issuer', rfc3280.GeneralName()),
331
+ namedtype.NamedType('serialNumber', univ.Integer())
332
+ )
333
+
334
+
335
+ class OldCertId(CertId):
336
+ pass
337
+
338
+
339
+ class PKIPublicationInfo(univ.Sequence):
340
+ pass
341
+
342
+
343
+ PKIPublicationInfo.componentType = namedtype.NamedTypes(
344
+ namedtype.NamedType('action',
345
+ univ.Integer(namedValues=namedval.NamedValues(('dontPublish', 0), ('pleasePublish', 1)))),
346
+ namedtype.OptionalNamedType('pubInfos', univ.SequenceOf(componentType=SinglePubInfo()))
347
+ )
348
+
349
+
350
+ class EncKeyWithID(univ.Sequence):
351
+ pass
352
+
353
+
354
+ EncKeyWithID.componentType = namedtype.NamedTypes(
355
+ namedtype.NamedType('privateKey', PrivateKeyInfo()),
356
+ namedtype.OptionalNamedType(
357
+ 'identifier', univ.Choice(
358
+ componentType=namedtype.NamedTypes(
359
+ namedtype.NamedType('string', char.UTF8String()),
360
+ namedtype.NamedType('generalName', rfc3280.GeneralName())
361
+ )
362
+ )
363
+ )
364
+ )
365
+
366
+ id_regCtrl_protocolEncrKey = _buildOid(id_regCtrl, 6)
367
+
368
+ id_regCtrl_oldCertID = _buildOid(id_regCtrl, 5)
369
+
370
+ id_smime = _buildOid(1, 2, 840, 113549, 1, 9, 16)
371
+
372
+
373
+ class PBMParameter(univ.Sequence):
374
+ pass
375
+
376
+
377
+ PBMParameter.componentType = namedtype.NamedTypes(
378
+ namedtype.NamedType('salt', univ.OctetString()),
379
+ namedtype.NamedType('owf', rfc3280.AlgorithmIdentifier()),
380
+ namedtype.NamedType('iterationCount', univ.Integer()),
381
+ namedtype.NamedType('mac', rfc3280.AlgorithmIdentifier())
382
+ )
383
+
384
+ id_regCtrl_regToken = _buildOid(id_regCtrl, 1)
385
+
386
+ id_regCtrl_pkiArchiveOptions = _buildOid(id_regCtrl, 4)
387
+
388
+ id_regInfo_utf8Pairs = _buildOid(id_regInfo, 1)
389
+
390
+ id_ct = _buildOid(id_smime, 1)
391
+
392
+ id_ct_encKeyWithID = _buildOid(id_ct, 21)
393
+
394
+
395
+ class RegToken(char.UTF8String):
396
+ pass
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4334.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Certificate Extensions and Attributes Supporting Authentication
10
+ # in PPP and Wireless LAN Networks
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4334.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5280
20
+
21
+ MAX = float('inf')
22
+
23
+
24
+ # OID Arcs
25
+
26
+ id_pe = univ.ObjectIdentifier('1.3.6.1.5.5.7.1')
27
+
28
+ id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
29
+
30
+ id_aca = univ.ObjectIdentifier('1.3.6.1.5.5.7.10')
31
+
32
+
33
+ # Extended Key Usage Values
34
+
35
+ id_kp_eapOverPPP = id_kp + (13, )
36
+
37
+ id_kp_eapOverLAN = id_kp + (14, )
38
+
39
+
40
+ # Wireless LAN SSID Extension
41
+
42
+ id_pe_wlanSSID = id_pe + (13, )
43
+
44
+ class SSID(univ.OctetString):
45
+ constraint.ValueSizeConstraint(1, 32)
46
+
47
+
48
+ class SSIDList(univ.SequenceOf):
49
+ componentType = SSID()
50
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
51
+
52
+
53
+ # Wireless LAN SSID Attribute Certificate Attribute
54
+
55
+ id_aca_wlanSSID = id_aca + (7, )
56
+
57
+
58
+ # Map of Certificate Extension OIDs to Extensions
59
+ # To be added to the ones that are in rfc5280.py
60
+
61
+ _certificateExtensionsMap = {
62
+ id_pe_wlanSSID: SSIDList(),
63
+ }
64
+
65
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
66
+
67
+
68
+ # Map of AttributeType OIDs to AttributeValue added to the
69
+ # ones that are in rfc5280.py
70
+
71
+ _certificateAttributesMapUpdate = {
72
+ id_aca_wlanSSID: SSIDList(),
73
+ }
74
+
75
+ rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4357.py ADDED
@@ -0,0 +1,477 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Additional Cryptographic Algorithms for Use with GOST 28147-89,
10
+ # GOST R 34.10-94, GOST R 34.10-2001, and GOST R 34.11-94 Algorithms
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4357.txt
14
+ # https://www.rfc-editor.org/errata/eid5927
15
+ # https://www.rfc-editor.org/errata/eid5928
16
+ #
17
+
18
+ from pyasn1.type import constraint
19
+ from pyasn1.type import namedtype
20
+ from pyasn1.type import namedval
21
+ from pyasn1.type import tag
22
+ from pyasn1.type import univ
23
+
24
+ from pyasn1_modules import rfc5280
25
+
26
+
27
+ # Import from RFC 5280
28
+
29
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
30
+
31
+
32
+ # Object Identifiers
33
+
34
+ id_CryptoPro = univ.ObjectIdentifier((1, 2, 643, 2, 2,))
35
+
36
+
37
+ id_CryptoPro_modules = id_CryptoPro + (1, 1,)
38
+
39
+ id_CryptoPro_extensions = id_CryptoPro + (34,)
40
+
41
+ id_CryptoPro_policyIds = id_CryptoPro + (38,)
42
+
43
+ id_CryptoPro_policyQt = id_CryptoPro + (39,)
44
+
45
+
46
+ cryptographic_Gost_Useful_Definitions = id_CryptoPro_modules + (0, 1,)
47
+
48
+ gostR3411_94_DigestSyntax = id_CryptoPro_modules + (1, 1,)
49
+
50
+ gostR3410_94_PKISyntax = id_CryptoPro_modules + (2, 1,)
51
+
52
+ gostR3410_94_SignatureSyntax = id_CryptoPro_modules + (3, 1,)
53
+
54
+ gost28147_89_EncryptionSyntax = id_CryptoPro_modules + (4, 1,)
55
+
56
+ gostR3410_EncryptionSyntax = id_CryptoPro_modules + (5, 2,)
57
+
58
+ gost28147_89_ParamSetSyntax = id_CryptoPro_modules + (6, 1,)
59
+
60
+ gostR3411_94_ParamSetSyntax = id_CryptoPro_modules + (7, 1,)
61
+
62
+ gostR3410_94_ParamSetSyntax = id_CryptoPro_modules + (8, 1, 1)
63
+
64
+ gostR3410_2001_PKISyntax = id_CryptoPro_modules + (9, 1,)
65
+
66
+ gostR3410_2001_SignatureSyntax = id_CryptoPro_modules + (10, 1,)
67
+
68
+ gostR3410_2001_ParamSetSyntax = id_CryptoPro_modules + (12, 1,)
69
+
70
+ gost_CryptoPro_ExtendedKeyUsage = id_CryptoPro_modules + (13, 1,)
71
+
72
+ gost_CryptoPro_PrivateKey = id_CryptoPro_modules + (14, 1,)
73
+
74
+ gost_CryptoPro_PKIXCMP = id_CryptoPro_modules + (15, 1,)
75
+
76
+ gost_CryptoPro_TLS = id_CryptoPro_modules + (16, 1,)
77
+
78
+ gost_CryptoPro_Policy = id_CryptoPro_modules + (17, 1,)
79
+
80
+ gost_CryptoPro_Constants = id_CryptoPro_modules + (18, 1,)
81
+
82
+
83
+ id_CryptoPro_algorithms = id_CryptoPro
84
+
85
+ id_GostR3411_94_with_GostR3410_2001 = id_CryptoPro_algorithms + (3,)
86
+
87
+ id_GostR3411_94_with_GostR3410_94 = id_CryptoPro_algorithms + (4,)
88
+
89
+ id_GostR3411_94 = id_CryptoPro_algorithms + (9,)
90
+
91
+ id_Gost28147_89_None_KeyMeshing = id_CryptoPro_algorithms + (14, 0,)
92
+
93
+ id_Gost28147_89_CryptoPro_KeyMeshing = id_CryptoPro_algorithms + (14, 1,)
94
+
95
+ id_GostR3410_2001 = id_CryptoPro_algorithms + (19,)
96
+
97
+ id_GostR3410_94 = id_CryptoPro_algorithms + (20,)
98
+
99
+ id_Gost28147_89 = id_CryptoPro_algorithms + (21,)
100
+
101
+ id_Gost28147_89_MAC = id_CryptoPro_algorithms + (22,)
102
+
103
+ id_CryptoPro_hashes = id_CryptoPro_algorithms + (30,)
104
+
105
+ id_CryptoPro_encrypts = id_CryptoPro_algorithms + (31,)
106
+
107
+ id_CryptoPro_signs = id_CryptoPro_algorithms + (32,)
108
+
109
+ id_CryptoPro_exchanges = id_CryptoPro_algorithms + (33,)
110
+
111
+ id_CryptoPro_ecc_signs = id_CryptoPro_algorithms + (35,)
112
+
113
+ id_CryptoPro_ecc_exchanges = id_CryptoPro_algorithms + (36,)
114
+
115
+ id_CryptoPro_private_keys = id_CryptoPro_algorithms + (37,)
116
+
117
+ id_CryptoPro_pkixcmp_infos = id_CryptoPro_algorithms + (41,)
118
+
119
+ id_CryptoPro_audit_service_types = id_CryptoPro_algorithms + (42,)
120
+
121
+ id_CryptoPro_audit_record_types = id_CryptoPro_algorithms + (43,)
122
+
123
+ id_CryptoPro_attributes = id_CryptoPro_algorithms + (44,)
124
+
125
+ id_CryptoPro_name_service_types = id_CryptoPro_algorithms + (45,)
126
+
127
+ id_GostR3410_2001DH = id_CryptoPro_algorithms + (98,)
128
+
129
+ id_GostR3410_94DH = id_CryptoPro_algorithms + (99,)
130
+
131
+
132
+ id_Gost28147_89_TestParamSet = id_CryptoPro_encrypts + (0,)
133
+
134
+ id_Gost28147_89_CryptoPro_A_ParamSet = id_CryptoPro_encrypts + (1,)
135
+
136
+ id_Gost28147_89_CryptoPro_B_ParamSet = id_CryptoPro_encrypts + (2,)
137
+
138
+ id_Gost28147_89_CryptoPro_C_ParamSet = id_CryptoPro_encrypts + (3,)
139
+
140
+ id_Gost28147_89_CryptoPro_D_ParamSet = id_CryptoPro_encrypts + (4,)
141
+
142
+ id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet = id_CryptoPro_encrypts + (5,)
143
+
144
+ id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet = id_CryptoPro_encrypts + (6,)
145
+
146
+ id_Gost28147_89_CryptoPro_RIC_1_ParamSet = id_CryptoPro_encrypts + (7,)
147
+
148
+
149
+ id_GostR3410_2001_TestParamSet = id_CryptoPro_ecc_signs + (0,)
150
+
151
+ id_GostR3410_2001_CryptoPro_A_ParamSet = id_CryptoPro_ecc_signs + (1,)
152
+
153
+ id_GostR3410_2001_CryptoPro_B_ParamSet = id_CryptoPro_ecc_signs + (2,)
154
+
155
+ id_GostR3410_2001_CryptoPro_C_ParamSet = id_CryptoPro_ecc_signs + (3,)
156
+
157
+
158
+ id_GostR3410_2001_CryptoPro_XchA_ParamSet = id_CryptoPro_ecc_exchanges + (0,)
159
+
160
+ id_GostR3410_2001_CryptoPro_XchB_ParamSet = id_CryptoPro_ecc_exchanges + (1,)
161
+
162
+
163
+ id_GostR3410_94_TestParamSet = id_CryptoPro_signs + (0,)
164
+
165
+ id_GostR3410_94_CryptoPro_A_ParamSet = id_CryptoPro_signs + (2,)
166
+
167
+ id_GostR3410_94_CryptoPro_B_ParamSet = id_CryptoPro_signs + (3,)
168
+
169
+ id_GostR3410_94_CryptoPro_C_ParamSet = id_CryptoPro_signs + (4,)
170
+
171
+ id_GostR3410_94_CryptoPro_D_ParamSet = id_CryptoPro_signs + (5,)
172
+
173
+
174
+ id_GostR3410_94_CryptoPro_XchA_ParamSet = id_CryptoPro_exchanges + (1,)
175
+
176
+ id_GostR3410_94_CryptoPro_XchB_ParamSet = id_CryptoPro_exchanges + (2,)
177
+
178
+ id_GostR3410_94_CryptoPro_XchC_ParamSet = id_CryptoPro_exchanges + (3,)
179
+
180
+
181
+ id_GostR3410_94_a = id_GostR3410_94 + (1,)
182
+
183
+ id_GostR3410_94_aBis = id_GostR3410_94 + (2,)
184
+
185
+ id_GostR3410_94_b = id_GostR3410_94 + (3,)
186
+
187
+ id_GostR3410_94_bBis = id_GostR3410_94 + (4,)
188
+
189
+
190
+ id_GostR3411_94_TestParamSet = id_CryptoPro_hashes + (0,)
191
+
192
+ id_GostR3411_94_CryptoProParamSet = id_CryptoPro_hashes + (1,)
193
+
194
+
195
+
196
+
197
+ class Gost28147_89_ParamSet(univ.ObjectIdentifier):
198
+ pass
199
+
200
+ Gost28147_89_ParamSet.subtypeSpec = constraint.SingleValueConstraint(
201
+ id_Gost28147_89_TestParamSet,
202
+ id_Gost28147_89_CryptoPro_A_ParamSet,
203
+ id_Gost28147_89_CryptoPro_B_ParamSet,
204
+ id_Gost28147_89_CryptoPro_C_ParamSet,
205
+ id_Gost28147_89_CryptoPro_D_ParamSet,
206
+ id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet,
207
+ id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet,
208
+ id_Gost28147_89_CryptoPro_RIC_1_ParamSet
209
+ )
210
+
211
+
212
+ class Gost28147_89_BlobParameters(univ.Sequence):
213
+ pass
214
+
215
+ Gost28147_89_BlobParameters.componentType = namedtype.NamedTypes(
216
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet())
217
+ )
218
+
219
+
220
+ class Gost28147_89_MAC(univ.OctetString):
221
+ pass
222
+
223
+ Gost28147_89_MAC.subtypeSpec = constraint.ValueSizeConstraint(1, 4)
224
+
225
+
226
+ class Gost28147_89_Key(univ.OctetString):
227
+ pass
228
+
229
+ Gost28147_89_Key.subtypeSpec = constraint.ValueSizeConstraint(32, 32)
230
+
231
+
232
+ class Gost28147_89_EncryptedKey(univ.Sequence):
233
+ pass
234
+
235
+ Gost28147_89_EncryptedKey.componentType = namedtype.NamedTypes(
236
+ namedtype.NamedType('encryptedKey', Gost28147_89_Key()),
237
+ namedtype.OptionalNamedType('maskKey', Gost28147_89_Key().subtype(
238
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
239
+ namedtype.NamedType('macKey', Gost28147_89_MAC())
240
+ )
241
+
242
+
243
+ class Gost28147_89_IV(univ.OctetString):
244
+ pass
245
+
246
+ Gost28147_89_IV.subtypeSpec = constraint.ValueSizeConstraint(8, 8)
247
+
248
+
249
+ class Gost28147_89_UZ(univ.OctetString):
250
+ pass
251
+
252
+ Gost28147_89_UZ.subtypeSpec = constraint.ValueSizeConstraint(64, 64)
253
+
254
+
255
+ class Gost28147_89_ParamSetParameters(univ.Sequence):
256
+ pass
257
+
258
+ Gost28147_89_ParamSetParameters.componentType = namedtype.NamedTypes(
259
+ namedtype.NamedType('eUZ', Gost28147_89_UZ()),
260
+ namedtype.NamedType('mode',
261
+ univ.Integer(namedValues=namedval.NamedValues(
262
+ ('gost28147-89-CNT', 0),
263
+ ('gost28147-89-CFB', 1),
264
+ ('cryptoPro-CBC', 2)
265
+ ))),
266
+ namedtype.NamedType('shiftBits',
267
+ univ.Integer(namedValues=namedval.NamedValues(
268
+ ('gost28147-89-block', 64)
269
+ ))),
270
+ namedtype.NamedType('keyMeshing', AlgorithmIdentifier())
271
+ )
272
+
273
+
274
+ class Gost28147_89_Parameters(univ.Sequence):
275
+ pass
276
+
277
+ Gost28147_89_Parameters.componentType = namedtype.NamedTypes(
278
+ namedtype.NamedType('iv', Gost28147_89_IV()),
279
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet())
280
+ )
281
+
282
+
283
+ class GostR3410_2001_CertificateSignature(univ.BitString):
284
+ pass
285
+
286
+ GostR3410_2001_CertificateSignature.subtypeSpec=constraint.ValueSizeConstraint(256, 512)
287
+
288
+
289
+ class GostR3410_2001_ParamSetParameters(univ.Sequence):
290
+ pass
291
+
292
+ GostR3410_2001_ParamSetParameters.componentType = namedtype.NamedTypes(
293
+ namedtype.NamedType('a', univ.Integer()),
294
+ namedtype.NamedType('b', univ.Integer()),
295
+ namedtype.NamedType('p', univ.Integer()),
296
+ namedtype.NamedType('q', univ.Integer()),
297
+ namedtype.NamedType('x', univ.Integer()),
298
+ namedtype.NamedType('y', univ.Integer())
299
+ )
300
+
301
+
302
+ class GostR3410_2001_PublicKey(univ.OctetString):
303
+ pass
304
+
305
+ GostR3410_2001_PublicKey.subtypeSpec = constraint.ValueSizeConstraint(64, 64)
306
+
307
+
308
+ class GostR3410_2001_PublicKeyParameters(univ.Sequence):
309
+ pass
310
+
311
+ GostR3410_2001_PublicKeyParameters.componentType = namedtype.NamedTypes(
312
+ namedtype.NamedType('publicKeyParamSet', univ.ObjectIdentifier().subtype(
313
+ subtypeSpec=constraint.SingleValueConstraint(
314
+ id_GostR3410_2001_TestParamSet,
315
+ id_GostR3410_2001_CryptoPro_A_ParamSet,
316
+ id_GostR3410_2001_CryptoPro_B_ParamSet,
317
+ id_GostR3410_2001_CryptoPro_C_ParamSet,
318
+ id_GostR3410_2001_CryptoPro_XchA_ParamSet,
319
+ id_GostR3410_2001_CryptoPro_XchB_ParamSet
320
+ ))),
321
+ namedtype.NamedType('digestParamSet', univ.ObjectIdentifier().subtype(
322
+ subtypeSpec=constraint.SingleValueConstraint(
323
+ id_GostR3411_94_TestParamSet,
324
+ id_GostR3411_94_CryptoProParamSet
325
+ ))),
326
+ namedtype.DefaultedNamedType('encryptionParamSet',
327
+ Gost28147_89_ParamSet().subtype(value=id_Gost28147_89_CryptoPro_A_ParamSet
328
+ ))
329
+ )
330
+
331
+
332
+ class GostR3410_94_CertificateSignature(univ.BitString):
333
+ pass
334
+
335
+ GostR3410_94_CertificateSignature.subtypeSpec = constraint.ValueSizeConstraint(256, 512)
336
+
337
+
338
+ class GostR3410_94_ParamSetParameters_t(univ.Integer):
339
+ pass
340
+
341
+ GostR3410_94_ParamSetParameters_t.subtypeSpec = constraint.SingleValueConstraint(512, 1024)
342
+
343
+
344
+ class GostR3410_94_ParamSetParameters(univ.Sequence):
345
+ pass
346
+
347
+ GostR3410_94_ParamSetParameters.componentType = namedtype.NamedTypes(
348
+ namedtype.NamedType('t', GostR3410_94_ParamSetParameters_t()),
349
+ namedtype.NamedType('p', univ.Integer()),
350
+ namedtype.NamedType('q', univ.Integer()),
351
+ namedtype.NamedType('a', univ.Integer()),
352
+ namedtype.OptionalNamedType('validationAlgorithm', AlgorithmIdentifier())
353
+ )
354
+
355
+
356
+ class GostR3410_94_PublicKey(univ.OctetString):
357
+ pass
358
+
359
+ GostR3410_94_PublicKey.subtypeSpec = constraint.ConstraintsUnion(
360
+ constraint.ValueSizeConstraint(64, 64),
361
+ constraint.ValueSizeConstraint(128, 128)
362
+ )
363
+
364
+
365
+ class GostR3410_94_PublicKeyParameters(univ.Sequence):
366
+ pass
367
+
368
+ GostR3410_94_PublicKeyParameters.componentType = namedtype.NamedTypes(
369
+ namedtype.NamedType('publicKeyParamSet', univ.ObjectIdentifier().subtype(
370
+ subtypeSpec=constraint.SingleValueConstraint(
371
+ id_GostR3410_94_TestParamSet,
372
+ id_GostR3410_94_CryptoPro_A_ParamSet,
373
+ id_GostR3410_94_CryptoPro_B_ParamSet,
374
+ id_GostR3410_94_CryptoPro_C_ParamSet,
375
+ id_GostR3410_94_CryptoPro_D_ParamSet,
376
+ id_GostR3410_94_CryptoPro_XchA_ParamSet,
377
+ id_GostR3410_94_CryptoPro_XchB_ParamSet,
378
+ id_GostR3410_94_CryptoPro_XchC_ParamSet
379
+ ))),
380
+ namedtype.NamedType('digestParamSet', univ.ObjectIdentifier().subtype(
381
+ subtypeSpec=constraint.SingleValueConstraint(
382
+ id_GostR3411_94_TestParamSet,
383
+ id_GostR3411_94_CryptoProParamSet
384
+ ))),
385
+ namedtype.DefaultedNamedType('encryptionParamSet',
386
+ Gost28147_89_ParamSet().subtype(value=id_Gost28147_89_CryptoPro_A_ParamSet
387
+ ))
388
+ )
389
+
390
+
391
+ class GostR3410_94_ValidationBisParameters_c(univ.Integer):
392
+ pass
393
+
394
+ GostR3410_94_ValidationBisParameters_c.subtypeSpec = constraint.ValueRangeConstraint(0, 4294967295)
395
+
396
+
397
+ class GostR3410_94_ValidationBisParameters(univ.Sequence):
398
+ pass
399
+
400
+ GostR3410_94_ValidationBisParameters.componentType = namedtype.NamedTypes(
401
+ namedtype.NamedType('x0', GostR3410_94_ValidationBisParameters_c()),
402
+ namedtype.NamedType('c', GostR3410_94_ValidationBisParameters_c()),
403
+ namedtype.OptionalNamedType('d', univ.Integer())
404
+ )
405
+
406
+
407
+ class GostR3410_94_ValidationParameters_c(univ.Integer):
408
+ pass
409
+
410
+ GostR3410_94_ValidationParameters_c.subtypeSpec = constraint.ValueRangeConstraint(0, 65535)
411
+
412
+
413
+ class GostR3410_94_ValidationParameters(univ.Sequence):
414
+ pass
415
+
416
+ GostR3410_94_ValidationParameters.componentType = namedtype.NamedTypes(
417
+ namedtype.NamedType('x0', GostR3410_94_ValidationParameters_c()),
418
+ namedtype.NamedType('c', GostR3410_94_ValidationParameters_c()),
419
+ namedtype.OptionalNamedType('d', univ.Integer())
420
+ )
421
+
422
+
423
+ class GostR3411_94_Digest(univ.OctetString):
424
+ pass
425
+
426
+ GostR3411_94_Digest.subtypeSpec = constraint.ValueSizeConstraint(32, 32)
427
+
428
+
429
+ class GostR3411_94_DigestParameters(univ.ObjectIdentifier):
430
+ pass
431
+
432
+ GostR3411_94_DigestParameters.subtypeSpec = constraint.ConstraintsUnion(
433
+ constraint.SingleValueConstraint(id_GostR3411_94_TestParamSet),
434
+ constraint.SingleValueConstraint(id_GostR3411_94_CryptoProParamSet),
435
+ )
436
+
437
+
438
+ class GostR3411_94_ParamSetParameters(univ.Sequence):
439
+ pass
440
+
441
+ GostR3411_94_ParamSetParameters.componentType = namedtype.NamedTypes(
442
+ namedtype.NamedType('hUZ', Gost28147_89_UZ()),
443
+ namedtype.NamedType('h0', GostR3411_94_Digest())
444
+ )
445
+
446
+
447
+ # Update the Algorithm Identifier map in rfc5280.py
448
+
449
+ _algorithmIdentifierMapUpdate = {
450
+ id_Gost28147_89: Gost28147_89_Parameters(),
451
+ id_Gost28147_89_TestParamSet: Gost28147_89_ParamSetParameters(),
452
+ id_Gost28147_89_CryptoPro_A_ParamSet: Gost28147_89_ParamSetParameters(),
453
+ id_Gost28147_89_CryptoPro_B_ParamSet: Gost28147_89_ParamSetParameters(),
454
+ id_Gost28147_89_CryptoPro_C_ParamSet: Gost28147_89_ParamSetParameters(),
455
+ id_Gost28147_89_CryptoPro_D_ParamSet: Gost28147_89_ParamSetParameters(),
456
+ id_Gost28147_89_CryptoPro_KeyMeshing: univ.Null(""),
457
+ id_Gost28147_89_None_KeyMeshing: univ.Null(""),
458
+ id_GostR3410_94: GostR3410_94_PublicKeyParameters(),
459
+ id_GostR3410_94_TestParamSet: GostR3410_94_ParamSetParameters(),
460
+ id_GostR3410_94_CryptoPro_A_ParamSet: GostR3410_94_ParamSetParameters(),
461
+ id_GostR3410_94_CryptoPro_B_ParamSet: GostR3410_94_ParamSetParameters(),
462
+ id_GostR3410_94_CryptoPro_C_ParamSet: GostR3410_94_ParamSetParameters(),
463
+ id_GostR3410_94_CryptoPro_D_ParamSet: GostR3410_94_ParamSetParameters(),
464
+ id_GostR3410_94_CryptoPro_XchA_ParamSet: GostR3410_94_ParamSetParameters(),
465
+ id_GostR3410_94_CryptoPro_XchB_ParamSet: GostR3410_94_ParamSetParameters(),
466
+ id_GostR3410_94_CryptoPro_XchC_ParamSet: GostR3410_94_ParamSetParameters(),
467
+ id_GostR3410_94_a: GostR3410_94_ValidationParameters(),
468
+ id_GostR3410_94_aBis: GostR3410_94_ValidationBisParameters(),
469
+ id_GostR3410_94_b: GostR3410_94_ValidationParameters(),
470
+ id_GostR3410_94_bBis: GostR3410_94_ValidationBisParameters(),
471
+ id_GostR3410_2001: univ.Null(""),
472
+ id_GostR3411_94: univ.Null(""),
473
+ id_GostR3411_94_TestParamSet: GostR3411_94_ParamSetParameters(),
474
+ id_GostR3411_94_CryptoProParamSet: GostR3411_94_ParamSetParameters(),
475
+ }
476
+
477
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4387.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Certificate Store Access via HTTP
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4387.txt
13
+ #
14
+
15
+
16
+ from pyasn1.type import univ
17
+
18
+
19
+ id_ad = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, ))
20
+
21
+ id_ad_http_certs = id_ad + (6, )
22
+
23
+ id_ad_http_crls = id_ad + (7,)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4490.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Using the GOST 28147-89, GOST R 34.11-94, GOST R 34.10-94, and
10
+ # GOST R 34.10-2001 Algorithms with the CMS
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4490.txt
14
+ #
15
+
16
+
17
+ from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
18
+
19
+ from pyasn1_modules import rfc4357
20
+ from pyasn1_modules import rfc5280
21
+
22
+
23
+ # Imports from RFC 4357
24
+
25
+ id_CryptoPro_algorithms = rfc4357.id_CryptoPro_algorithms
26
+
27
+ id_GostR3410_94 = rfc4357.id_GostR3410_94
28
+
29
+ id_GostR3410_2001 = rfc4357.id_GostR3410_2001
30
+
31
+ Gost28147_89_ParamSet = rfc4357.Gost28147_89_ParamSet
32
+
33
+ Gost28147_89_EncryptedKey = rfc4357.Gost28147_89_EncryptedKey
34
+
35
+ GostR3410_94_PublicKeyParameters = rfc4357.GostR3410_94_PublicKeyParameters
36
+
37
+ GostR3410_2001_PublicKeyParameters = rfc4357.GostR3410_2001_PublicKeyParameters
38
+
39
+
40
+ # Imports from RFC 5280
41
+
42
+ SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
43
+
44
+
45
+ # CMS/PKCS#7 key agreement algorithms & parameters
46
+
47
+ class Gost28147_89_KeyWrapParameters(univ.Sequence):
48
+ componentType = namedtype.NamedTypes(
49
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet()),
50
+ namedtype.OptionalNamedType('ukm', univ.OctetString().subtype(
51
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8)))
52
+ )
53
+
54
+
55
+ id_Gost28147_89_CryptoPro_KeyWrap = id_CryptoPro_algorithms + (13, 1, )
56
+
57
+
58
+ id_Gost28147_89_None_KeyWrap = id_CryptoPro_algorithms + (13, 0, )
59
+
60
+
61
+ id_GostR3410_2001_CryptoPro_ESDH = id_CryptoPro_algorithms + (96, )
62
+
63
+
64
+ id_GostR3410_94_CryptoPro_ESDH = id_CryptoPro_algorithms + (97, )
65
+
66
+
67
+ # CMS/PKCS#7 key transport algorithms & parameters
68
+
69
+ id_GostR3410_2001_KeyTransportSMIMECapability = id_GostR3410_2001
70
+
71
+
72
+ id_GostR3410_94_KeyTransportSMIMECapability = id_GostR3410_94
73
+
74
+
75
+ class GostR3410_TransportParameters(univ.Sequence):
76
+ componentType = namedtype.NamedTypes(
77
+ namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet()),
78
+ namedtype.OptionalNamedType('ephemeralPublicKey',
79
+ SubjectPublicKeyInfo().subtype(implicitTag=tag.Tag(
80
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
81
+ namedtype.NamedType('ukm', univ.OctetString().subtype(
82
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8)))
83
+ )
84
+
85
+ class GostR3410_KeyTransport(univ.Sequence):
86
+ componentType = namedtype.NamedTypes(
87
+ namedtype.NamedType('sessionEncryptedKey', Gost28147_89_EncryptedKey()),
88
+ namedtype.OptionalNamedType('transportParameters',
89
+ GostR3410_TransportParameters().subtype(implicitTag=tag.Tag(
90
+ tag.tagClassContext, tag.tagFormatConstructed, 0)))
91
+ )
92
+
93
+
94
+ # GOST R 34.10-94 signature algorithm & parameters
95
+
96
+ class GostR3410_94_Signature(univ.OctetString):
97
+ subtypeSpec = constraint.ValueSizeConstraint(64, 64)
98
+
99
+
100
+ # GOST R 34.10-2001 signature algorithms and parameters
101
+
102
+ class GostR3410_2001_Signature(univ.OctetString):
103
+ subtypeSpec = constraint.ValueSizeConstraint(64, 64)
104
+
105
+
106
+ # Update the Algorithm Identifier map in rfc5280.py
107
+
108
+ _algorithmIdentifierMapUpdate = {
109
+ id_Gost28147_89_CryptoPro_KeyWrap: Gost28147_89_KeyWrapParameters(),
110
+ id_Gost28147_89_None_KeyWrap: Gost28147_89_KeyWrapParameters(),
111
+ }
112
+
113
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4491.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Using the GOST R 34.10-94, GOST R 34.10-2001, and GOST R 34.11-94
10
+ # Algorithms with Certificates and CRLs
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4491.txt
14
+ #
15
+
16
+ from pyasn1_modules import rfc4357
17
+
18
+
19
+ # Signature Algorithm GOST R 34.10-94
20
+
21
+ id_GostR3411_94_with_GostR3410_94 = rfc4357.id_GostR3411_94_with_GostR3410_94
22
+
23
+
24
+ # Signature Algorithm GOST R 34.10-2001
25
+
26
+ id_GostR3411_94_with_GostR3410_2001 = rfc4357.id_GostR3411_94_with_GostR3410_2001
27
+
28
+
29
+ # GOST R 34.10-94 Keys
30
+
31
+ id_GostR3410_94 = rfc4357.id_GostR3410_94
32
+
33
+ GostR3410_2001_PublicKey = rfc4357.GostR3410_2001_PublicKey
34
+
35
+ GostR3410_2001_PublicKeyParameters = rfc4357.GostR3410_2001_PublicKeyParameters
36
+
37
+
38
+ # GOST R 34.10-2001 Keys
39
+
40
+ id_GostR3410_2001 = rfc4357.id_GostR3410_2001
41
+
42
+ GostR3410_94_PublicKey = rfc4357.GostR3410_94_PublicKey
43
+
44
+ GostR3410_94_PublicKeyParameters = rfc4357.GostR3410_94_PublicKeyParameters
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4683.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # Subject Identification Method (SIM)
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4683.txt
13
+ # https://www.rfc-editor.org/errata/eid1047
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_modules import rfc5280
21
+
22
+
23
+ # Used to compute the PEPSI value
24
+
25
+ class HashContent(univ.Sequence):
26
+ componentType = namedtype.NamedTypes(
27
+ namedtype.NamedType('userPassword', char.UTF8String()),
28
+ namedtype.NamedType('authorityRandom', univ.OctetString()),
29
+ namedtype.NamedType('identifierType', univ.ObjectIdentifier()),
30
+ namedtype.NamedType('identifier', char.UTF8String())
31
+ )
32
+
33
+
34
+ # Used to encode the PEPSI value as the SIM Other Name
35
+
36
+ id_pkix = rfc5280.id_pkix
37
+
38
+ id_on = id_pkix + (8,)
39
+
40
+ id_on_SIM = id_on + (6,)
41
+
42
+
43
+ class SIM(univ.Sequence):
44
+ componentType = namedtype.NamedTypes(
45
+ namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),
46
+ namedtype.NamedType('authorityRandom', univ.OctetString()),
47
+ namedtype.NamedType('pEPSI', univ.OctetString())
48
+ )
49
+
50
+
51
+ # Used to encrypt the PEPSI value during certificate request
52
+
53
+ id_pkip = id_pkix + (5,)
54
+
55
+ id_regEPEPSI = id_pkip + (3,)
56
+
57
+
58
+ class EncryptedPEPSI(univ.Sequence):
59
+ componentType = namedtype.NamedTypes(
60
+ namedtype.NamedType('identifierType', univ.ObjectIdentifier()),
61
+ namedtype.NamedType('identifier', char.UTF8String()),
62
+ namedtype.NamedType('sIM', SIM())
63
+ )
64
+
65
+
66
+ # Update the map of Other Name OIDs to Other Names in rfc5280.py
67
+
68
+ _anotherNameMapUpdate = {
69
+ id_on_SIM: SIM(),
70
+ }
71
+
72
+ rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5083.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to of pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley without assistance from the asn1ate tool.
4
+ # Modified by Russ Housley to add a map for use with opentypes and
5
+ # simplify the code for the object identifier assignment.
6
+ #
7
+ # Copyright (c) 2018, 2019 Vigil Security, LLC
8
+ # License: http://snmplabs.com/pyasn1/license.html
9
+ #
10
+ # Authenticated-Enveloped-Data for the Cryptographic Message Syntax (CMS)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc5083.txt
14
+
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import tag
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5652
20
+
21
+ MAX = float('inf')
22
+
23
+
24
+ # CMS Authenticated-Enveloped-Data Content Type
25
+
26
+ id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23')
27
+
28
+ class AuthEnvelopedData(univ.Sequence):
29
+ pass
30
+
31
+ AuthEnvelopedData.componentType = namedtype.NamedTypes(
32
+ namedtype.NamedType('version', rfc5652.CMSVersion()),
33
+ namedtype.OptionalNamedType('originatorInfo', rfc5652.OriginatorInfo().subtype(
34
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
35
+ namedtype.NamedType('recipientInfos', rfc5652.RecipientInfos()),
36
+ namedtype.NamedType('authEncryptedContentInfo', rfc5652.EncryptedContentInfo()),
37
+ namedtype.OptionalNamedType('authAttrs', rfc5652.AuthAttributes().subtype(
38
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
39
+ namedtype.NamedType('mac', rfc5652.MessageAuthenticationCode()),
40
+ namedtype.OptionalNamedType('unauthAttrs', rfc5652.UnauthAttributes().subtype(
41
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
42
+ )
43
+
44
+
45
+ # Map of Content Type OIDs to Content Types is added to the
46
+ # ones that are in rfc5652.py
47
+
48
+ _cmsContentTypesMapUpdate = {
49
+ id_ct_authEnvelopedData: AuthEnvelopedData(),
50
+ }
51
+
52
+ rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5084.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from the asn1ate tool, with manual
4
+ # changes to AES_CCM_ICVlen.subtypeSpec and added comments
5
+ #
6
+ # Copyright (c) 2018-2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # AES-CCM and AES-GCM Algorithms fo use with the Authenticated-Enveloped-Data
10
+ # protecting content type for the Cryptographic Message Syntax (CMS)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc5084.txt
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_modules import rfc5280
20
+
21
+
22
+ def _OID(*components):
23
+ output = []
24
+ for x in tuple(components):
25
+ if isinstance(x, univ.ObjectIdentifier):
26
+ output.extend(list(x))
27
+ else:
28
+ output.append(int(x))
29
+
30
+ return univ.ObjectIdentifier(output)
31
+
32
+
33
+ class AES_CCM_ICVlen(univ.Integer):
34
+ pass
35
+
36
+
37
+ class AES_GCM_ICVlen(univ.Integer):
38
+ pass
39
+
40
+
41
+ AES_CCM_ICVlen.subtypeSpec = constraint.SingleValueConstraint(4, 6, 8, 10, 12, 14, 16)
42
+
43
+ AES_GCM_ICVlen.subtypeSpec = constraint.ValueRangeConstraint(12, 16)
44
+
45
+
46
+ class CCMParameters(univ.Sequence):
47
+ pass
48
+
49
+
50
+ CCMParameters.componentType = namedtype.NamedTypes(
51
+ namedtype.NamedType('aes-nonce', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(7, 13))),
52
+ # The aes-nonce parameter contains 15-L octets, where L is the size of the length field. L=8 is RECOMMENDED.
53
+ # Within the scope of any content-authenticated-encryption key, the nonce value MUST be unique.
54
+ namedtype.DefaultedNamedType('aes-ICVlen', AES_CCM_ICVlen().subtype(value=12))
55
+ )
56
+
57
+
58
+ class GCMParameters(univ.Sequence):
59
+ pass
60
+
61
+
62
+ GCMParameters.componentType = namedtype.NamedTypes(
63
+ namedtype.NamedType('aes-nonce', univ.OctetString()),
64
+ # The aes-nonce may have any number of bits between 8 and 2^64, but it MUST be a multiple of 8 bits.
65
+ # Within the scope of any content-authenticated-encryption key, the nonce value MUST be unique.
66
+ # A nonce value of 12 octets can be processed more efficiently, so that length is RECOMMENDED.
67
+ namedtype.DefaultedNamedType('aes-ICVlen', AES_GCM_ICVlen().subtype(value=12))
68
+ )
69
+
70
+ aes = _OID(2, 16, 840, 1, 101, 3, 4, 1)
71
+
72
+ id_aes128_CCM = _OID(aes, 7)
73
+
74
+ id_aes128_GCM = _OID(aes, 6)
75
+
76
+ id_aes192_CCM = _OID(aes, 27)
77
+
78
+ id_aes192_GCM = _OID(aes, 26)
79
+
80
+ id_aes256_CCM = _OID(aes, 47)
81
+
82
+ id_aes256_GCM = _OID(aes, 46)
83
+
84
+
85
+ # Map of Algorithm Identifier OIDs to Parameters is added to the
86
+ # ones in rfc5280.py
87
+
88
+ _algorithmIdentifierMapUpdate = {
89
+ id_aes128_CCM: CCMParameters(),
90
+ id_aes128_GCM: GCMParameters(),
91
+ id_aes192_CCM: CCMParameters(),
92
+ id_aes192_GCM: GCMParameters(),
93
+ id_aes256_CCM: CCMParameters(),
94
+ id_aes256_GCM: GCMParameters(),
95
+ }
96
+
97
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5275.py ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is part of pyasn1-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ #
6
+ # Copyright (c) 2019, Vigil Security, LLC
7
+ # License: http://snmplabs.com/pyasn1/license.html
8
+ #
9
+ # An Internet Attribute Certificate Profile for Authorization
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc5275.txt
13
+ #
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import namedtype
17
+ from pyasn1.type import namedval
18
+ from pyasn1.type import opentype
19
+ from pyasn1.type import tag
20
+ from pyasn1.type import univ
21
+ from pyasn1.type import useful
22
+
23
+ from pyasn1_modules import rfc3565
24
+ from pyasn1_modules import rfc5280
25
+ from pyasn1_modules import rfc5652
26
+ from pyasn1_modules import rfc5751
27
+ from pyasn1_modules import rfc5755
28
+
29
+ MAX = float('inf')
30
+
31
+
32
+ # Initialize the map for GLAQueryRequests and GLAQueryResponses
33
+
34
+ glaQueryRRMap = { }
35
+
36
+
37
+ # Imports from RFC 3565
38
+
39
+ id_aes128_wrap = rfc3565.id_aes128_wrap
40
+
41
+
42
+ # Imports from RFC 5280
43
+
44
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
45
+
46
+ Certificate = rfc5280.Certificate
47
+
48
+ GeneralName = rfc5280.GeneralName
49
+
50
+
51
+ # Imports from RFC 5652
52
+
53
+ CertificateSet = rfc5652.CertificateSet
54
+
55
+ KEKIdentifier = rfc5652.KEKIdentifier
56
+
57
+ RecipientInfos = rfc5652.RecipientInfos
58
+
59
+
60
+ # Imports from RFC 5751
61
+
62
+ SMIMECapability = rfc5751.SMIMECapability
63
+
64
+
65
+ # Imports from RFC 5755
66
+
67
+ AttributeCertificate = rfc5755.AttributeCertificate
68
+
69
+
70
+ # The GL symmetric key distribution object identifier arc
71
+
72
+ id_skd = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 8,))
73
+
74
+
75
+ # The GL Use KEK control attribute
76
+
77
+ id_skd_glUseKEK = id_skd + (1,)
78
+
79
+
80
+ class Certificates(univ.Sequence):
81
+ componentType = namedtype.NamedTypes(
82
+ namedtype.OptionalNamedType('pKC',
83
+ Certificate().subtype(implicitTag=tag.Tag(
84
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
85
+ namedtype.OptionalNamedType('aC',
86
+ univ.SequenceOf(componentType=AttributeCertificate()).subtype(
87
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
88
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
89
+ namedtype.OptionalNamedType('certPath',
90
+ CertificateSet().subtype(implicitTag=tag.Tag(
91
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
92
+ )
93
+
94
+
95
+ class GLInfo(univ.Sequence):
96
+ componentType = namedtype.NamedTypes(
97
+ namedtype.NamedType('glName', GeneralName()),
98
+ namedtype.NamedType('glAddress', GeneralName())
99
+ )
100
+
101
+
102
+ class GLOwnerInfo(univ.Sequence):
103
+ componentType = namedtype.NamedTypes(
104
+ namedtype.NamedType('glOwnerName', GeneralName()),
105
+ namedtype.NamedType('glOwnerAddress', GeneralName()),
106
+ namedtype.OptionalNamedType('certificates', Certificates())
107
+ )
108
+
109
+
110
+ class GLAdministration(univ.Integer):
111
+ namedValues = namedval.NamedValues(
112
+ ('unmanaged', 0),
113
+ ('managed', 1),
114
+ ('closed', 2)
115
+ )
116
+
117
+
118
+ requested_algorithm = SMIMECapability().subtype(
119
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))
120
+ requested_algorithm['capabilityID'] = id_aes128_wrap
121
+
122
+
123
+ class GLKeyAttributes(univ.Sequence):
124
+ componentType = namedtype.NamedTypes(
125
+ namedtype.DefaultedNamedType('rekeyControlledByGLO',
126
+ univ.Boolean().subtype(value=0,
127
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
128
+ namedtype.DefaultedNamedType('recipientsNotMutuallyAware',
129
+ univ.Boolean().subtype(value=1,
130
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
131
+ namedtype.DefaultedNamedType('duration',
132
+ univ.Integer().subtype(value=0,
133
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
134
+ namedtype.DefaultedNamedType('generationCounter',
135
+ univ.Integer().subtype(value=2,
136
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
137
+ namedtype.DefaultedNamedType('requestedAlgorithm', requested_algorithm)
138
+ )
139
+
140
+
141
+ class GLUseKEK(univ.Sequence):
142
+ componentType = namedtype.NamedTypes(
143
+ namedtype.NamedType('glInfo', GLInfo()),
144
+ namedtype.NamedType('glOwnerInfo',
145
+ univ.SequenceOf(componentType=GLOwnerInfo()).subtype(
146
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
147
+ namedtype.DefaultedNamedType('glAdministration',
148
+ GLAdministration().subtype(value=1)),
149
+ namedtype.OptionalNamedType('glKeyAttributes', GLKeyAttributes())
150
+ )
151
+
152
+
153
+ # The Delete GL control attribute
154
+
155
+ id_skd_glDelete = id_skd + (2,)
156
+
157
+
158
+ class DeleteGL(GeneralName):
159
+ pass
160
+
161
+
162
+ # The Add GL Member control attribute
163
+
164
+ id_skd_glAddMember = id_skd + (3,)
165
+
166
+
167
+ class GLMember(univ.Sequence):
168
+ componentType = namedtype.NamedTypes(
169
+ namedtype.NamedType('glMemberName', GeneralName()),
170
+ namedtype.OptionalNamedType('glMemberAddress', GeneralName()),
171
+ namedtype.OptionalNamedType('certificates', Certificates())
172
+ )
173
+
174
+
175
+ class GLAddMember(univ.Sequence):
176
+ componentType = namedtype.NamedTypes(
177
+ namedtype.NamedType('glName', GeneralName()),
178
+ namedtype.NamedType('glMember', GLMember())
179
+ )
180
+
181
+
182
+ # The Delete GL Member control attribute
183
+
184
+ id_skd_glDeleteMember = id_skd + (4,)
185
+
186
+
187
+ class GLDeleteMember(univ.Sequence):
188
+ componentType = namedtype.NamedTypes(
189
+ namedtype.NamedType('glName', GeneralName()),
190
+ namedtype.NamedType('glMemberToDelete', GeneralName())
191
+ )
192
+
193
+
194
+ # The GL Rekey control attribute
195
+
196
+ id_skd_glRekey = id_skd + (5,)
197
+
198
+
199
+ class GLNewKeyAttributes(univ.Sequence):
200
+ componentType = namedtype.NamedTypes(
201
+ namedtype.OptionalNamedType('rekeyControlledByGLO',
202
+ univ.Boolean().subtype(implicitTag=tag.Tag(
203
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
204
+ namedtype.OptionalNamedType('recipientsNotMutuallyAware',
205
+ univ.Boolean().subtype(implicitTag=tag.Tag(
206
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
207
+ namedtype.OptionalNamedType('duration',
208
+ univ.Integer().subtype(implicitTag=tag.Tag(
209
+ tag.tagClassContext, tag.tagFormatSimple, 2))),
210
+ namedtype.OptionalNamedType('generationCounter',
211
+ univ.Integer().subtype(implicitTag=tag.Tag(
212
+ tag.tagClassContext, tag.tagFormatSimple, 3))),
213
+ namedtype.OptionalNamedType('requestedAlgorithm',
214
+ AlgorithmIdentifier().subtype(implicitTag=tag.Tag(
215
+ tag.tagClassContext, tag.tagFormatSimple, 4)))
216
+ )
217
+
218
+
219
+ class GLRekey(univ.Sequence):
220
+ componentType = namedtype.NamedTypes(
221
+ namedtype.NamedType('glName', GeneralName()),
222
+ namedtype.OptionalNamedType('glAdministration', GLAdministration()),
223
+ namedtype.OptionalNamedType('glNewKeyAttributes', GLNewKeyAttributes()),
224
+ namedtype.OptionalNamedType('glRekeyAllGLKeys', univ.Boolean())
225
+ )
226
+
227
+
228
+ # The Add and Delete GL Owner control attributes
229
+
230
+ id_skd_glAddOwner = id_skd + (6,)
231
+
232
+ id_skd_glRemoveOwner = id_skd + (7,)
233
+
234
+
235
+ class GLOwnerAdministration(univ.Sequence):
236
+ componentType = namedtype.NamedTypes(
237
+ namedtype.NamedType('glName', GeneralName()),
238
+ namedtype.NamedType('glOwnerInfo', GLOwnerInfo())
239
+ )
240
+
241
+
242
+ # The GL Key Compromise control attribute
243
+
244
+ id_skd_glKeyCompromise = id_skd + (8,)
245
+
246
+
247
+ class GLKCompromise(GeneralName):
248
+ pass
249
+
250
+
251
+ # The GL Key Refresh control attribute
252
+
253
+ id_skd_glkRefresh = id_skd + (9,)
254
+
255
+
256
+ class Date(univ.Sequence):
257
+ componentType = namedtype.NamedTypes(
258
+ namedtype.NamedType('start', useful.GeneralizedTime()),
259
+ namedtype.OptionalNamedType('end', useful.GeneralizedTime())
260
+ )
261
+
262
+
263
+ class GLKRefresh(univ.Sequence):
264
+ componentType = namedtype.NamedTypes(
265
+ namedtype.NamedType('glName', GeneralName()),
266
+ namedtype.NamedType('dates',
267
+ univ.SequenceOf(componentType=Date()).subtype(
268
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
269
+ )
270
+
271
+
272
+ # The GLA Query Request control attribute
273
+
274
+ id_skd_glaQueryRequest = id_skd + (11,)
275
+
276
+
277
+ class GLAQueryRequest(univ.Sequence):
278
+ componentType = namedtype.NamedTypes(
279
+ namedtype.NamedType('glaRequestType', univ.ObjectIdentifier()),
280
+ namedtype.NamedType('glaRequestValue', univ.Any(),
281
+ openType=opentype.OpenType('glaRequestType', glaQueryRRMap))
282
+ )
283
+
284
+
285
+ # The GLA Query Response control attribute
286
+
287
+ id_skd_glaQueryResponse = id_skd + (12,)
288
+
289
+
290
+ class GLAQueryResponse(univ.Sequence):
291
+ componentType = namedtype.NamedTypes(
292
+ namedtype.NamedType('glaResponseType', univ.ObjectIdentifier()),
293
+ namedtype.NamedType('glaResponseValue', univ.Any(),
294
+ openType=opentype.OpenType('glaResponseType', glaQueryRRMap))
295
+ )
296
+
297
+
298
+ # The GLA Request/Response (glaRR) arc for glaRequestType/glaResponseType
299
+
300
+ id_cmc_glaRR = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 7, 99,))
301
+
302
+
303
+ # The Algorithm Request
304
+
305
+ id_cmc_gla_skdAlgRequest = id_cmc_glaRR + (1,)
306
+
307
+
308
+ class SKDAlgRequest(univ.Null):
309
+ pass
310
+
311
+
312
+ # The Algorithm Response
313
+
314
+ id_cmc_gla_skdAlgResponse = id_cmc_glaRR + (2,)
315
+
316
+ SMIMECapabilities = rfc5751.SMIMECapabilities
317
+
318
+
319
+ # The control attribute to request an updated certificate to the GLA and
320
+ # the control attribute to return an updated certificate to the GLA
321
+
322
+ id_skd_glProvideCert = id_skd + (13,)
323
+
324
+ id_skd_glManageCert = id_skd + (14,)
325
+
326
+
327
+ class GLManageCert(univ.Sequence):
328
+ componentType = namedtype.NamedTypes(
329
+ namedtype.NamedType('glName', GeneralName()),
330
+ namedtype.NamedType('glMember', GLMember())
331
+ )
332
+
333
+
334
+ # The control attribute to distribute the GL shared KEK
335
+
336
+ id_skd_glKey = id_skd + (15,)
337
+
338
+
339
+ class GLKey(univ.Sequence):
340
+ componentType = namedtype.NamedTypes(
341
+ namedtype.NamedType('glName', GeneralName()),
342
+ namedtype.NamedType('glIdentifier', KEKIdentifier()),
343
+ namedtype.NamedType('glkWrapped', RecipientInfos()),
344
+ namedtype.NamedType('glkAlgorithm', AlgorithmIdentifier()),
345
+ namedtype.NamedType('glkNotBefore', useful.GeneralizedTime()),
346
+ namedtype.NamedType('glkNotAfter', useful.GeneralizedTime())
347
+ )
348
+
349
+
350
+ # The CMC error types
351
+
352
+ id_cet_skdFailInfo = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 15, 1,))
353
+
354
+
355
+ class SKDFailInfo(univ.Integer):
356
+ namedValues = namedval.NamedValues(
357
+ ('unspecified', 0),
358
+ ('closedGL', 1),
359
+ ('unsupportedDuration', 2),
360
+ ('noGLACertificate', 3),
361
+ ('invalidCert', 4),
362
+ ('unsupportedAlgorithm', 5),
363
+ ('noGLONameMatch', 6),
364
+ ('invalidGLName', 7),
365
+ ('nameAlreadyInUse', 8),
366
+ ('noSpam', 9),
367
+ ('alreadyAMember', 11),
368
+ ('notAMember', 12),
369
+ ('alreadyAnOwner', 13),
370
+ ('notAnOwner', 14)
371
+ )
372
+
373
+
374
+ # Update the map for GLAQueryRequests and GLAQueryResponses
375
+
376
+ _glaQueryRRMapUpdate = {
377
+ id_cmc_gla_skdAlgRequest: univ.Null(""),
378
+ id_cmc_gla_skdAlgResponse: SMIMECapabilities(),
379
+ }
380
+
381
+ glaQueryRRMap.update(_glaQueryRRMapUpdate)
382
+
383
+
384
+ # Update the map for CMC control attributes; since CMS Attributes and
385
+ # CMC Controls both use 'attrType', one map is used for both
386
+
387
+ _cmcControlAttributesMapUpdate = {
388
+ id_skd_glUseKEK: GLUseKEK(),
389
+ id_skd_glDelete: DeleteGL(),
390
+ id_skd_glAddMember: GLAddMember(),
391
+ id_skd_glDeleteMember: GLDeleteMember(),
392
+ id_skd_glRekey: GLRekey(),
393
+ id_skd_glAddOwner: GLOwnerAdministration(),
394
+ id_skd_glRemoveOwner: GLOwnerAdministration(),
395
+ id_skd_glKeyCompromise: GLKCompromise(),
396
+ id_skd_glkRefresh: GLKRefresh(),
397
+ id_skd_glaQueryRequest: GLAQueryRequest(),
398
+ id_skd_glaQueryResponse: GLAQueryResponse(),
399
+ id_skd_glProvideCert: GLManageCert(),
400
+ id_skd_glManageCert: GLManageCert(),
401
+ id_skd_glKey: GLKey(),
402
+ }
403
+
404
+ rfc5652.cmsAttributesMap.update(_cmcControlAttributesMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5280.py ADDED
@@ -0,0 +1,1658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding: utf-8
2
+ #
3
+ # This file is part of pyasn1-modules software.
4
+ #
5
+ # Created by Stanisław Pitucha with asn1ate tool.
6
+ # Updated by Russ Housley for ORAddress Extension Attribute opentype support.
7
+ # Updated by Russ Housley for AlgorithmIdentifier opentype support.
8
+ #
9
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
10
+ # License: http://snmplabs.com/pyasn1/license.html
11
+ #
12
+ # Internet X.509 Public Key Infrastructure Certificate and Certificate
13
+ # Revocation List (CRL) Profile
14
+ #
15
+ # ASN.1 source from:
16
+ # https://www.rfc-editor.org/rfc/rfc5280.txt
17
+ #
18
+ from pyasn1.type import char
19
+ from pyasn1.type import constraint
20
+ from pyasn1.type import namedtype
21
+ from pyasn1.type import namedval
22
+ from pyasn1.type import opentype
23
+ from pyasn1.type import tag
24
+ from pyasn1.type import univ
25
+ from pyasn1.type import useful
26
+
27
+ MAX = float('inf')
28
+
29
+
30
+ def _buildOid(*components):
31
+ output = []
32
+ for x in tuple(components):
33
+ if isinstance(x, univ.ObjectIdentifier):
34
+ output.extend(list(x))
35
+ else:
36
+ output.append(int(x))
37
+
38
+ return univ.ObjectIdentifier(output)
39
+
40
+
41
+ ub_e163_4_sub_address_length = univ.Integer(40)
42
+
43
+ ub_e163_4_number_length = univ.Integer(15)
44
+
45
+ unformatted_postal_address = univ.Integer(16)
46
+
47
+
48
+ class TerminalType(univ.Integer):
49
+ pass
50
+
51
+
52
+ TerminalType.namedValues = namedval.NamedValues(
53
+ ('telex', 3),
54
+ ('teletex', 4),
55
+ ('g3-facsimile', 5),
56
+ ('g4-facsimile', 6),
57
+ ('ia5-terminal', 7),
58
+ ('videotex', 8)
59
+ )
60
+
61
+
62
+ class Extension(univ.Sequence):
63
+ pass
64
+
65
+
66
+ Extension.componentType = namedtype.NamedTypes(
67
+ namedtype.NamedType('extnID', univ.ObjectIdentifier()),
68
+ namedtype.DefaultedNamedType('critical', univ.Boolean().subtype(value=0)),
69
+ namedtype.NamedType('extnValue', univ.OctetString())
70
+ )
71
+
72
+
73
+ class Extensions(univ.SequenceOf):
74
+ pass
75
+
76
+
77
+ Extensions.componentType = Extension()
78
+ Extensions.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
79
+
80
+ physical_delivery_personal_name = univ.Integer(13)
81
+
82
+ ub_unformatted_address_length = univ.Integer(180)
83
+
84
+ ub_pds_parameter_length = univ.Integer(30)
85
+
86
+ ub_pds_physical_address_lines = univ.Integer(6)
87
+
88
+
89
+ class UnformattedPostalAddress(univ.Set):
90
+ pass
91
+
92
+
93
+ UnformattedPostalAddress.componentType = namedtype.NamedTypes(
94
+ namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype(
95
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))),
96
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
97
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length)))
98
+ )
99
+
100
+ ub_organization_name = univ.Integer(64)
101
+
102
+
103
+ class X520OrganizationName(univ.Choice):
104
+ pass
105
+
106
+
107
+ X520OrganizationName.componentType = namedtype.NamedTypes(
108
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
109
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
110
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
111
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
112
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
113
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
114
+ namedtype.NamedType('utf8String',
115
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
116
+ namedtype.NamedType('bmpString',
117
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name)))
118
+ )
119
+
120
+ ub_x121_address_length = univ.Integer(16)
121
+
122
+ pds_name = univ.Integer(7)
123
+
124
+ id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7)
125
+
126
+ id_kp = _buildOid(id_pkix, 3)
127
+
128
+ ub_postal_code_length = univ.Integer(16)
129
+
130
+
131
+ class PostalCode(univ.Choice):
132
+ pass
133
+
134
+
135
+ PostalCode.componentType = namedtype.NamedTypes(
136
+ namedtype.NamedType('numeric-code', char.NumericString().subtype(
137
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))),
138
+ namedtype.NamedType('printable-code', char.PrintableString().subtype(
139
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length)))
140
+ )
141
+
142
+ ub_generation_qualifier_length = univ.Integer(3)
143
+
144
+ unique_postal_name = univ.Integer(20)
145
+
146
+
147
+ class DomainComponent(char.IA5String):
148
+ pass
149
+
150
+
151
+ ub_domain_defined_attribute_value_length = univ.Integer(128)
152
+
153
+ ub_match = univ.Integer(128)
154
+
155
+ id_at = _buildOid(2, 5, 4)
156
+
157
+
158
+ class AttributeType(univ.ObjectIdentifier):
159
+ pass
160
+
161
+
162
+ id_at_organizationalUnitName = _buildOid(id_at, 11)
163
+
164
+ terminal_type = univ.Integer(23)
165
+
166
+
167
+ class PDSParameter(univ.Set):
168
+ pass
169
+
170
+
171
+ PDSParameter.componentType = namedtype.NamedTypes(
172
+ namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype(
173
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))),
174
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
175
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))
176
+ )
177
+
178
+
179
+ class PhysicalDeliveryPersonalName(PDSParameter):
180
+ pass
181
+
182
+
183
+ ub_surname_length = univ.Integer(40)
184
+
185
+ id_ad = _buildOid(id_pkix, 48)
186
+
187
+ ub_domain_defined_attribute_type_length = univ.Integer(8)
188
+
189
+
190
+ class TeletexDomainDefinedAttribute(univ.Sequence):
191
+ pass
192
+
193
+
194
+ TeletexDomainDefinedAttribute.componentType = namedtype.NamedTypes(
195
+ namedtype.NamedType('type', char.TeletexString().subtype(
196
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
197
+ namedtype.NamedType('value', char.TeletexString().subtype(
198
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
199
+ )
200
+
201
+ ub_domain_defined_attributes = univ.Integer(4)
202
+
203
+
204
+ class TeletexDomainDefinedAttributes(univ.SequenceOf):
205
+ pass
206
+
207
+
208
+ TeletexDomainDefinedAttributes.componentType = TeletexDomainDefinedAttribute()
209
+ TeletexDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
210
+
211
+ extended_network_address = univ.Integer(22)
212
+
213
+ ub_locality_name = univ.Integer(128)
214
+
215
+
216
+ class X520LocalityName(univ.Choice):
217
+ pass
218
+
219
+
220
+ X520LocalityName.componentType = namedtype.NamedTypes(
221
+ namedtype.NamedType('teletexString',
222
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
223
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
224
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
225
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
226
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
227
+ namedtype.NamedType('utf8String',
228
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
229
+ namedtype.NamedType('bmpString',
230
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name)))
231
+ )
232
+
233
+ teletex_organization_name = univ.Integer(3)
234
+
235
+ ub_given_name_length = univ.Integer(16)
236
+
237
+ ub_initials_length = univ.Integer(5)
238
+
239
+
240
+ class PersonalName(univ.Set):
241
+ pass
242
+
243
+
244
+ PersonalName.componentType = namedtype.NamedTypes(
245
+ namedtype.NamedType('surname', char.PrintableString().subtype(
246
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
247
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
248
+ namedtype.OptionalNamedType('given-name', char.PrintableString().subtype(
249
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
250
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
251
+ namedtype.OptionalNamedType('initials', char.PrintableString().subtype(
252
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
253
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
254
+ namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype(
255
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
256
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
257
+ )
258
+
259
+ ub_organizational_unit_name_length = univ.Integer(32)
260
+
261
+
262
+ class OrganizationalUnitName(char.PrintableString):
263
+ pass
264
+
265
+
266
+ OrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
267
+
268
+ id_at_generationQualifier = _buildOid(id_at, 44)
269
+
270
+
271
+ class Version(univ.Integer):
272
+ pass
273
+
274
+
275
+ Version.namedValues = namedval.NamedValues(
276
+ ('v1', 0),
277
+ ('v2', 1),
278
+ ('v3', 2)
279
+ )
280
+
281
+
282
+ class CertificateSerialNumber(univ.Integer):
283
+ pass
284
+
285
+
286
+ algorithmIdentifierMap = {}
287
+
288
+
289
+ class AlgorithmIdentifier(univ.Sequence):
290
+ componentType = namedtype.NamedTypes(
291
+ namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
292
+ namedtype.OptionalNamedType('parameters', univ.Any(),
293
+ openType=opentype.OpenType('algorithm', algorithmIdentifierMap)
294
+ )
295
+ )
296
+
297
+
298
+ class Time(univ.Choice):
299
+ pass
300
+
301
+
302
+ Time.componentType = namedtype.NamedTypes(
303
+ namedtype.NamedType('utcTime', useful.UTCTime()),
304
+ namedtype.NamedType('generalTime', useful.GeneralizedTime())
305
+ )
306
+
307
+
308
+ class AttributeValue(univ.Any):
309
+ pass
310
+
311
+
312
+ certificateAttributesMap = {}
313
+
314
+
315
+ class AttributeTypeAndValue(univ.Sequence):
316
+ componentType = namedtype.NamedTypes(
317
+ namedtype.NamedType('type', AttributeType()),
318
+ namedtype.NamedType(
319
+ 'value', AttributeValue(),
320
+ openType=opentype.OpenType('type', certificateAttributesMap)
321
+ )
322
+ )
323
+
324
+
325
+ class RelativeDistinguishedName(univ.SetOf):
326
+ pass
327
+
328
+
329
+ RelativeDistinguishedName.componentType = AttributeTypeAndValue()
330
+ RelativeDistinguishedName.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
331
+
332
+
333
+ class RDNSequence(univ.SequenceOf):
334
+ pass
335
+
336
+
337
+ RDNSequence.componentType = RelativeDistinguishedName()
338
+
339
+
340
+ class Name(univ.Choice):
341
+ pass
342
+
343
+
344
+ Name.componentType = namedtype.NamedTypes(
345
+ namedtype.NamedType('rdnSequence', RDNSequence())
346
+ )
347
+
348
+
349
+ class TBSCertList(univ.Sequence):
350
+ pass
351
+
352
+
353
+ TBSCertList.componentType = namedtype.NamedTypes(
354
+ namedtype.OptionalNamedType('version', Version()),
355
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
356
+ namedtype.NamedType('issuer', Name()),
357
+ namedtype.NamedType('thisUpdate', Time()),
358
+ namedtype.OptionalNamedType('nextUpdate', Time()),
359
+ namedtype.OptionalNamedType(
360
+ 'revokedCertificates', univ.SequenceOf(
361
+ componentType=univ.Sequence(
362
+ componentType=namedtype.NamedTypes(
363
+ namedtype.NamedType('userCertificate', CertificateSerialNumber()),
364
+ namedtype.NamedType('revocationDate', Time()),
365
+ namedtype.OptionalNamedType('crlEntryExtensions', Extensions())
366
+ )
367
+ )
368
+ )
369
+ ),
370
+ namedtype.OptionalNamedType(
371
+ 'crlExtensions', Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
372
+ )
373
+
374
+
375
+ class CertificateList(univ.Sequence):
376
+ pass
377
+
378
+
379
+ CertificateList.componentType = namedtype.NamedTypes(
380
+ namedtype.NamedType('tbsCertList', TBSCertList()),
381
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
382
+ namedtype.NamedType('signature', univ.BitString())
383
+ )
384
+
385
+
386
+ class PhysicalDeliveryOfficeName(PDSParameter):
387
+ pass
388
+
389
+
390
+ ub_extension_attributes = univ.Integer(256)
391
+
392
+ certificateExtensionsMap = {
393
+ }
394
+
395
+ oraddressExtensionAttributeMap = {
396
+ }
397
+
398
+
399
+ class ExtensionAttribute(univ.Sequence):
400
+ componentType = namedtype.NamedTypes(
401
+ namedtype.NamedType(
402
+ 'extension-attribute-type',
403
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, ub_extension_attributes)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
404
+ namedtype.NamedType(
405
+ 'extension-attribute-value',
406
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)),
407
+ openType=opentype.OpenType('extension-attribute-type', oraddressExtensionAttributeMap))
408
+ )
409
+
410
+ id_qt = _buildOid(id_pkix, 2)
411
+
412
+ id_qt_cps = _buildOid(id_qt, 1)
413
+
414
+ id_at_stateOrProvinceName = _buildOid(id_at, 8)
415
+
416
+ id_at_title = _buildOid(id_at, 12)
417
+
418
+ id_at_serialNumber = _buildOid(id_at, 5)
419
+
420
+
421
+ class X520dnQualifier(char.PrintableString):
422
+ pass
423
+
424
+
425
+ class PosteRestanteAddress(PDSParameter):
426
+ pass
427
+
428
+
429
+ poste_restante_address = univ.Integer(19)
430
+
431
+
432
+ class UniqueIdentifier(univ.BitString):
433
+ pass
434
+
435
+
436
+ class Validity(univ.Sequence):
437
+ pass
438
+
439
+
440
+ Validity.componentType = namedtype.NamedTypes(
441
+ namedtype.NamedType('notBefore', Time()),
442
+ namedtype.NamedType('notAfter', Time())
443
+ )
444
+
445
+
446
+ class SubjectPublicKeyInfo(univ.Sequence):
447
+ pass
448
+
449
+
450
+ SubjectPublicKeyInfo.componentType = namedtype.NamedTypes(
451
+ namedtype.NamedType('algorithm', AlgorithmIdentifier()),
452
+ namedtype.NamedType('subjectPublicKey', univ.BitString())
453
+ )
454
+
455
+
456
+ class TBSCertificate(univ.Sequence):
457
+ pass
458
+
459
+
460
+ TBSCertificate.componentType = namedtype.NamedTypes(
461
+ namedtype.DefaultedNamedType('version',
462
+ Version().subtype(explicitTag=tag.Tag(tag.tagClassContext,
463
+ tag.tagFormatSimple, 0)).subtype(value="v1")),
464
+ namedtype.NamedType('serialNumber', CertificateSerialNumber()),
465
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
466
+ namedtype.NamedType('issuer', Name()),
467
+ namedtype.NamedType('validity', Validity()),
468
+ namedtype.NamedType('subject', Name()),
469
+ namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
470
+ namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype(
471
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
472
+ namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype(
473
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
474
+ namedtype.OptionalNamedType('extensions',
475
+ Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
476
+ )
477
+
478
+ physical_delivery_office_name = univ.Integer(10)
479
+
480
+ ub_name = univ.Integer(32768)
481
+
482
+
483
+ class X520name(univ.Choice):
484
+ pass
485
+
486
+
487
+ X520name.componentType = namedtype.NamedTypes(
488
+ namedtype.NamedType('teletexString',
489
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
490
+ namedtype.NamedType('printableString',
491
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
492
+ namedtype.NamedType('universalString',
493
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
494
+ namedtype.NamedType('utf8String',
495
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
496
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name)))
497
+ )
498
+
499
+ id_at_dnQualifier = _buildOid(id_at, 46)
500
+
501
+ ub_serial_number = univ.Integer(64)
502
+
503
+ ub_pseudonym = univ.Integer(128)
504
+
505
+ pkcs_9 = _buildOid(1, 2, 840, 113549, 1, 9)
506
+
507
+
508
+ class X121Address(char.NumericString):
509
+ pass
510
+
511
+
512
+ X121Address.subtypeSpec = constraint.ValueSizeConstraint(1, ub_x121_address_length)
513
+
514
+
515
+ class NetworkAddress(X121Address):
516
+ pass
517
+
518
+
519
+ ub_integer_options = univ.Integer(256)
520
+
521
+ id_at_commonName = _buildOid(id_at, 3)
522
+
523
+ ub_organization_name_length = univ.Integer(64)
524
+
525
+ id_ad_ocsp = _buildOid(id_ad, 1)
526
+
527
+ ub_country_name_numeric_length = univ.Integer(3)
528
+
529
+ ub_country_name_alpha_length = univ.Integer(2)
530
+
531
+
532
+ class PhysicalDeliveryCountryName(univ.Choice):
533
+ pass
534
+
535
+
536
+ PhysicalDeliveryCountryName.componentType = namedtype.NamedTypes(
537
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
538
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
539
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
540
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
541
+ )
542
+
543
+ id_emailAddress = _buildOid(pkcs_9, 1)
544
+
545
+ common_name = univ.Integer(1)
546
+
547
+
548
+ class X520Pseudonym(univ.Choice):
549
+ pass
550
+
551
+
552
+ X520Pseudonym.componentType = namedtype.NamedTypes(
553
+ namedtype.NamedType('teletexString',
554
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
555
+ namedtype.NamedType('printableString',
556
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
557
+ namedtype.NamedType('universalString',
558
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
559
+ namedtype.NamedType('utf8String',
560
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
561
+ namedtype.NamedType('bmpString',
562
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym)))
563
+ )
564
+
565
+ ub_domain_name_length = univ.Integer(16)
566
+
567
+
568
+ class AdministrationDomainName(univ.Choice):
569
+ pass
570
+
571
+
572
+ AdministrationDomainName.tagSet = univ.Choice.tagSet.tagExplicitly(
573
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2))
574
+ AdministrationDomainName.componentType = namedtype.NamedTypes(
575
+ namedtype.NamedType('numeric', char.NumericString().subtype(
576
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))),
577
+ namedtype.NamedType('printable', char.PrintableString().subtype(
578
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
579
+ )
580
+
581
+
582
+ class PresentationAddress(univ.Sequence):
583
+ pass
584
+
585
+
586
+ PresentationAddress.componentType = namedtype.NamedTypes(
587
+ namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
588
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
589
+ namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
590
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
591
+ namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
592
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
593
+ namedtype.NamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
594
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
595
+ )
596
+
597
+
598
+ class ExtendedNetworkAddress(univ.Choice):
599
+ pass
600
+
601
+
602
+ ExtendedNetworkAddress.componentType = namedtype.NamedTypes(
603
+ namedtype.NamedType(
604
+ 'e163-4-address', univ.Sequence(
605
+ componentType=namedtype.NamedTypes(
606
+ namedtype.NamedType('number', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
607
+ namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
608
+ )
609
+ )
610
+ ),
611
+ namedtype.NamedType('psap-address', PresentationAddress().subtype(
612
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
613
+ )
614
+
615
+
616
+ class TeletexOrganizationName(char.TeletexString):
617
+ pass
618
+
619
+
620
+ TeletexOrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
621
+
622
+ ub_terminal_id_length = univ.Integer(24)
623
+
624
+
625
+ class TerminalIdentifier(char.PrintableString):
626
+ pass
627
+
628
+
629
+ TerminalIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_terminal_id_length)
630
+
631
+ id_ad_caIssuers = _buildOid(id_ad, 2)
632
+
633
+ id_at_countryName = _buildOid(id_at, 6)
634
+
635
+
636
+ class StreetAddress(PDSParameter):
637
+ pass
638
+
639
+
640
+ postal_code = univ.Integer(9)
641
+
642
+ id_at_givenName = _buildOid(id_at, 42)
643
+
644
+ ub_title = univ.Integer(64)
645
+
646
+
647
+ class ExtensionAttributes(univ.SetOf):
648
+ pass
649
+
650
+
651
+ ExtensionAttributes.componentType = ExtensionAttribute()
652
+ ExtensionAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_extension_attributes)
653
+
654
+ ub_emailaddress_length = univ.Integer(255)
655
+
656
+ id_ad_caRepository = _buildOid(id_ad, 5)
657
+
658
+
659
+ class ExtensionORAddressComponents(PDSParameter):
660
+ pass
661
+
662
+
663
+ ub_organizational_unit_name = univ.Integer(64)
664
+
665
+
666
+ class X520OrganizationalUnitName(univ.Choice):
667
+ pass
668
+
669
+
670
+ X520OrganizationalUnitName.componentType = namedtype.NamedTypes(
671
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
672
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
673
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
674
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
675
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
676
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
677
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
678
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
679
+ namedtype.NamedType('bmpString', char.BMPString().subtype(
680
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name)))
681
+ )
682
+
683
+
684
+ class LocalPostalAttributes(PDSParameter):
685
+ pass
686
+
687
+
688
+ teletex_organizational_unit_names = univ.Integer(5)
689
+
690
+
691
+ class X520Title(univ.Choice):
692
+ pass
693
+
694
+
695
+ X520Title.componentType = namedtype.NamedTypes(
696
+ namedtype.NamedType('teletexString',
697
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
698
+ namedtype.NamedType('printableString',
699
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
700
+ namedtype.NamedType('universalString',
701
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
702
+ namedtype.NamedType('utf8String',
703
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
704
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title)))
705
+ )
706
+
707
+ id_at_localityName = _buildOid(id_at, 7)
708
+
709
+ id_at_initials = _buildOid(id_at, 43)
710
+
711
+ ub_state_name = univ.Integer(128)
712
+
713
+
714
+ class X520StateOrProvinceName(univ.Choice):
715
+ pass
716
+
717
+
718
+ X520StateOrProvinceName.componentType = namedtype.NamedTypes(
719
+ namedtype.NamedType('teletexString',
720
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
721
+ namedtype.NamedType('printableString',
722
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
723
+ namedtype.NamedType('universalString',
724
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
725
+ namedtype.NamedType('utf8String',
726
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
727
+ namedtype.NamedType('bmpString',
728
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name)))
729
+ )
730
+
731
+ physical_delivery_organization_name = univ.Integer(14)
732
+
733
+ id_at_surname = _buildOid(id_at, 4)
734
+
735
+
736
+ class X520countryName(char.PrintableString):
737
+ pass
738
+
739
+
740
+ X520countryName.subtypeSpec = constraint.ValueSizeConstraint(2, 2)
741
+
742
+ physical_delivery_office_number = univ.Integer(11)
743
+
744
+ id_qt_unotice = _buildOid(id_qt, 2)
745
+
746
+
747
+ class X520SerialNumber(char.PrintableString):
748
+ pass
749
+
750
+
751
+ X520SerialNumber.subtypeSpec = constraint.ValueSizeConstraint(1, ub_serial_number)
752
+
753
+
754
+ class Attribute(univ.Sequence):
755
+ componentType = namedtype.NamedTypes(
756
+ namedtype.NamedType('type', AttributeType()),
757
+ namedtype.NamedType('values',
758
+ univ.SetOf(componentType=AttributeValue()),
759
+ openType=opentype.OpenType('type', certificateAttributesMap))
760
+ )
761
+
762
+ ub_common_name = univ.Integer(64)
763
+
764
+ id_pe = _buildOid(id_pkix, 1)
765
+
766
+
767
+ class ExtensionPhysicalDeliveryAddressComponents(PDSParameter):
768
+ pass
769
+
770
+
771
+ class EmailAddress(char.IA5String):
772
+ pass
773
+
774
+
775
+ EmailAddress.subtypeSpec = constraint.ValueSizeConstraint(1, ub_emailaddress_length)
776
+
777
+ id_at_organizationName = _buildOid(id_at, 10)
778
+
779
+ post_office_box_address = univ.Integer(18)
780
+
781
+
782
+ class BuiltInDomainDefinedAttribute(univ.Sequence):
783
+ pass
784
+
785
+
786
+ BuiltInDomainDefinedAttribute.componentType = namedtype.NamedTypes(
787
+ namedtype.NamedType('type', char.PrintableString().subtype(
788
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
789
+ namedtype.NamedType('value', char.PrintableString().subtype(
790
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
791
+ )
792
+
793
+
794
+ class BuiltInDomainDefinedAttributes(univ.SequenceOf):
795
+ pass
796
+
797
+
798
+ BuiltInDomainDefinedAttributes.componentType = BuiltInDomainDefinedAttribute()
799
+ BuiltInDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
800
+
801
+ id_at_pseudonym = _buildOid(id_at, 65)
802
+
803
+ id_domainComponent = _buildOid(0, 9, 2342, 19200300, 100, 1, 25)
804
+
805
+
806
+ class X520CommonName(univ.Choice):
807
+ pass
808
+
809
+
810
+ X520CommonName.componentType = namedtype.NamedTypes(
811
+ namedtype.NamedType('teletexString',
812
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
813
+ namedtype.NamedType('printableString',
814
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
815
+ namedtype.NamedType('universalString',
816
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
817
+ namedtype.NamedType('utf8String',
818
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
819
+ namedtype.NamedType('bmpString',
820
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name)))
821
+ )
822
+
823
+ extension_OR_address_components = univ.Integer(12)
824
+
825
+ ub_organizational_units = univ.Integer(4)
826
+
827
+ teletex_personal_name = univ.Integer(4)
828
+
829
+ ub_numeric_user_id_length = univ.Integer(32)
830
+
831
+ ub_common_name_length = univ.Integer(64)
832
+
833
+
834
+ class TeletexCommonName(char.TeletexString):
835
+ pass
836
+
837
+
838
+ TeletexCommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
839
+
840
+
841
+ class PhysicalDeliveryOrganizationName(PDSParameter):
842
+ pass
843
+
844
+
845
+ extension_physical_delivery_address_components = univ.Integer(15)
846
+
847
+
848
+ class NumericUserIdentifier(char.NumericString):
849
+ pass
850
+
851
+
852
+ NumericUserIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_numeric_user_id_length)
853
+
854
+
855
+ class CountryName(univ.Choice):
856
+ pass
857
+
858
+
859
+ CountryName.tagSet = univ.Choice.tagSet.tagExplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1))
860
+ CountryName.componentType = namedtype.NamedTypes(
861
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
862
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
863
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
864
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
865
+ )
866
+
867
+
868
+ class OrganizationName(char.PrintableString):
869
+ pass
870
+
871
+
872
+ OrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
873
+
874
+
875
+ class OrganizationalUnitNames(univ.SequenceOf):
876
+ pass
877
+
878
+
879
+ OrganizationalUnitNames.componentType = OrganizationalUnitName()
880
+ OrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
881
+
882
+
883
+ class PrivateDomainName(univ.Choice):
884
+ pass
885
+
886
+
887
+ PrivateDomainName.componentType = namedtype.NamedTypes(
888
+ namedtype.NamedType('numeric', char.NumericString().subtype(
889
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))),
890
+ namedtype.NamedType('printable', char.PrintableString().subtype(
891
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length)))
892
+ )
893
+
894
+
895
+ class BuiltInStandardAttributes(univ.Sequence):
896
+ pass
897
+
898
+
899
+ BuiltInStandardAttributes.componentType = namedtype.NamedTypes(
900
+ namedtype.OptionalNamedType('country-name', CountryName()),
901
+ namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()),
902
+ namedtype.OptionalNamedType('network-address', NetworkAddress().subtype(
903
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
904
+ namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype(
905
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
906
+ namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype(
907
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
908
+ namedtype.OptionalNamedType('organization-name', OrganizationName().subtype(
909
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
910
+ namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype(
911
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
912
+ namedtype.OptionalNamedType('personal-name', PersonalName().subtype(
913
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
914
+ namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype(
915
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6)))
916
+ )
917
+
918
+
919
+ class ORAddress(univ.Sequence):
920
+ pass
921
+
922
+
923
+ ORAddress.componentType = namedtype.NamedTypes(
924
+ namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()),
925
+ namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()),
926
+ namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes())
927
+ )
928
+
929
+
930
+ class DistinguishedName(RDNSequence):
931
+ pass
932
+
933
+
934
+ id_ad_timeStamping = _buildOid(id_ad, 3)
935
+
936
+
937
+ class PhysicalDeliveryOfficeNumber(PDSParameter):
938
+ pass
939
+
940
+
941
+ teletex_domain_defined_attributes = univ.Integer(6)
942
+
943
+
944
+ class UniquePostalName(PDSParameter):
945
+ pass
946
+
947
+
948
+ physical_delivery_country_name = univ.Integer(8)
949
+
950
+ ub_pds_name_length = univ.Integer(16)
951
+
952
+
953
+ class PDSName(char.PrintableString):
954
+ pass
955
+
956
+
957
+ PDSName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_pds_name_length)
958
+
959
+
960
+ class TeletexPersonalName(univ.Set):
961
+ pass
962
+
963
+
964
+ TeletexPersonalName.componentType = namedtype.NamedTypes(
965
+ namedtype.NamedType('surname', char.TeletexString().subtype(
966
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
967
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
968
+ namedtype.OptionalNamedType('given-name', char.TeletexString().subtype(
969
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
970
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
971
+ namedtype.OptionalNamedType('initials', char.TeletexString().subtype(
972
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
973
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
974
+ namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype(
975
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
976
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
977
+ )
978
+
979
+ street_address = univ.Integer(17)
980
+
981
+
982
+ class PostOfficeBoxAddress(PDSParameter):
983
+ pass
984
+
985
+
986
+ local_postal_attributes = univ.Integer(21)
987
+
988
+
989
+ class DirectoryString(univ.Choice):
990
+ pass
991
+
992
+
993
+ DirectoryString.componentType = namedtype.NamedTypes(
994
+ namedtype.NamedType('teletexString',
995
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
996
+ namedtype.NamedType('printableString',
997
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
998
+ namedtype.NamedType('universalString',
999
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
1000
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
1001
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
1002
+ )
1003
+
1004
+ teletex_common_name = univ.Integer(2)
1005
+
1006
+
1007
+ class CommonName(char.PrintableString):
1008
+ pass
1009
+
1010
+
1011
+ CommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
1012
+
1013
+
1014
+ class Certificate(univ.Sequence):
1015
+ pass
1016
+
1017
+
1018
+ Certificate.componentType = namedtype.NamedTypes(
1019
+ namedtype.NamedType('tbsCertificate', TBSCertificate()),
1020
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
1021
+ namedtype.NamedType('signature', univ.BitString())
1022
+ )
1023
+
1024
+
1025
+ class TeletexOrganizationalUnitName(char.TeletexString):
1026
+ pass
1027
+
1028
+
1029
+ TeletexOrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
1030
+
1031
+ id_at_name = _buildOid(id_at, 41)
1032
+
1033
+
1034
+ class TeletexOrganizationalUnitNames(univ.SequenceOf):
1035
+ pass
1036
+
1037
+
1038
+ TeletexOrganizationalUnitNames.componentType = TeletexOrganizationalUnitName()
1039
+ TeletexOrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
1040
+
1041
+ id_ce = _buildOid(2, 5, 29)
1042
+
1043
+ id_ce_issuerAltName = _buildOid(id_ce, 18)
1044
+
1045
+
1046
+ class SkipCerts(univ.Integer):
1047
+ pass
1048
+
1049
+
1050
+ SkipCerts.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1051
+
1052
+
1053
+ class CRLReason(univ.Enumerated):
1054
+ pass
1055
+
1056
+
1057
+ CRLReason.namedValues = namedval.NamedValues(
1058
+ ('unspecified', 0),
1059
+ ('keyCompromise', 1),
1060
+ ('cACompromise', 2),
1061
+ ('affiliationChanged', 3),
1062
+ ('superseded', 4),
1063
+ ('cessationOfOperation', 5),
1064
+ ('certificateHold', 6),
1065
+ ('removeFromCRL', 8),
1066
+ ('privilegeWithdrawn', 9),
1067
+ ('aACompromise', 10)
1068
+ )
1069
+
1070
+
1071
+ class PrivateKeyUsagePeriod(univ.Sequence):
1072
+ pass
1073
+
1074
+
1075
+ PrivateKeyUsagePeriod.componentType = namedtype.NamedTypes(
1076
+ namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype(
1077
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1078
+ namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype(
1079
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1080
+ )
1081
+
1082
+
1083
+ anotherNameMap = {
1084
+
1085
+ }
1086
+
1087
+
1088
+ class AnotherName(univ.Sequence):
1089
+ componentType = namedtype.NamedTypes(
1090
+ namedtype.NamedType('type-id', univ.ObjectIdentifier()),
1091
+ namedtype.NamedType(
1092
+ 'value',
1093
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)),
1094
+ openType=opentype.OpenType('type-id', anotherNameMap)
1095
+ )
1096
+ )
1097
+
1098
+
1099
+ class EDIPartyName(univ.Sequence):
1100
+ pass
1101
+
1102
+
1103
+ EDIPartyName.componentType = namedtype.NamedTypes(
1104
+ namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype(
1105
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1106
+ namedtype.NamedType('partyName', DirectoryString().subtype(
1107
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
1108
+ )
1109
+
1110
+
1111
+ class GeneralName(univ.Choice):
1112
+ pass
1113
+
1114
+
1115
+ GeneralName.componentType = namedtype.NamedTypes(
1116
+ namedtype.NamedType('otherName',
1117
+ AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1118
+ namedtype.NamedType('rfc822Name',
1119
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1120
+ namedtype.NamedType('dNSName',
1121
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
1122
+ namedtype.NamedType('x400Address',
1123
+ ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1124
+ namedtype.NamedType('directoryName',
1125
+ Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
1126
+ namedtype.NamedType('ediPartyName',
1127
+ EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
1128
+ namedtype.NamedType('uniformResourceIdentifier',
1129
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
1130
+ namedtype.NamedType('iPAddress',
1131
+ univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
1132
+ namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype(
1133
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)))
1134
+ )
1135
+
1136
+
1137
+ class BaseDistance(univ.Integer):
1138
+ pass
1139
+
1140
+
1141
+ BaseDistance.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1142
+
1143
+
1144
+ class GeneralSubtree(univ.Sequence):
1145
+ pass
1146
+
1147
+
1148
+ GeneralSubtree.componentType = namedtype.NamedTypes(
1149
+ namedtype.NamedType('base', GeneralName()),
1150
+ namedtype.DefaultedNamedType('minimum', BaseDistance().subtype(
1151
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)),
1152
+ namedtype.OptionalNamedType('maximum', BaseDistance().subtype(
1153
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1154
+ )
1155
+
1156
+
1157
+ class GeneralNames(univ.SequenceOf):
1158
+ pass
1159
+
1160
+
1161
+ GeneralNames.componentType = GeneralName()
1162
+ GeneralNames.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1163
+
1164
+
1165
+ class DistributionPointName(univ.Choice):
1166
+ pass
1167
+
1168
+
1169
+ DistributionPointName.componentType = namedtype.NamedTypes(
1170
+ namedtype.NamedType('fullName',
1171
+ GeneralNames().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1172
+ namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype(
1173
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1174
+ )
1175
+
1176
+
1177
+ class ReasonFlags(univ.BitString):
1178
+ pass
1179
+
1180
+
1181
+ ReasonFlags.namedValues = namedval.NamedValues(
1182
+ ('unused', 0),
1183
+ ('keyCompromise', 1),
1184
+ ('cACompromise', 2),
1185
+ ('affiliationChanged', 3),
1186
+ ('superseded', 4),
1187
+ ('cessationOfOperation', 5),
1188
+ ('certificateHold', 6),
1189
+ ('privilegeWithdrawn', 7),
1190
+ ('aACompromise', 8)
1191
+ )
1192
+
1193
+
1194
+ class IssuingDistributionPoint(univ.Sequence):
1195
+ pass
1196
+
1197
+
1198
+ IssuingDistributionPoint.componentType = namedtype.NamedTypes(
1199
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1200
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1201
+ namedtype.DefaultedNamedType('onlyContainsUserCerts', univ.Boolean().subtype(
1202
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(value=0)),
1203
+ namedtype.DefaultedNamedType('onlyContainsCACerts', univ.Boolean().subtype(
1204
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)).subtype(value=0)),
1205
+ namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype(
1206
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1207
+ namedtype.DefaultedNamedType('indirectCRL', univ.Boolean().subtype(
1208
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)).subtype(value=0)),
1209
+ namedtype.DefaultedNamedType('onlyContainsAttributeCerts', univ.Boolean().subtype(
1210
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)).subtype(value=0))
1211
+ )
1212
+
1213
+ id_ce_certificatePolicies = _buildOid(id_ce, 32)
1214
+
1215
+ id_kp_emailProtection = _buildOid(id_kp, 4)
1216
+
1217
+
1218
+ class AccessDescription(univ.Sequence):
1219
+ pass
1220
+
1221
+
1222
+ AccessDescription.componentType = namedtype.NamedTypes(
1223
+ namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
1224
+ namedtype.NamedType('accessLocation', GeneralName())
1225
+ )
1226
+
1227
+
1228
+ class IssuerAltName(GeneralNames):
1229
+ pass
1230
+
1231
+
1232
+ id_ce_cRLDistributionPoints = _buildOid(id_ce, 31)
1233
+
1234
+ holdInstruction = _buildOid(2, 2, 840, 10040, 2)
1235
+
1236
+ id_holdinstruction_callissuer = _buildOid(holdInstruction, 2)
1237
+
1238
+ id_ce_subjectDirectoryAttributes = _buildOid(id_ce, 9)
1239
+
1240
+ id_ce_issuingDistributionPoint = _buildOid(id_ce, 28)
1241
+
1242
+
1243
+ class DistributionPoint(univ.Sequence):
1244
+ pass
1245
+
1246
+
1247
+ DistributionPoint.componentType = namedtype.NamedTypes(
1248
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1249
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1250
+ namedtype.OptionalNamedType('reasons', ReasonFlags().subtype(
1251
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1252
+ namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype(
1253
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
1254
+ )
1255
+
1256
+
1257
+ class CRLDistributionPoints(univ.SequenceOf):
1258
+ pass
1259
+
1260
+
1261
+ CRLDistributionPoints.componentType = DistributionPoint()
1262
+ CRLDistributionPoints.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1263
+
1264
+
1265
+ class GeneralSubtrees(univ.SequenceOf):
1266
+ pass
1267
+
1268
+
1269
+ GeneralSubtrees.componentType = GeneralSubtree()
1270
+ GeneralSubtrees.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1271
+
1272
+
1273
+ class NameConstraints(univ.Sequence):
1274
+ pass
1275
+
1276
+
1277
+ NameConstraints.componentType = namedtype.NamedTypes(
1278
+ namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype(
1279
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1280
+ namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype(
1281
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1282
+ )
1283
+
1284
+
1285
+ class SubjectDirectoryAttributes(univ.SequenceOf):
1286
+ pass
1287
+
1288
+
1289
+ SubjectDirectoryAttributes.componentType = Attribute()
1290
+ SubjectDirectoryAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1291
+
1292
+ id_kp_OCSPSigning = _buildOid(id_kp, 9)
1293
+
1294
+ id_kp_timeStamping = _buildOid(id_kp, 8)
1295
+
1296
+
1297
+ class DisplayText(univ.Choice):
1298
+ pass
1299
+
1300
+
1301
+ DisplayText.componentType = namedtype.NamedTypes(
1302
+ namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1303
+ namedtype.NamedType('visibleString',
1304
+ char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1305
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
1306
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
1307
+ )
1308
+
1309
+
1310
+ class NoticeReference(univ.Sequence):
1311
+ pass
1312
+
1313
+
1314
+ NoticeReference.componentType = namedtype.NamedTypes(
1315
+ namedtype.NamedType('organization', DisplayText()),
1316
+ namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer()))
1317
+ )
1318
+
1319
+
1320
+ class UserNotice(univ.Sequence):
1321
+ pass
1322
+
1323
+
1324
+ UserNotice.componentType = namedtype.NamedTypes(
1325
+ namedtype.OptionalNamedType('noticeRef', NoticeReference()),
1326
+ namedtype.OptionalNamedType('explicitText', DisplayText())
1327
+ )
1328
+
1329
+
1330
+ class PolicyQualifierId(univ.ObjectIdentifier):
1331
+ pass
1332
+
1333
+
1334
+ policyQualifierInfoMap = {
1335
+
1336
+ }
1337
+
1338
+
1339
+ class PolicyQualifierInfo(univ.Sequence):
1340
+ componentType = namedtype.NamedTypes(
1341
+ namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
1342
+ namedtype.NamedType(
1343
+ 'qualifier', univ.Any(),
1344
+ openType=opentype.OpenType('policyQualifierId', policyQualifierInfoMap)
1345
+ )
1346
+ )
1347
+
1348
+
1349
+ class CertPolicyId(univ.ObjectIdentifier):
1350
+ pass
1351
+
1352
+
1353
+ class PolicyInformation(univ.Sequence):
1354
+ pass
1355
+
1356
+
1357
+ PolicyInformation.componentType = namedtype.NamedTypes(
1358
+ namedtype.NamedType('policyIdentifier', CertPolicyId()),
1359
+ namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo()))
1360
+ )
1361
+
1362
+
1363
+ class CertificatePolicies(univ.SequenceOf):
1364
+ pass
1365
+
1366
+
1367
+ CertificatePolicies.componentType = PolicyInformation()
1368
+ CertificatePolicies.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1369
+
1370
+
1371
+ class SubjectAltName(GeneralNames):
1372
+ pass
1373
+
1374
+
1375
+ id_ce_basicConstraints = _buildOid(id_ce, 19)
1376
+
1377
+ id_ce_authorityKeyIdentifier = _buildOid(id_ce, 35)
1378
+
1379
+ id_kp_codeSigning = _buildOid(id_kp, 3)
1380
+
1381
+
1382
+ class BasicConstraints(univ.Sequence):
1383
+ pass
1384
+
1385
+
1386
+ BasicConstraints.componentType = namedtype.NamedTypes(
1387
+ namedtype.DefaultedNamedType('cA', univ.Boolean().subtype(value=0)),
1388
+ namedtype.OptionalNamedType('pathLenConstraint',
1389
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
1390
+ )
1391
+
1392
+ id_ce_certificateIssuer = _buildOid(id_ce, 29)
1393
+
1394
+
1395
+ class PolicyMappings(univ.SequenceOf):
1396
+ pass
1397
+
1398
+
1399
+ PolicyMappings.componentType = univ.Sequence(
1400
+ componentType=namedtype.NamedTypes(
1401
+ namedtype.NamedType('issuerDomainPolicy', CertPolicyId()),
1402
+ namedtype.NamedType('subjectDomainPolicy', CertPolicyId())
1403
+ )
1404
+ )
1405
+
1406
+ PolicyMappings.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1407
+
1408
+
1409
+ class InhibitAnyPolicy(SkipCerts):
1410
+ pass
1411
+
1412
+
1413
+ anyPolicy = _buildOid(id_ce_certificatePolicies, 0)
1414
+
1415
+
1416
+ class CRLNumber(univ.Integer):
1417
+ pass
1418
+
1419
+
1420
+ CRLNumber.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
1421
+
1422
+
1423
+ class BaseCRLNumber(CRLNumber):
1424
+ pass
1425
+
1426
+
1427
+ id_ce_nameConstraints = _buildOid(id_ce, 30)
1428
+
1429
+ id_kp_serverAuth = _buildOid(id_kp, 1)
1430
+
1431
+ id_ce_freshestCRL = _buildOid(id_ce, 46)
1432
+
1433
+ id_ce_cRLReasons = _buildOid(id_ce, 21)
1434
+
1435
+ id_ce_extKeyUsage = _buildOid(id_ce, 37)
1436
+
1437
+
1438
+ class KeyIdentifier(univ.OctetString):
1439
+ pass
1440
+
1441
+
1442
+ class AuthorityKeyIdentifier(univ.Sequence):
1443
+ pass
1444
+
1445
+
1446
+ AuthorityKeyIdentifier.componentType = namedtype.NamedTypes(
1447
+ namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype(
1448
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1449
+ namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype(
1450
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1451
+ namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype(
1452
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
1453
+ )
1454
+
1455
+
1456
+ class FreshestCRL(CRLDistributionPoints):
1457
+ pass
1458
+
1459
+
1460
+ id_ce_policyConstraints = _buildOid(id_ce, 36)
1461
+
1462
+ id_pe_authorityInfoAccess = _buildOid(id_pe, 1)
1463
+
1464
+
1465
+ class AuthorityInfoAccessSyntax(univ.SequenceOf):
1466
+ pass
1467
+
1468
+
1469
+ AuthorityInfoAccessSyntax.componentType = AccessDescription()
1470
+ AuthorityInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1471
+
1472
+ id_holdinstruction_none = _buildOid(holdInstruction, 1)
1473
+
1474
+
1475
+ class CPSuri(char.IA5String):
1476
+ pass
1477
+
1478
+
1479
+ id_pe_subjectInfoAccess = _buildOid(id_pe, 11)
1480
+
1481
+
1482
+ class SubjectKeyIdentifier(KeyIdentifier):
1483
+ pass
1484
+
1485
+
1486
+ id_ce_subjectAltName = _buildOid(id_ce, 17)
1487
+
1488
+
1489
+ class KeyPurposeId(univ.ObjectIdentifier):
1490
+ pass
1491
+
1492
+
1493
+ class ExtKeyUsageSyntax(univ.SequenceOf):
1494
+ pass
1495
+
1496
+
1497
+ ExtKeyUsageSyntax.componentType = KeyPurposeId()
1498
+ ExtKeyUsageSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1499
+
1500
+
1501
+ class HoldInstructionCode(univ.ObjectIdentifier):
1502
+ pass
1503
+
1504
+
1505
+ id_ce_deltaCRLIndicator = _buildOid(id_ce, 27)
1506
+
1507
+ id_ce_keyUsage = _buildOid(id_ce, 15)
1508
+
1509
+ id_ce_holdInstructionCode = _buildOid(id_ce, 23)
1510
+
1511
+
1512
+ class SubjectInfoAccessSyntax(univ.SequenceOf):
1513
+ pass
1514
+
1515
+
1516
+ SubjectInfoAccessSyntax.componentType = AccessDescription()
1517
+ SubjectInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
1518
+
1519
+
1520
+ class InvalidityDate(useful.GeneralizedTime):
1521
+ pass
1522
+
1523
+
1524
+ class KeyUsage(univ.BitString):
1525
+ pass
1526
+
1527
+
1528
+ KeyUsage.namedValues = namedval.NamedValues(
1529
+ ('digitalSignature', 0),
1530
+ ('nonRepudiation', 1),
1531
+ ('keyEncipherment', 2),
1532
+ ('dataEncipherment', 3),
1533
+ ('keyAgreement', 4),
1534
+ ('keyCertSign', 5),
1535
+ ('cRLSign', 6),
1536
+ ('encipherOnly', 7),
1537
+ ('decipherOnly', 8)
1538
+ )
1539
+
1540
+ id_ce_invalidityDate = _buildOid(id_ce, 24)
1541
+
1542
+ id_ce_policyMappings = _buildOid(id_ce, 33)
1543
+
1544
+ anyExtendedKeyUsage = _buildOid(id_ce_extKeyUsage, 0)
1545
+
1546
+ id_ce_privateKeyUsagePeriod = _buildOid(id_ce, 16)
1547
+
1548
+ id_ce_cRLNumber = _buildOid(id_ce, 20)
1549
+
1550
+
1551
+ class CertificateIssuer(GeneralNames):
1552
+ pass
1553
+
1554
+
1555
+ id_holdinstruction_reject = _buildOid(holdInstruction, 3)
1556
+
1557
+
1558
+ class PolicyConstraints(univ.Sequence):
1559
+ pass
1560
+
1561
+
1562
+ PolicyConstraints.componentType = namedtype.NamedTypes(
1563
+ namedtype.OptionalNamedType('requireExplicitPolicy',
1564
+ SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1565
+ namedtype.OptionalNamedType('inhibitPolicyMapping',
1566
+ SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
1567
+ )
1568
+
1569
+ id_kp_clientAuth = _buildOid(id_kp, 2)
1570
+
1571
+ id_ce_subjectKeyIdentifier = _buildOid(id_ce, 14)
1572
+
1573
+ id_ce_inhibitAnyPolicy = _buildOid(id_ce, 54)
1574
+
1575
+ # map of ORAddress ExtensionAttribute type to ExtensionAttribute value
1576
+
1577
+ _oraddressExtensionAttributeMapUpdate = {
1578
+ common_name: CommonName(),
1579
+ teletex_common_name: TeletexCommonName(),
1580
+ teletex_organization_name: TeletexOrganizationName(),
1581
+ teletex_personal_name: TeletexPersonalName(),
1582
+ teletex_organizational_unit_names: TeletexOrganizationalUnitNames(),
1583
+ pds_name: PDSName(),
1584
+ physical_delivery_country_name: PhysicalDeliveryCountryName(),
1585
+ postal_code: PostalCode(),
1586
+ physical_delivery_office_name: PhysicalDeliveryOfficeName(),
1587
+ physical_delivery_office_number: PhysicalDeliveryOfficeNumber(),
1588
+ extension_OR_address_components: ExtensionORAddressComponents(),
1589
+ physical_delivery_personal_name: PhysicalDeliveryPersonalName(),
1590
+ physical_delivery_organization_name: PhysicalDeliveryOrganizationName(),
1591
+ extension_physical_delivery_address_components: ExtensionPhysicalDeliveryAddressComponents(),
1592
+ unformatted_postal_address: UnformattedPostalAddress(),
1593
+ street_address: StreetAddress(),
1594
+ post_office_box_address: PostOfficeBoxAddress(),
1595
+ poste_restante_address: PosteRestanteAddress(),
1596
+ unique_postal_name: UniquePostalName(),
1597
+ local_postal_attributes: LocalPostalAttributes(),
1598
+ extended_network_address: ExtendedNetworkAddress(),
1599
+ terminal_type: TerminalType(),
1600
+ teletex_domain_defined_attributes: TeletexDomainDefinedAttributes(),
1601
+ }
1602
+
1603
+ oraddressExtensionAttributeMap.update(_oraddressExtensionAttributeMapUpdate)
1604
+
1605
+
1606
+ # map of AttributeType -> AttributeValue
1607
+
1608
+ _certificateAttributesMapUpdate = {
1609
+ id_at_name: X520name(),
1610
+ id_at_surname: X520name(),
1611
+ id_at_givenName: X520name(),
1612
+ id_at_initials: X520name(),
1613
+ id_at_generationQualifier: X520name(),
1614
+ id_at_commonName: X520CommonName(),
1615
+ id_at_localityName: X520LocalityName(),
1616
+ id_at_stateOrProvinceName: X520StateOrProvinceName(),
1617
+ id_at_organizationName: X520OrganizationName(),
1618
+ id_at_organizationalUnitName: X520OrganizationalUnitName(),
1619
+ id_at_title: X520Title(),
1620
+ id_at_dnQualifier: X520dnQualifier(),
1621
+ id_at_countryName: X520countryName(),
1622
+ id_at_serialNumber: X520SerialNumber(),
1623
+ id_at_pseudonym: X520Pseudonym(),
1624
+ id_domainComponent: DomainComponent(),
1625
+ id_emailAddress: EmailAddress(),
1626
+ }
1627
+
1628
+ certificateAttributesMap.update(_certificateAttributesMapUpdate)
1629
+
1630
+
1631
+ # map of Certificate Extension OIDs to Extensions
1632
+
1633
+ _certificateExtensionsMap = {
1634
+ id_ce_authorityKeyIdentifier: AuthorityKeyIdentifier(),
1635
+ id_ce_subjectKeyIdentifier: SubjectKeyIdentifier(),
1636
+ id_ce_keyUsage: KeyUsage(),
1637
+ id_ce_privateKeyUsagePeriod: PrivateKeyUsagePeriod(),
1638
+ id_ce_certificatePolicies: CertificatePolicies(),
1639
+ id_ce_policyMappings: PolicyMappings(),
1640
+ id_ce_subjectAltName: SubjectAltName(),
1641
+ id_ce_issuerAltName: IssuerAltName(),
1642
+ id_ce_subjectDirectoryAttributes: SubjectDirectoryAttributes(),
1643
+ id_ce_basicConstraints: BasicConstraints(),
1644
+ id_ce_nameConstraints: NameConstraints(),
1645
+ id_ce_policyConstraints: PolicyConstraints(),
1646
+ id_ce_extKeyUsage: ExtKeyUsageSyntax(),
1647
+ id_ce_cRLDistributionPoints: CRLDistributionPoints(),
1648
+ id_pe_authorityInfoAccess: AuthorityInfoAccessSyntax(),
1649
+ id_ce_cRLNumber: univ.Integer(),
1650
+ id_ce_deltaCRLIndicator: BaseCRLNumber(),
1651
+ id_ce_issuingDistributionPoint: IssuingDistributionPoint(),
1652
+ id_ce_cRLReasons: CRLReason(),
1653
+ id_ce_holdInstructionCode: univ.ObjectIdentifier(),
1654
+ id_ce_invalidityDate: useful.GeneralizedTime(),
1655
+ id_ce_certificateIssuer: GeneralNames(),
1656
+ }
1657
+
1658
+ certificateExtensionsMap.update(_certificateExtensionsMap)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5697.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley.
4
+ #
5
+ # Copyright (c) 2019, Vigil Security, LLC
6
+ # License: http://snmplabs.com/pyasn1/license.html
7
+ #
8
+ # Other Certificates Extension
9
+ #
10
+ # ASN.1 source from:
11
+ # https://www.rfc-editor.org/rfc/rfc5697.txt
12
+
13
+ from pyasn1.type import namedtype
14
+ from pyasn1.type import univ
15
+
16
+ from pyasn1_modules import rfc5280
17
+ from pyasn1_modules import rfc4055
18
+
19
+
20
+ # Imports from RFC 5280
21
+
22
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
23
+
24
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
25
+
26
+ GeneralNames = rfc5280.GeneralNames
27
+
28
+
29
+ # Imports from RFC 4055
30
+
31
+ id_sha1 = rfc4055.id_sha1
32
+
33
+
34
+ # Imports from RFC 5055
35
+ # These are defined here because a module for RFC 5055 does not exist yet
36
+
37
+ class SCVPIssuerSerial(univ.Sequence):
38
+ componentType = namedtype.NamedTypes(
39
+ namedtype.NamedType('issuer', GeneralNames()),
40
+ namedtype.NamedType('serialNumber', CertificateSerialNumber())
41
+ )
42
+
43
+
44
+ sha1_alg_id = AlgorithmIdentifier()
45
+ sha1_alg_id['algorithm'] = id_sha1
46
+
47
+
48
+ class SCVPCertID(univ.Sequence):
49
+ componentType = namedtype.NamedTypes(
50
+ namedtype.NamedType('certHash', univ.OctetString()),
51
+ namedtype.NamedType('issuerSerial', SCVPIssuerSerial()),
52
+ namedtype.DefaultedNamedType('hashAlgorithm', sha1_alg_id)
53
+ )
54
+
55
+
56
+ # Other Certificates Extension
57
+
58
+ id_pe_otherCerts = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 1, 19,))
59
+
60
+ class OtherCertificates(univ.SequenceOf):
61
+ componentType = SCVPCertID()
62
+
63
+
64
+ # Update of certificate extension map in rfc5280.py
65
+
66
+ _certificateExtensionsMapUpdate = {
67
+ id_pe_otherCerts: OtherCertificates(),
68
+ }
69
+
70
+ rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5751.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is being contributed to pyasn1-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
4
+ #
5
+ # Copyright (c) 2019, Vigil Security, LLC
6
+ # License: http://snmplabs.com/pyasn1/license.html
7
+ #
8
+ # S/MIME Version 3.2 Message Specification
9
+ #
10
+ # ASN.1 source from:
11
+ # https://www.rfc-editor.org/rfc/rfc5751.txt
12
+
13
+ from pyasn1.type import namedtype
14
+ from pyasn1.type import opentype
15
+ from pyasn1.type import tag
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_modules import rfc5652
19
+ from pyasn1_modules import rfc8018
20
+
21
+
22
+ def _OID(*components):
23
+ output = []
24
+ for x in tuple(components):
25
+ if isinstance(x, univ.ObjectIdentifier):
26
+ output.extend(list(x))
27
+ else:
28
+ output.append(int(x))
29
+ return univ.ObjectIdentifier(output)
30
+
31
+
32
+ # Imports from RFC 5652 and RFC 8018
33
+
34
+ IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber
35
+
36
+ RecipientKeyIdentifier = rfc5652.RecipientKeyIdentifier
37
+
38
+ SubjectKeyIdentifier = rfc5652.SubjectKeyIdentifier
39
+
40
+ rc2CBC = rfc8018.rc2CBC
41
+
42
+
43
+ # S/MIME Capabilities Attribute
44
+
45
+ smimeCapabilities = univ.ObjectIdentifier('1.2.840.113549.1.9.15')
46
+
47
+
48
+ smimeCapabilityMap = { }
49
+
50
+
51
+ class SMIMECapability(univ.Sequence):
52
+ pass
53
+
54
+ SMIMECapability.componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('capabilityID', univ.ObjectIdentifier()),
56
+ namedtype.OptionalNamedType('parameters', univ.Any(),
57
+ openType=opentype.OpenType('capabilityID', smimeCapabilityMap))
58
+ )
59
+
60
+
61
+ class SMIMECapabilities(univ.SequenceOf):
62
+ pass
63
+
64
+ SMIMECapabilities.componentType = SMIMECapability()
65
+
66
+
67
+ class SMIMECapabilitiesParametersForRC2CBC(univ.Integer):
68
+ # which carries the RC2 Key Length (number of bits)
69
+ pass
70
+
71
+
72
+ # S/MIME Encryption Key Preference Attribute
73
+
74
+ id_smime = univ.ObjectIdentifier('1.2.840.113549.1.9.16')
75
+
76
+ id_aa = _OID(id_smime, 2)
77
+
78
+ id_aa_encrypKeyPref = _OID(id_aa, 11)
79
+
80
+
81
+ class SMIMEEncryptionKeyPreference(univ.Choice):
82
+ pass
83
+
84
+ SMIMEEncryptionKeyPreference.componentType = namedtype.NamedTypes(
85
+ namedtype.NamedType('issuerAndSerialNumber',
86
+ IssuerAndSerialNumber().subtype(implicitTag=tag.Tag(
87
+ tag.tagClassContext, tag.tagFormatSimple, 0))),
88
+ namedtype.NamedType('receipentKeyId',
89
+ # Yes, 'receipentKeyId' is spelled incorrectly, but kept
90
+ # this way for alignment with the ASN.1 module in the RFC.
91
+ RecipientKeyIdentifier().subtype(implicitTag=tag.Tag(
92
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
93
+ namedtype.NamedType('subjectAltKeyIdentifier',
94
+ SubjectKeyIdentifier().subtype(implicitTag=tag.Tag(
95
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
96
+ )
97
+
98
+
99
+ # The Prefer Binary Inside SMIMECapabilities attribute
100
+
101
+ id_cap = _OID(id_smime, 11)
102
+
103
+ id_cap_preferBinaryInside = _OID(id_cap, 1)
104
+
105
+
106
+ # CMS Attribute Map
107
+
108
+ _cmsAttributesMapUpdate = {
109
+ smimeCapabilities: SMIMECapabilities(),
110
+ id_aa_encrypKeyPref: SMIMEEncryptionKeyPreference(),
111
+ }
112
+
113
+ rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
114
+
115
+
116
+ # SMIMECapabilities Attribute Map
117
+ #
118
+ # Do not include OIDs in the dictionary when the parameters are absent.
119
+
120
+ _smimeCapabilityMapUpdate = {
121
+ rc2CBC: SMIMECapabilitiesParametersForRC2CBC(),
122
+ }
123
+
124
+ smimeCapabilityMap.update(_smimeCapabilityMapUpdate)