pyasn1-alt-modules 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyasn1-alt-modules might be problematic. Click here for more details.

Files changed (195) hide show
  1. pyasn1_alt_modules/__init__.py +2 -0
  2. pyasn1_alt_modules/opentypemap.py +19 -0
  3. pyasn1_alt_modules/pem.py +66 -0
  4. pyasn1_alt_modules/rfc1155.py +97 -0
  5. pyasn1_alt_modules/rfc1157.py +127 -0
  6. pyasn1_alt_modules/rfc1901.py +23 -0
  7. pyasn1_alt_modules/rfc1902.py +130 -0
  8. pyasn1_alt_modules/rfc1905.py +136 -0
  9. pyasn1_alt_modules/rfc2040.py +50 -0
  10. pyasn1_alt_modules/rfc2251.py +564 -0
  11. pyasn1_alt_modules/rfc2314.py +68 -0
  12. pyasn1_alt_modules/rfc2315.py +325 -0
  13. pyasn1_alt_modules/rfc2437.py +70 -0
  14. pyasn1_alt_modules/rfc2459.py +1340 -0
  15. pyasn1_alt_modules/rfc2511.py +303 -0
  16. pyasn1_alt_modules/rfc2528.py +34 -0
  17. pyasn1_alt_modules/rfc2560.py +226 -0
  18. pyasn1_alt_modules/rfc2631.py +37 -0
  19. pyasn1_alt_modules/rfc2634.py +342 -0
  20. pyasn1_alt_modules/rfc2743.py +60 -0
  21. pyasn1_alt_modules/rfc2876.py +61 -0
  22. pyasn1_alt_modules/rfc2898.py +72 -0
  23. pyasn1_alt_modules/rfc2985.py +593 -0
  24. pyasn1_alt_modules/rfc2986.py +76 -0
  25. pyasn1_alt_modules/rfc3058.py +48 -0
  26. pyasn1_alt_modules/rfc3114.py +80 -0
  27. pyasn1_alt_modules/rfc3125.py +469 -0
  28. pyasn1_alt_modules/rfc3161.py +142 -0
  29. pyasn1_alt_modules/rfc3217.py +42 -0
  30. pyasn1_alt_modules/rfc3274.py +62 -0
  31. pyasn1_alt_modules/rfc3279.py +264 -0
  32. pyasn1_alt_modules/rfc3280.py +1544 -0
  33. pyasn1_alt_modules/rfc3281.py +332 -0
  34. pyasn1_alt_modules/rfc3370.py +142 -0
  35. pyasn1_alt_modules/rfc3412.py +54 -0
  36. pyasn1_alt_modules/rfc3414.py +29 -0
  37. pyasn1_alt_modules/rfc3447.py +46 -0
  38. pyasn1_alt_modules/rfc3537.py +44 -0
  39. pyasn1_alt_modules/rfc3546.py +23 -0
  40. pyasn1_alt_modules/rfc3560.py +74 -0
  41. pyasn1_alt_modules/rfc3565.py +59 -0
  42. pyasn1_alt_modules/rfc3657.py +69 -0
  43. pyasn1_alt_modules/rfc3709.py +230 -0
  44. pyasn1_alt_modules/rfc3739.py +207 -0
  45. pyasn1_alt_modules/rfc3770.py +77 -0
  46. pyasn1_alt_modules/rfc3779.py +139 -0
  47. pyasn1_alt_modules/rfc3820.py +66 -0
  48. pyasn1_alt_modules/rfc3852.py +707 -0
  49. pyasn1_alt_modules/rfc3874.py +29 -0
  50. pyasn1_alt_modules/rfc4010.py +58 -0
  51. pyasn1_alt_modules/rfc4043.py +45 -0
  52. pyasn1_alt_modules/rfc4055.py +285 -0
  53. pyasn1_alt_modules/rfc4056.py +56 -0
  54. pyasn1_alt_modules/rfc4059.py +101 -0
  55. pyasn1_alt_modules/rfc4073.py +62 -0
  56. pyasn1_alt_modules/rfc4108.py +355 -0
  57. pyasn1_alt_modules/rfc4210.py +807 -0
  58. pyasn1_alt_modules/rfc4211.py +420 -0
  59. pyasn1_alt_modules/rfc4231.py +38 -0
  60. pyasn1_alt_modules/rfc4262.py +37 -0
  61. pyasn1_alt_modules/rfc4334.py +78 -0
  62. pyasn1_alt_modules/rfc4357.py +485 -0
  63. pyasn1_alt_modules/rfc4366.py +23 -0
  64. pyasn1_alt_modules/rfc4387.py +23 -0
  65. pyasn1_alt_modules/rfc4476.py +99 -0
  66. pyasn1_alt_modules/rfc4490.py +119 -0
  67. pyasn1_alt_modules/rfc4491.py +44 -0
  68. pyasn1_alt_modules/rfc4683.py +76 -0
  69. pyasn1_alt_modules/rfc4985.py +52 -0
  70. pyasn1_alt_modules/rfc4998.py +125 -0
  71. pyasn1_alt_modules/rfc5035.py +206 -0
  72. pyasn1_alt_modules/rfc5055.py +763 -0
  73. pyasn1_alt_modules/rfc5083.py +55 -0
  74. pyasn1_alt_modules/rfc5084.py +94 -0
  75. pyasn1_alt_modules/rfc5126.py +578 -0
  76. pyasn1_alt_modules/rfc5208.py +73 -0
  77. pyasn1_alt_modules/rfc5275.py +404 -0
  78. pyasn1_alt_modules/rfc5276.py +82 -0
  79. pyasn1_alt_modules/rfc5280.py +1666 -0
  80. pyasn1_alt_modules/rfc5480.py +190 -0
  81. pyasn1_alt_modules/rfc5544.py +127 -0
  82. pyasn1_alt_modules/rfc5636.py +117 -0
  83. pyasn1_alt_modules/rfc5639.py +49 -0
  84. pyasn1_alt_modules/rfc5649.py +33 -0
  85. pyasn1_alt_modules/rfc5652.py +763 -0
  86. pyasn1_alt_modules/rfc5697.py +64 -0
  87. pyasn1_alt_modules/rfc5698.py +159 -0
  88. pyasn1_alt_modules/rfc5751.py +127 -0
  89. pyasn1_alt_modules/rfc5752.py +52 -0
  90. pyasn1_alt_modules/rfc5753.py +163 -0
  91. pyasn1_alt_modules/rfc5755.py +400 -0
  92. pyasn1_alt_modules/rfc5913.py +46 -0
  93. pyasn1_alt_modules/rfc5914.py +119 -0
  94. pyasn1_alt_modules/rfc5915.py +32 -0
  95. pyasn1_alt_modules/rfc5916.py +39 -0
  96. pyasn1_alt_modules/rfc5917.py +59 -0
  97. pyasn1_alt_modules/rfc5924.py +19 -0
  98. pyasn1_alt_modules/rfc5934.py +786 -0
  99. pyasn1_alt_modules/rfc5940.py +62 -0
  100. pyasn1_alt_modules/rfc5958.py +100 -0
  101. pyasn1_alt_modules/rfc5990.py +238 -0
  102. pyasn1_alt_modules/rfc6010.py +92 -0
  103. pyasn1_alt_modules/rfc6019.py +46 -0
  104. pyasn1_alt_modules/rfc6031.py +469 -0
  105. pyasn1_alt_modules/rfc6032.py +71 -0
  106. pyasn1_alt_modules/rfc6066.py +25 -0
  107. pyasn1_alt_modules/rfc6120.py +46 -0
  108. pyasn1_alt_modules/rfc6170.py +17 -0
  109. pyasn1_alt_modules/rfc6187.py +22 -0
  110. pyasn1_alt_modules/rfc6210.py +45 -0
  111. pyasn1_alt_modules/rfc6211.py +75 -0
  112. pyasn1_alt_modules/rfc6402.py +643 -0
  113. pyasn1_alt_modules/rfc6482.py +77 -0
  114. pyasn1_alt_modules/rfc6484.py +17 -0
  115. pyasn1_alt_modules/rfc6486.py +70 -0
  116. pyasn1_alt_modules/rfc6487.py +22 -0
  117. pyasn1_alt_modules/rfc6492.py +41 -0
  118. pyasn1_alt_modules/rfc6493.py +24 -0
  119. pyasn1_alt_modules/rfc6494.py +23 -0
  120. pyasn1_alt_modules/rfc6664.py +151 -0
  121. pyasn1_alt_modules/rfc6955.py +112 -0
  122. pyasn1_alt_modules/rfc6960.py +234 -0
  123. pyasn1_alt_modules/rfc6962.py +52 -0
  124. pyasn1_alt_modules/rfc7030.py +70 -0
  125. pyasn1_alt_modules/rfc7191.py +267 -0
  126. pyasn1_alt_modules/rfc7229.py +29 -0
  127. pyasn1_alt_modules/rfc7292.py +359 -0
  128. pyasn1_alt_modules/rfc7296.py +32 -0
  129. pyasn1_alt_modules/rfc7508.py +92 -0
  130. pyasn1_alt_modules/rfc7585.py +53 -0
  131. pyasn1_alt_modules/rfc7633.py +40 -0
  132. pyasn1_alt_modules/rfc7693.py +66 -0
  133. pyasn1_alt_modules/rfc7773.py +54 -0
  134. pyasn1_alt_modules/rfc7836.py +65 -0
  135. pyasn1_alt_modules/rfc7894.py +100 -0
  136. pyasn1_alt_modules/rfc7906.py +739 -0
  137. pyasn1_alt_modules/rfc7914.py +55 -0
  138. pyasn1_alt_modules/rfc8017.py +159 -0
  139. pyasn1_alt_modules/rfc8018.py +269 -0
  140. pyasn1_alt_modules/rfc8103.py +36 -0
  141. pyasn1_alt_modules/rfc8209.py +20 -0
  142. pyasn1_alt_modules/rfc8226.py +151 -0
  143. pyasn1_alt_modules/rfc8358.py +54 -0
  144. pyasn1_alt_modules/rfc8360.py +46 -0
  145. pyasn1_alt_modules/rfc8398.py +55 -0
  146. pyasn1_alt_modules/rfc8410.py +43 -0
  147. pyasn1_alt_modules/rfc8418.py +36 -0
  148. pyasn1_alt_modules/rfc8419.py +70 -0
  149. pyasn1_alt_modules/rfc8479.py +48 -0
  150. pyasn1_alt_modules/rfc8494.py +80 -0
  151. pyasn1_alt_modules/rfc8520.py +66 -0
  152. pyasn1_alt_modules/rfc8619.py +45 -0
  153. pyasn1_alt_modules/rfc8649.py +42 -0
  154. pyasn1_alt_modules/rfc8692.py +79 -0
  155. pyasn1_alt_modules/rfc8696.py +108 -0
  156. pyasn1_alt_modules/rfc8702.py +109 -0
  157. pyasn1_alt_modules/rfc8708.py +43 -0
  158. pyasn1_alt_modules/rfc8737.py +36 -0
  159. pyasn1_alt_modules/rfc8769.py +21 -0
  160. pyasn1_alt_modules/rfc8894.py +52 -0
  161. pyasn1_alt_modules/rfc8951.py +42 -0
  162. pyasn1_alt_modules/rfc8954.py +238 -0
  163. pyasn1_alt_modules/rfc8994.py +52 -0
  164. pyasn1_alt_modules/rfc8995.py +39 -0
  165. pyasn1_alt_modules/rfc9044.py +80 -0
  166. pyasn1_alt_modules/rfc9092.py +35 -0
  167. pyasn1_alt_modules/rfc9118.py +82 -0
  168. pyasn1_alt_modules/rfc9174.py +55 -0
  169. pyasn1_alt_modules/rfc9189.py +74 -0
  170. pyasn1_alt_modules/rfc9215.py +228 -0
  171. pyasn1_alt_modules/rfc9286.py +78 -0
  172. pyasn1_alt_modules/rfc9289.py +22 -0
  173. pyasn1_alt_modules/rfc9310.py +46 -0
  174. pyasn1_alt_modules/rfc9323.py +129 -0
  175. pyasn1_alt_modules/rfc9336.py +20 -0
  176. pyasn1_alt_modules/rfc9337.py +74 -0
  177. pyasn1_alt_modules/rfc9345.py +36 -0
  178. pyasn1_alt_modules/rfc9385.py +22 -0
  179. pyasn1_alt_modules/rfc9399.py +59 -0
  180. pyasn1_alt_modules/rfc9480.py +731 -0
  181. pyasn1_alt_modules/rfc9481.py +224 -0
  182. pyasn1_alt_modules/rfc9509.py +24 -0
  183. pyasn1_alt_modules/rfc9548.py +23 -0
  184. pyasn1_alt_modules/rfc9579.py +89 -0
  185. pyasn1_alt_modules/rfc9582.py +107 -0
  186. pyasn1_alt_modules/rfc9598.py +52 -0
  187. pyasn1_alt_modules/rfc9608.py +35 -0
  188. pyasn1_alt_modules/rfc9629.py +100 -0
  189. pyasn1_alt_modules/rfc9654.py +241 -0
  190. pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
  191. pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
  192. pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
  193. pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
  194. pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
  195. pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
@@ -0,0 +1,1340 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Updated by Russ Housley to resolve the TODO regarding the Certificate
5
+ # Policies Certificate Extension.
6
+ #
7
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
8
+ # Copyright (c) 2021-2024, Vigil Security, LLC
9
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
10
+ #
11
+ # X.509 message syntax
12
+ #
13
+ # ASN.1 source from:
14
+ # http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/x509.asn
15
+ # http://www.ietf.org/rfc/rfc2459.txt
16
+ #
17
+ # Sample captures from:
18
+ # http://wiki.wireshark.org/SampleCaptures/
19
+ #
20
+ from pyasn1.type import char
21
+ from pyasn1.type import constraint
22
+ from pyasn1.type import namedtype
23
+ from pyasn1.type import namedval
24
+ from pyasn1.type import opentype
25
+ from pyasn1.type import tag
26
+ from pyasn1.type import univ
27
+ from pyasn1.type import useful
28
+
29
+ MAX = float('inf')
30
+
31
+ #
32
+ # PKIX1Explicit88
33
+ #
34
+
35
+ # Upper Bounds
36
+ ub_name = univ.Integer(32768)
37
+ ub_common_name = univ.Integer(64)
38
+ ub_locality_name = univ.Integer(128)
39
+ ub_state_name = univ.Integer(128)
40
+ ub_organization_name = univ.Integer(64)
41
+ ub_organizational_unit_name = univ.Integer(64)
42
+ ub_title = univ.Integer(64)
43
+ ub_match = univ.Integer(128)
44
+ ub_emailaddress_length = univ.Integer(128)
45
+ ub_common_name_length = univ.Integer(64)
46
+ ub_country_name_alpha_length = univ.Integer(2)
47
+ ub_country_name_numeric_length = univ.Integer(3)
48
+ ub_domain_defined_attributes = univ.Integer(4)
49
+ ub_domain_defined_attribute_type_length = univ.Integer(8)
50
+ ub_domain_defined_attribute_value_length = univ.Integer(128)
51
+ ub_domain_name_length = univ.Integer(16)
52
+ ub_extension_attributes = univ.Integer(256)
53
+ ub_e163_4_number_length = univ.Integer(15)
54
+ ub_e163_4_sub_address_length = univ.Integer(40)
55
+ ub_generation_qualifier_length = univ.Integer(3)
56
+ ub_given_name_length = univ.Integer(16)
57
+ ub_initials_length = univ.Integer(5)
58
+ ub_integer_options = univ.Integer(256)
59
+ ub_numeric_user_id_length = univ.Integer(32)
60
+ ub_organization_name_length = univ.Integer(64)
61
+ ub_organizational_unit_name_length = univ.Integer(32)
62
+ ub_organizational_units = univ.Integer(4)
63
+ ub_pds_name_length = univ.Integer(16)
64
+ ub_pds_parameter_length = univ.Integer(30)
65
+ ub_pds_physical_address_lines = univ.Integer(6)
66
+ ub_postal_code_length = univ.Integer(16)
67
+ ub_surname_length = univ.Integer(40)
68
+ ub_terminal_id_length = univ.Integer(24)
69
+ ub_unformatted_address_length = univ.Integer(180)
70
+ ub_x121_address_length = univ.Integer(16)
71
+
72
+
73
+ class UniversalString(char.UniversalString):
74
+ pass
75
+
76
+
77
+ class BMPString(char.BMPString):
78
+ pass
79
+
80
+
81
+ class UTF8String(char.UTF8String):
82
+ pass
83
+
84
+
85
+ id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
86
+ id_pe = univ.ObjectIdentifier('1.3.6.1.5.5.7.1')
87
+ id_qt = univ.ObjectIdentifier('1.3.6.1.5.5.7.2')
88
+ id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
89
+ id_ad = univ.ObjectIdentifier('1.3.6.1.5.5.7.48')
90
+
91
+ id_qt_cps = univ.ObjectIdentifier('1.3.6.1.5.5.7.2.1')
92
+ id_qt_unotice = univ.ObjectIdentifier('1.3.6.1.5.5.7.2.2')
93
+
94
+ id_ad_ocsp = univ.ObjectIdentifier('1.3.6.1.5.5.7.48.1')
95
+ id_ad_caIssuers = univ.ObjectIdentifier('1.3.6.1.5.5.7.48.2')
96
+
97
+
98
+
99
+
100
+ id_at = univ.ObjectIdentifier('2.5.4')
101
+ id_at_name = univ.ObjectIdentifier('2.5.4.41')
102
+ # preserve misspelled variable for compatibility
103
+ id_at_sutname = id_at_surname = univ.ObjectIdentifier('2.5.4.4')
104
+ id_at_givenName = univ.ObjectIdentifier('2.5.4.42')
105
+ id_at_initials = univ.ObjectIdentifier('2.5.4.43')
106
+ id_at_generationQualifier = univ.ObjectIdentifier('2.5.4.44')
107
+
108
+
109
+ class X520name(univ.Choice):
110
+ componentType = namedtype.NamedTypes(
111
+ namedtype.NamedType('teletexString',
112
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
113
+ namedtype.NamedType('printableString',
114
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
115
+ namedtype.NamedType('universalString',
116
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
117
+ namedtype.NamedType('utf8String',
118
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
119
+ namedtype.NamedType('bmpString',
120
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name)))
121
+ )
122
+
123
+
124
+ id_at_commonName = univ.ObjectIdentifier('2.5.4.3')
125
+
126
+
127
+ class X520CommonName(univ.Choice):
128
+ componentType = namedtype.NamedTypes(
129
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
130
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
131
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
132
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
133
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
134
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
135
+ namedtype.NamedType('utf8String',
136
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
137
+ namedtype.NamedType('bmpString',
138
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name)))
139
+ )
140
+
141
+
142
+ id_at_localityName = univ.ObjectIdentifier('2.5.4.7')
143
+
144
+
145
+ class X520LocalityName(univ.Choice):
146
+ componentType = namedtype.NamedTypes(
147
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
148
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
149
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
150
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
151
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
152
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
153
+ namedtype.NamedType('utf8String',
154
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
155
+ namedtype.NamedType('bmpString',
156
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name)))
157
+ )
158
+
159
+
160
+ id_at_stateOrProvinceName = univ.ObjectIdentifier('2.5.4.8')
161
+
162
+
163
+ class X520StateOrProvinceName(univ.Choice):
164
+ componentType = namedtype.NamedTypes(
165
+ namedtype.NamedType('teletexString',
166
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
167
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
168
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
169
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
170
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
171
+ namedtype.NamedType('utf8String',
172
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
173
+ namedtype.NamedType('bmpString',
174
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name)))
175
+ )
176
+
177
+
178
+ id_at_organizationName = univ.ObjectIdentifier('2.5.4.10')
179
+
180
+
181
+ class X520OrganizationName(univ.Choice):
182
+ componentType = namedtype.NamedTypes(
183
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
184
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
185
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
186
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
187
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
188
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
189
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
190
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
191
+ namedtype.NamedType('bmpString', char.BMPString().subtype(
192
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name)))
193
+ )
194
+
195
+
196
+ id_at_organizationalUnitName = univ.ObjectIdentifier('2.5.4.11')
197
+
198
+
199
+ class X520OrganizationalUnitName(univ.Choice):
200
+ componentType = namedtype.NamedTypes(
201
+ namedtype.NamedType('teletexString', char.TeletexString().subtype(
202
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
203
+ namedtype.NamedType('printableString', char.PrintableString().subtype(
204
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
205
+ namedtype.NamedType('universalString', char.UniversalString().subtype(
206
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
207
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(
208
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
209
+ namedtype.NamedType('bmpString', char.BMPString().subtype(
210
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name)))
211
+ )
212
+
213
+
214
+ id_at_title = univ.ObjectIdentifier('2.5.4.12')
215
+
216
+
217
+ class X520Title(univ.Choice):
218
+ componentType = namedtype.NamedTypes(
219
+ namedtype.NamedType('teletexString',
220
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
221
+ namedtype.NamedType('printableString',
222
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
223
+ namedtype.NamedType('universalString',
224
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
225
+ namedtype.NamedType('utf8String',
226
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
227
+ namedtype.NamedType('bmpString',
228
+ char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title)))
229
+ )
230
+
231
+
232
+ id_at_dnQualifier = univ.ObjectIdentifier('2.5.4.46')
233
+
234
+
235
+ class X520dnQualifier(char.PrintableString):
236
+ pass
237
+
238
+
239
+ id_at_countryName = univ.ObjectIdentifier('2.5.4.6')
240
+
241
+
242
+ class X520countryName(char.PrintableString):
243
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(2, 2)
244
+
245
+
246
+ pkcs_9 = univ.ObjectIdentifier('1.2.840.113549.1.9')
247
+
248
+ emailAddress = univ.ObjectIdentifier('1.2.840.113549.1.9.1')
249
+
250
+
251
+ class Pkcs9email(char.IA5String):
252
+ subtypeSpec = char.IA5String.subtypeSpec + constraint.ValueSizeConstraint(1, ub_emailaddress_length)
253
+
254
+
255
+ # ----
256
+
257
+ class DSAPrivateKey(univ.Sequence):
258
+ """PKIX compliant DSA private key structure"""
259
+ componentType = namedtype.NamedTypes(
260
+ namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('v1', 0)))),
261
+ namedtype.NamedType('p', univ.Integer()),
262
+ namedtype.NamedType('q', univ.Integer()),
263
+ namedtype.NamedType('g', univ.Integer()),
264
+ namedtype.NamedType('public', univ.Integer()),
265
+ namedtype.NamedType('private', univ.Integer())
266
+ )
267
+
268
+
269
+ # ----
270
+
271
+
272
+ class DirectoryString(univ.Choice):
273
+ componentType = namedtype.NamedTypes(
274
+ namedtype.NamedType('teletexString',
275
+ char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
276
+ namedtype.NamedType('printableString',
277
+ char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
278
+ namedtype.NamedType('universalString',
279
+ char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
280
+ namedtype.NamedType('utf8String',
281
+ char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
282
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
283
+ namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
284
+ # hm, this should not be here!? XXX
285
+ )
286
+
287
+
288
+ # certificate and CRL specific structures begin here
289
+
290
+ class AlgorithmIdentifier(univ.Sequence):
291
+ componentType = namedtype.NamedTypes(
292
+ namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
293
+ namedtype.OptionalNamedType('parameters', univ.Any())
294
+ )
295
+
296
+
297
+
298
+ # Algorithm OIDs and parameter structures
299
+
300
+ pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
301
+ rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
302
+ md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
303
+ md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
304
+ sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
305
+ id_dsa_with_sha1 = univ.ObjectIdentifier('1.2.840.10040.4.3')
306
+
307
+
308
+ class Dss_Sig_Value(univ.Sequence):
309
+ componentType = namedtype.NamedTypes(
310
+ namedtype.NamedType('r', univ.Integer()),
311
+ namedtype.NamedType('s', univ.Integer())
312
+ )
313
+
314
+
315
+ dhpublicnumber = univ.ObjectIdentifier('1.2.840.10046.2.1')
316
+
317
+
318
+ class ValidationParms(univ.Sequence):
319
+ componentType = namedtype.NamedTypes(
320
+ namedtype.NamedType('seed', univ.BitString()),
321
+ namedtype.NamedType('pgenCounter', univ.Integer())
322
+ )
323
+
324
+
325
+ class DomainParameters(univ.Sequence):
326
+ componentType = namedtype.NamedTypes(
327
+ namedtype.NamedType('p', univ.Integer()),
328
+ namedtype.NamedType('g', univ.Integer()),
329
+ namedtype.NamedType('q', univ.Integer()),
330
+ namedtype.NamedType('j', univ.Integer()),
331
+ namedtype.OptionalNamedType('validationParms', ValidationParms())
332
+ )
333
+
334
+
335
+ id_dsa = univ.ObjectIdentifier('1.2.840.10040.4.1')
336
+
337
+
338
+ class Dss_Parms(univ.Sequence):
339
+ componentType = namedtype.NamedTypes(
340
+ namedtype.NamedType('p', univ.Integer()),
341
+ namedtype.NamedType('q', univ.Integer()),
342
+ namedtype.NamedType('g', univ.Integer())
343
+ )
344
+
345
+
346
+ # x400 address syntax starts here
347
+
348
+ teletex_domain_defined_attributes = univ.Integer(6)
349
+
350
+
351
+ class TeletexDomainDefinedAttribute(univ.Sequence):
352
+ componentType = namedtype.NamedTypes(
353
+ namedtype.NamedType('type', char.TeletexString().subtype(
354
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
355
+ namedtype.NamedType('value', char.TeletexString())
356
+ )
357
+
358
+
359
+ class TeletexDomainDefinedAttributes(univ.SequenceOf):
360
+ componentType = TeletexDomainDefinedAttribute()
361
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
362
+
363
+
364
+ terminal_type = univ.Integer(23)
365
+
366
+
367
+ class TerminalType(univ.Integer):
368
+ subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, ub_integer_options)
369
+ namedValues = namedval.NamedValues(
370
+ ('telex', 3),
371
+ ('teletelex', 4),
372
+ ('g3-facsimile', 5),
373
+ ('g4-facsimile', 6),
374
+ ('ia5-terminal', 7),
375
+ ('videotex', 8)
376
+ )
377
+
378
+
379
+ class PresentationAddress(univ.Sequence):
380
+ componentType = namedtype.NamedTypes(
381
+ namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
382
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
383
+ namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
384
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
385
+ namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
386
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
387
+ namedtype.OptionalNamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
388
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3),
389
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
390
+ )
391
+
392
+
393
+ extended_network_address = univ.Integer(22)
394
+
395
+
396
+ class E163_4_address(univ.Sequence):
397
+ componentType = namedtype.NamedTypes(
398
+ namedtype.NamedType('number', char.NumericString().subtype(
399
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length),
400
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
401
+ namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(
402
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length),
403
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
404
+ )
405
+
406
+
407
+ class ExtendedNetworkAddress(univ.Choice):
408
+ componentType = namedtype.NamedTypes(
409
+ namedtype.NamedType('e163-4-address', E163_4_address()),
410
+ namedtype.NamedType('psap-address', PresentationAddress().subtype(
411
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
412
+ )
413
+
414
+
415
+ class PDSParameter(univ.Set):
416
+ componentType = namedtype.NamedTypes(
417
+ namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype(
418
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))),
419
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
420
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))
421
+ )
422
+
423
+
424
+ local_postal_attributes = univ.Integer(21)
425
+
426
+
427
+ class LocalPostalAttributes(PDSParameter):
428
+ pass
429
+
430
+
431
+ class UniquePostalName(PDSParameter):
432
+ pass
433
+
434
+
435
+ unique_postal_name = univ.Integer(20)
436
+
437
+ poste_restante_address = univ.Integer(19)
438
+
439
+
440
+ class PosteRestanteAddress(PDSParameter):
441
+ pass
442
+
443
+
444
+ post_office_box_address = univ.Integer(18)
445
+
446
+
447
+ class PostOfficeBoxAddress(PDSParameter):
448
+ pass
449
+
450
+
451
+ street_address = univ.Integer(17)
452
+
453
+
454
+ class StreetAddress(PDSParameter):
455
+ pass
456
+
457
+
458
+ class UnformattedPostalAddress(univ.Set):
459
+ componentType = namedtype.NamedTypes(
460
+ namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype(
461
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)).subtype(
462
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_physical_address_lines)))),
463
+ namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
464
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length)))
465
+ )
466
+
467
+
468
+ physical_delivery_office_name = univ.Integer(10)
469
+
470
+
471
+ class PhysicalDeliveryOfficeName(PDSParameter):
472
+ pass
473
+
474
+
475
+ physical_delivery_office_number = univ.Integer(11)
476
+
477
+
478
+ class PhysicalDeliveryOfficeNumber(PDSParameter):
479
+ pass
480
+
481
+
482
+ extension_OR_address_components = univ.Integer(12)
483
+
484
+
485
+ class ExtensionORAddressComponents(PDSParameter):
486
+ pass
487
+
488
+
489
+ physical_delivery_personal_name = univ.Integer(13)
490
+
491
+
492
+ class PhysicalDeliveryPersonalName(PDSParameter):
493
+ pass
494
+
495
+
496
+ physical_delivery_organization_name = univ.Integer(14)
497
+
498
+
499
+ class PhysicalDeliveryOrganizationName(PDSParameter):
500
+ pass
501
+
502
+
503
+ extension_physical_delivery_address_components = univ.Integer(15)
504
+
505
+
506
+ class ExtensionPhysicalDeliveryAddressComponents(PDSParameter):
507
+ pass
508
+
509
+
510
+ unformatted_postal_address = univ.Integer(16)
511
+
512
+ postal_code = univ.Integer(9)
513
+
514
+
515
+ class PostalCode(univ.Choice):
516
+ componentType = namedtype.NamedTypes(
517
+ namedtype.NamedType('numeric-code', char.NumericString().subtype(
518
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))),
519
+ namedtype.NamedType('printable-code', char.PrintableString().subtype(
520
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length)))
521
+ )
522
+
523
+
524
+ class PhysicalDeliveryCountryName(univ.Choice):
525
+ componentType = namedtype.NamedTypes(
526
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
527
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length,
528
+ ub_country_name_numeric_length))),
529
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
530
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
531
+ )
532
+
533
+
534
+ class PDSName(char.PrintableString):
535
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_pds_name_length)
536
+
537
+
538
+ physical_delivery_country_name = univ.Integer(8)
539
+
540
+
541
+ class TeletexOrganizationalUnitName(char.TeletexString):
542
+ subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
543
+
544
+
545
+ pds_name = univ.Integer(7)
546
+
547
+ teletex_organizational_unit_names = univ.Integer(5)
548
+
549
+
550
+ class TeletexOrganizationalUnitNames(univ.SequenceOf):
551
+ componentType = TeletexOrganizationalUnitName()
552
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_organizational_units)
553
+
554
+
555
+ teletex_personal_name = univ.Integer(4)
556
+
557
+
558
+ class TeletexPersonalName(univ.Set):
559
+ componentType = namedtype.NamedTypes(
560
+ namedtype.NamedType('surname', char.TeletexString().subtype(
561
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length),
562
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
563
+ namedtype.OptionalNamedType('given-name', char.TeletexString().subtype(
564
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length),
565
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
566
+ namedtype.OptionalNamedType('initials', char.TeletexString().subtype(
567
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length),
568
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
569
+ namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype(
570
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length),
571
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
572
+ )
573
+
574
+
575
+ teletex_organization_name = univ.Integer(3)
576
+
577
+
578
+ class TeletexOrganizationName(char.TeletexString):
579
+ subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organization_name_length)
580
+
581
+
582
+ teletex_common_name = univ.Integer(2)
583
+
584
+
585
+ class TeletexCommonName(char.TeletexString):
586
+ subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_common_name_length)
587
+
588
+
589
+ class CommonName(char.PrintableString):
590
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_common_name_length)
591
+
592
+
593
+ common_name = univ.Integer(1)
594
+
595
+
596
+ class ExtensionAttribute(univ.Sequence):
597
+ componentType = namedtype.NamedTypes(
598
+ namedtype.NamedType('extension-attribute-type', univ.Integer().subtype(
599
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_extension_attributes),
600
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
601
+ namedtype.NamedType('extension-attribute-value',
602
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
603
+ )
604
+
605
+
606
+ class ExtensionAttributes(univ.SetOf):
607
+ componentType = ExtensionAttribute()
608
+ sizeSpec = univ.SetOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_extension_attributes)
609
+
610
+
611
+ class BuiltInDomainDefinedAttribute(univ.Sequence):
612
+ componentType = namedtype.NamedTypes(
613
+ namedtype.NamedType('type', char.PrintableString().subtype(
614
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
615
+ namedtype.NamedType('value', char.PrintableString().subtype(
616
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
617
+ )
618
+
619
+
620
+ class BuiltInDomainDefinedAttributes(univ.SequenceOf):
621
+ componentType = BuiltInDomainDefinedAttribute()
622
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
623
+
624
+
625
+ class OrganizationalUnitName(char.PrintableString):
626
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
627
+
628
+
629
+ class OrganizationalUnitNames(univ.SequenceOf):
630
+ componentType = OrganizationalUnitName()
631
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_organizational_units)
632
+
633
+
634
+ class PersonalName(univ.Set):
635
+ componentType = namedtype.NamedTypes(
636
+ namedtype.NamedType('surname', char.PrintableString().subtype(
637
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length),
638
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
639
+ namedtype.OptionalNamedType('given-name', char.PrintableString().subtype(
640
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length),
641
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
642
+ namedtype.OptionalNamedType('initials', char.PrintableString().subtype(
643
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length),
644
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
645
+ namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype(
646
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length),
647
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
648
+ )
649
+
650
+
651
+ class NumericUserIdentifier(char.NumericString):
652
+ subtypeSpec = char.NumericString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_numeric_user_id_length)
653
+
654
+
655
+ class OrganizationName(char.PrintableString):
656
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organization_name_length)
657
+
658
+
659
+ class PrivateDomainName(univ.Choice):
660
+ componentType = namedtype.NamedTypes(
661
+ namedtype.NamedType('numeric', char.NumericString().subtype(
662
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))),
663
+ namedtype.NamedType('printable', char.PrintableString().subtype(
664
+ subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length)))
665
+ )
666
+
667
+
668
+ class TerminalIdentifier(char.PrintableString):
669
+ subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_terminal_id_length)
670
+
671
+
672
+ class X121Address(char.NumericString):
673
+ subtypeSpec = char.NumericString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_x121_address_length)
674
+
675
+
676
+ class NetworkAddress(X121Address):
677
+ pass
678
+
679
+
680
+ class AdministrationDomainName(univ.Choice):
681
+ tagSet = univ.Choice.tagSet.tagExplicitly(
682
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2)
683
+ )
684
+ componentType = namedtype.NamedTypes(
685
+ namedtype.NamedType('numeric', char.NumericString().subtype(
686
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))),
687
+ namedtype.NamedType('printable', char.PrintableString().subtype(
688
+ subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
689
+ )
690
+
691
+
692
+ class CountryName(univ.Choice):
693
+ tagSet = univ.Choice.tagSet.tagExplicitly(
694
+ tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1)
695
+ )
696
+ componentType = namedtype.NamedTypes(
697
+ namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
698
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length,
699
+ ub_country_name_numeric_length))),
700
+ namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
701
+ subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
702
+ )
703
+
704
+
705
+ class BuiltInStandardAttributes(univ.Sequence):
706
+ componentType = namedtype.NamedTypes(
707
+ namedtype.OptionalNamedType('country-name', CountryName()),
708
+ namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()),
709
+ namedtype.OptionalNamedType('network-address', NetworkAddress().subtype(
710
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
711
+ namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype(
712
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
713
+ namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype(
714
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
715
+ namedtype.OptionalNamedType('organization-name', OrganizationName().subtype(
716
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
717
+ namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype(
718
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
719
+ namedtype.OptionalNamedType('personal-name', PersonalName().subtype(
720
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
721
+ namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype(
722
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6)))
723
+ )
724
+
725
+
726
+ class ORAddress(univ.Sequence):
727
+ componentType = namedtype.NamedTypes(
728
+ namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()),
729
+ namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()),
730
+ namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes())
731
+ )
732
+
733
+
734
+ #
735
+ # PKIX1Implicit88
736
+ #
737
+
738
+ id_ce_invalidityDate = univ.ObjectIdentifier('2.5.29.24')
739
+
740
+
741
+ class InvalidityDate(useful.GeneralizedTime):
742
+ pass
743
+
744
+
745
+ id_holdinstruction_none = univ.ObjectIdentifier('2.2.840.10040.2.1')
746
+ id_holdinstruction_callissuer = univ.ObjectIdentifier('2.2.840.10040.2.2')
747
+ id_holdinstruction_reject = univ.ObjectIdentifier('2.2.840.10040.2.3')
748
+
749
+ holdInstruction = univ.ObjectIdentifier('2.2.840.10040.2')
750
+
751
+ id_ce_holdInstructionCode = univ.ObjectIdentifier('2.5.29.23')
752
+
753
+
754
+ class HoldInstructionCode(univ.ObjectIdentifier):
755
+ pass
756
+
757
+
758
+ id_ce_cRLReasons = univ.ObjectIdentifier('2.5.29.21')
759
+
760
+
761
+ class CRLReason(univ.Enumerated):
762
+ namedValues = namedval.NamedValues(
763
+ ('unspecified', 0),
764
+ ('keyCompromise', 1),
765
+ ('cACompromise', 2),
766
+ ('affiliationChanged', 3),
767
+ ('superseded', 4),
768
+ ('cessationOfOperation', 5),
769
+ ('certificateHold', 6),
770
+ ('removeFromCRL', 8)
771
+ )
772
+
773
+
774
+ id_ce_cRLNumber = univ.ObjectIdentifier('2.5.29.20')
775
+
776
+
777
+ class CRLNumber(univ.Integer):
778
+ subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, MAX)
779
+
780
+
781
+ class BaseCRLNumber(CRLNumber):
782
+ pass
783
+
784
+
785
+ id_kp_serverAuth = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.1')
786
+ id_kp_clientAuth = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.2')
787
+ id_kp_codeSigning = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.3')
788
+ id_kp_emailProtection = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.4')
789
+ id_kp_ipsecEndSystem = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.5')
790
+ id_kp_ipsecTunnel = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.6')
791
+ id_kp_ipsecUser = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.7')
792
+ id_kp_timeStamping = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.8')
793
+ id_pe_authorityInfoAccess = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.1')
794
+ id_ce_extKeyUsage = univ.ObjectIdentifier('2.5.29.37')
795
+
796
+
797
+ class KeyPurposeId(univ.ObjectIdentifier):
798
+ pass
799
+
800
+
801
+ class ExtKeyUsageSyntax(univ.SequenceOf):
802
+ componentType = KeyPurposeId()
803
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
804
+
805
+
806
+ class ReasonFlags(univ.BitString):
807
+ namedValues = namedval.NamedValues(
808
+ ('unused', 0),
809
+ ('keyCompromise', 1),
810
+ ('cACompromise', 2),
811
+ ('affiliationChanged', 3),
812
+ ('superseded', 4),
813
+ ('cessationOfOperation', 5),
814
+ ('certificateHold', 6)
815
+ )
816
+
817
+
818
+ class SkipCerts(univ.Integer):
819
+ subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, MAX)
820
+
821
+
822
+ id_ce_policyConstraints = univ.ObjectIdentifier('2.5.29.36')
823
+
824
+
825
+ class PolicyConstraints(univ.Sequence):
826
+ componentType = namedtype.NamedTypes(
827
+ namedtype.OptionalNamedType('requireExplicitPolicy', SkipCerts().subtype(
828
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
829
+ namedtype.OptionalNamedType('inhibitPolicyMapping', SkipCerts().subtype(
830
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
831
+ )
832
+
833
+
834
+ id_ce_basicConstraints = univ.ObjectIdentifier('2.5.29.19')
835
+
836
+
837
+ class BasicConstraints(univ.Sequence):
838
+ componentType = namedtype.NamedTypes(
839
+ namedtype.DefaultedNamedType('cA', univ.Boolean(False)),
840
+ namedtype.OptionalNamedType('pathLenConstraint',
841
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
842
+ )
843
+
844
+
845
+ id_ce_subjectDirectoryAttributes = univ.ObjectIdentifier('2.5.29.9')
846
+
847
+
848
+ class EDIPartyName(univ.Sequence):
849
+ componentType = namedtype.NamedTypes(
850
+ namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype(
851
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
852
+ namedtype.NamedType('partyName',
853
+ DirectoryString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
854
+ )
855
+
856
+
857
+
858
+ id_ce_deltaCRLIndicator = univ.ObjectIdentifier('2.5.29.27')
859
+
860
+
861
+
862
+ class BaseDistance(univ.Integer):
863
+ subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, MAX)
864
+
865
+
866
+ id_ce_cRLDistributionPoints = univ.ObjectIdentifier('2.5.29.31')
867
+
868
+
869
+ id_ce_issuingDistributionPoint = univ.ObjectIdentifier('2.5.29.28')
870
+
871
+
872
+
873
+
874
+ id_ce_nameConstraints = univ.ObjectIdentifier('2.5.29.30')
875
+
876
+
877
+ class DisplayText(univ.Choice):
878
+ componentType = namedtype.NamedTypes(
879
+ namedtype.NamedType('visibleString',
880
+ char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
881
+ namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
882
+ namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
883
+ )
884
+
885
+
886
+ class NoticeReference(univ.Sequence):
887
+ componentType = namedtype.NamedTypes(
888
+ namedtype.NamedType('organization', DisplayText()),
889
+ namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer()))
890
+ )
891
+
892
+
893
+ class UserNotice(univ.Sequence):
894
+ componentType = namedtype.NamedTypes(
895
+ namedtype.OptionalNamedType('noticeRef', NoticeReference()),
896
+ namedtype.OptionalNamedType('explicitText', DisplayText())
897
+ )
898
+
899
+
900
+ class CPSuri(char.IA5String):
901
+ pass
902
+
903
+
904
+ class PolicyQualifierId(univ.ObjectIdentifier):
905
+ subtypeSpec = univ.ObjectIdentifier.subtypeSpec + constraint.SingleValueConstraint(id_qt_cps, id_qt_unotice)
906
+
907
+
908
+ class CertPolicyId(univ.ObjectIdentifier):
909
+ pass
910
+
911
+
912
+ class PolicyQualifierInfo(univ.Sequence):
913
+ componentType = namedtype.NamedTypes(
914
+ namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
915
+ namedtype.NamedType('qualifier', univ.Any())
916
+ )
917
+
918
+
919
+ id_ce_certificatePolicies = univ.ObjectIdentifier('2.5.29.32')
920
+
921
+
922
+ class PolicyInformation(univ.Sequence):
923
+ componentType = namedtype.NamedTypes(
924
+ namedtype.NamedType('policyIdentifier', CertPolicyId()),
925
+ namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo()).subtype(
926
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
927
+ )
928
+
929
+
930
+ class CertificatePolicies(univ.SequenceOf):
931
+ componentType = PolicyInformation()
932
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
933
+
934
+
935
+ id_ce_policyMappings = univ.ObjectIdentifier('2.5.29.33')
936
+
937
+
938
+ class PolicyMapping(univ.Sequence):
939
+ componentType = namedtype.NamedTypes(
940
+ namedtype.NamedType('issuerDomainPolicy', CertPolicyId()),
941
+ namedtype.NamedType('subjectDomainPolicy', CertPolicyId())
942
+ )
943
+
944
+
945
+ class PolicyMappings(univ.SequenceOf):
946
+ componentType = PolicyMapping()
947
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
948
+
949
+
950
+ id_ce_privateKeyUsagePeriod = univ.ObjectIdentifier('2.5.29.16')
951
+
952
+
953
+ class PrivateKeyUsagePeriod(univ.Sequence):
954
+ componentType = namedtype.NamedTypes(
955
+ namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype(
956
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
957
+ namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype(
958
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
959
+ )
960
+
961
+
962
+ id_ce_keyUsage = univ.ObjectIdentifier('2.5.29.15')
963
+
964
+
965
+ class KeyUsage(univ.BitString):
966
+ namedValues = namedval.NamedValues(
967
+ ('digitalSignature', 0),
968
+ ('nonRepudiation', 1),
969
+ ('keyEncipherment', 2),
970
+ ('dataEncipherment', 3),
971
+ ('keyAgreement', 4),
972
+ ('keyCertSign', 5),
973
+ ('cRLSign', 6),
974
+ ('encipherOnly', 7),
975
+ ('decipherOnly', 8)
976
+ )
977
+
978
+
979
+ id_ce = univ.ObjectIdentifier('2.5.29')
980
+
981
+ id_ce_authorityKeyIdentifier = univ.ObjectIdentifier('2.5.29.35')
982
+
983
+
984
+ class KeyIdentifier(univ.OctetString):
985
+ pass
986
+
987
+
988
+ id_ce_subjectKeyIdentifier = univ.ObjectIdentifier('2.5.29.14')
989
+
990
+
991
+ class SubjectKeyIdentifier(KeyIdentifier):
992
+ pass
993
+
994
+
995
+ id_ce_certificateIssuer = univ.ObjectIdentifier('2.5.29.29')
996
+
997
+
998
+ id_ce_subjectAltName = univ.ObjectIdentifier('2.5.29.17')
999
+
1000
+
1001
+ id_ce_issuerAltName = univ.ObjectIdentifier('2.5.29.18')
1002
+
1003
+
1004
+ class AttributeValue(univ.Any):
1005
+ pass
1006
+
1007
+
1008
+ class AttributeType(univ.ObjectIdentifier):
1009
+ pass
1010
+
1011
+ certificateAttributesMap = {}
1012
+
1013
+
1014
+ class AttributeTypeAndValue(univ.Sequence):
1015
+ componentType = namedtype.NamedTypes(
1016
+ namedtype.NamedType('type', AttributeType()),
1017
+ namedtype.NamedType('value', AttributeValue(),
1018
+ openType=opentype.OpenType('type', certificateAttributesMap))
1019
+ )
1020
+
1021
+
1022
+ class Attribute(univ.Sequence):
1023
+ componentType = namedtype.NamedTypes(
1024
+ namedtype.NamedType('type', AttributeType()),
1025
+ namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
1026
+ )
1027
+
1028
+
1029
+ class SubjectDirectoryAttributes(univ.SequenceOf):
1030
+ componentType = Attribute()
1031
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1032
+
1033
+
1034
+ class RelativeDistinguishedName(univ.SetOf):
1035
+ componentType = AttributeTypeAndValue()
1036
+
1037
+
1038
+ class RDNSequence(univ.SequenceOf):
1039
+ componentType = RelativeDistinguishedName()
1040
+
1041
+
1042
+ class Name(univ.Choice):
1043
+ componentType = namedtype.NamedTypes(
1044
+ namedtype.NamedType('', RDNSequence())
1045
+ )
1046
+
1047
+ class CertificateSerialNumber(univ.Integer):
1048
+ pass
1049
+
1050
+
1051
+ class AnotherName(univ.Sequence):
1052
+ componentType = namedtype.NamedTypes(
1053
+ namedtype.NamedType('type-id', univ.ObjectIdentifier()),
1054
+ namedtype.NamedType('value',
1055
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
1056
+ )
1057
+
1058
+
1059
+ class GeneralName(univ.Choice):
1060
+ componentType = namedtype.NamedTypes(
1061
+ namedtype.NamedType('otherName',
1062
+ AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1063
+ namedtype.NamedType('rfc822Name',
1064
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1065
+ namedtype.NamedType('dNSName',
1066
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
1067
+ namedtype.NamedType('x400Address',
1068
+ ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1069
+ namedtype.NamedType('directoryName',
1070
+ Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
1071
+ namedtype.NamedType('ediPartyName',
1072
+ EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
1073
+ namedtype.NamedType('uniformResourceIdentifier',
1074
+ char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
1075
+ namedtype.NamedType('iPAddress', univ.OctetString().subtype(
1076
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
1077
+ namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype(
1078
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)))
1079
+ )
1080
+
1081
+
1082
+ class GeneralNames(univ.SequenceOf):
1083
+ componentType = GeneralName()
1084
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1085
+
1086
+
1087
+ class AccessDescription(univ.Sequence):
1088
+ componentType = namedtype.NamedTypes(
1089
+ namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
1090
+ namedtype.NamedType('accessLocation', GeneralName())
1091
+ )
1092
+
1093
+
1094
+ class AuthorityInfoAccessSyntax(univ.SequenceOf):
1095
+ componentType = AccessDescription()
1096
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1097
+
1098
+
1099
+ class AuthorityKeyIdentifier(univ.Sequence):
1100
+ componentType = namedtype.NamedTypes(
1101
+ namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype(
1102
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1103
+ namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype(
1104
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1105
+ namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype(
1106
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
1107
+ )
1108
+
1109
+
1110
+ class DistributionPointName(univ.Choice):
1111
+ componentType = namedtype.NamedTypes(
1112
+ namedtype.NamedType('fullName', GeneralNames().subtype(
1113
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1114
+ namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype(
1115
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
1116
+ )
1117
+
1118
+
1119
+ class DistributionPoint(univ.Sequence):
1120
+ componentType = namedtype.NamedTypes(
1121
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1122
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1123
+ namedtype.OptionalNamedType('reasons', ReasonFlags().subtype(
1124
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1125
+ namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype(
1126
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
1127
+ )
1128
+
1129
+
1130
+ class CRLDistPointsSyntax(univ.SequenceOf):
1131
+ componentType = DistributionPoint()
1132
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1133
+
1134
+
1135
+ class IssuingDistributionPoint(univ.Sequence):
1136
+ componentType = namedtype.NamedTypes(
1137
+ namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
1138
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1139
+ namedtype.NamedType('onlyContainsUserCerts', univ.Boolean(False).subtype(
1140
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1141
+ namedtype.NamedType('onlyContainsCACerts', univ.Boolean(False).subtype(
1142
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
1143
+ namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype(
1144
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
1145
+ namedtype.NamedType('indirectCRL', univ.Boolean(False).subtype(
1146
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
1147
+ )
1148
+
1149
+
1150
+ class GeneralSubtree(univ.Sequence):
1151
+ componentType = namedtype.NamedTypes(
1152
+ namedtype.NamedType('base', GeneralName()),
1153
+ namedtype.DefaultedNamedType('minimum', BaseDistance(0).subtype(
1154
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1155
+ namedtype.OptionalNamedType('maximum', BaseDistance().subtype(
1156
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
1157
+ )
1158
+
1159
+
1160
+ class GeneralSubtrees(univ.SequenceOf):
1161
+ componentType = GeneralSubtree()
1162
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1163
+
1164
+
1165
+ class NameConstraints(univ.Sequence):
1166
+ componentType = namedtype.NamedTypes(
1167
+ namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype(
1168
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
1169
+ namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype(
1170
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
1171
+ )
1172
+
1173
+
1174
+ class CertificateIssuer(GeneralNames):
1175
+ pass
1176
+
1177
+
1178
+ class SubjectAltName(GeneralNames):
1179
+ pass
1180
+
1181
+
1182
+ class IssuerAltName(GeneralNames):
1183
+ pass
1184
+
1185
+
1186
+ certificateExtensionsMap = {}
1187
+
1188
+
1189
+ class Extension(univ.Sequence):
1190
+ componentType = namedtype.NamedTypes(
1191
+ namedtype.NamedType('extnID', univ.ObjectIdentifier()),
1192
+ namedtype.DefaultedNamedType('critical', univ.Boolean('False')),
1193
+ namedtype.NamedType('extnValue', univ.OctetString(),
1194
+ openType=opentype.OpenType('extnID', certificateExtensionsMap))
1195
+ )
1196
+
1197
+
1198
+ class Extensions(univ.SequenceOf):
1199
+ componentType = Extension()
1200
+ sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
1201
+
1202
+
1203
+ class SubjectPublicKeyInfo(univ.Sequence):
1204
+ componentType = namedtype.NamedTypes(
1205
+ namedtype.NamedType('algorithm', AlgorithmIdentifier()),
1206
+ namedtype.NamedType('subjectPublicKey', univ.BitString())
1207
+ )
1208
+
1209
+
1210
+ class UniqueIdentifier(univ.BitString):
1211
+ pass
1212
+
1213
+
1214
+ class Time(univ.Choice):
1215
+ componentType = namedtype.NamedTypes(
1216
+ namedtype.NamedType('utcTime', useful.UTCTime()),
1217
+ namedtype.NamedType('generalTime', useful.GeneralizedTime())
1218
+ )
1219
+
1220
+
1221
+ class Validity(univ.Sequence):
1222
+ componentType = namedtype.NamedTypes(
1223
+ namedtype.NamedType('notBefore', Time()),
1224
+ namedtype.NamedType('notAfter', Time())
1225
+ )
1226
+
1227
+
1228
+ class Version(univ.Integer):
1229
+ namedValues = namedval.NamedValues(
1230
+ ('v1', 0), ('v2', 1), ('v3', 2)
1231
+ )
1232
+
1233
+
1234
+ class TBSCertificate(univ.Sequence):
1235
+ componentType = namedtype.NamedTypes(
1236
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
1237
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
1238
+ namedtype.NamedType('serialNumber', CertificateSerialNumber()),
1239
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
1240
+ namedtype.NamedType('issuer', Name()),
1241
+ namedtype.NamedType('validity', Validity()),
1242
+ namedtype.NamedType('subject', Name()),
1243
+ namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
1244
+ namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype(
1245
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
1246
+ namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype(
1247
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
1248
+ namedtype.OptionalNamedType('extensions', Extensions().subtype(
1249
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
1250
+ )
1251
+
1252
+
1253
+ class Certificate(univ.Sequence):
1254
+ componentType = namedtype.NamedTypes(
1255
+ namedtype.NamedType('tbsCertificate', TBSCertificate()),
1256
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
1257
+ namedtype.NamedType('signatureValue', univ.BitString())
1258
+ )
1259
+
1260
+ # CRL structures
1261
+
1262
+ class RevokedCertificate(univ.Sequence):
1263
+ componentType = namedtype.NamedTypes(
1264
+ namedtype.NamedType('userCertificate', CertificateSerialNumber()),
1265
+ namedtype.NamedType('revocationDate', Time()),
1266
+ namedtype.OptionalNamedType('crlEntryExtensions', Extensions())
1267
+ )
1268
+
1269
+
1270
+ class TBSCertList(univ.Sequence):
1271
+ componentType = namedtype.NamedTypes(
1272
+ namedtype.OptionalNamedType('version', Version()),
1273
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
1274
+ namedtype.NamedType('issuer', Name()),
1275
+ namedtype.NamedType('thisUpdate', Time()),
1276
+ namedtype.OptionalNamedType('nextUpdate', Time()),
1277
+ namedtype.OptionalNamedType('revokedCertificates', univ.SequenceOf(componentType=RevokedCertificate())),
1278
+ namedtype.OptionalNamedType('crlExtensions', Extensions().subtype(
1279
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
1280
+ )
1281
+
1282
+
1283
+ class CertificateList(univ.Sequence):
1284
+ componentType = namedtype.NamedTypes(
1285
+ namedtype.NamedType('tbsCertList', TBSCertList()),
1286
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
1287
+ namedtype.NamedType('signature', univ.BitString())
1288
+ )
1289
+
1290
+ # map of AttributeType -> AttributeValue
1291
+
1292
+ _certificateAttributesMapUpdate = {
1293
+ id_at_name: X520name(),
1294
+ id_at_surname: X520name(),
1295
+ id_at_givenName: X520name(),
1296
+ id_at_initials: X520name(),
1297
+ id_at_generationQualifier: X520name(),
1298
+ id_at_commonName: X520CommonName(),
1299
+ id_at_localityName: X520LocalityName(),
1300
+ id_at_stateOrProvinceName: X520StateOrProvinceName(),
1301
+ id_at_organizationName: X520OrganizationName(),
1302
+ id_at_organizationalUnitName: X520OrganizationalUnitName(),
1303
+ id_at_title: X520Title(),
1304
+ id_at_dnQualifier: X520dnQualifier(),
1305
+ id_at_countryName: X520countryName(),
1306
+ emailAddress: Pkcs9email(),
1307
+ }
1308
+
1309
+ certificateAttributesMap.update(_certificateAttributesMapUpdate)
1310
+
1311
+
1312
+ # map of Certificate Extension OIDs to Extensions
1313
+
1314
+ _certificateExtensionsMapUpdate = {
1315
+ id_ce_authorityKeyIdentifier: AuthorityKeyIdentifier(),
1316
+ id_ce_subjectKeyIdentifier: SubjectKeyIdentifier(),
1317
+ id_ce_keyUsage: KeyUsage(),
1318
+ id_ce_privateKeyUsagePeriod: PrivateKeyUsagePeriod(),
1319
+ id_ce_certificatePolicies: CertificatePolicies(),
1320
+ id_ce_policyMappings: PolicyMappings(),
1321
+ id_ce_subjectAltName: SubjectAltName(),
1322
+ id_ce_issuerAltName: IssuerAltName(),
1323
+ id_ce_subjectDirectoryAttributes: SubjectDirectoryAttributes(),
1324
+ id_ce_basicConstraints: BasicConstraints(),
1325
+ id_ce_nameConstraints: NameConstraints(),
1326
+ id_ce_policyConstraints: PolicyConstraints(),
1327
+ id_ce_extKeyUsage: ExtKeyUsageSyntax(),
1328
+ id_ce_cRLDistributionPoints: CRLDistPointsSyntax(),
1329
+ id_pe_authorityInfoAccess: AuthorityInfoAccessSyntax(),
1330
+ id_ce_cRLNumber: univ.Integer(),
1331
+ id_ce_deltaCRLIndicator: BaseCRLNumber(),
1332
+ id_ce_issuingDistributionPoint: IssuingDistributionPoint(),
1333
+ id_ce_cRLReasons: CRLReason(),
1334
+ id_ce_holdInstructionCode: univ.ObjectIdentifier(),
1335
+ id_ce_invalidityDate: useful.GeneralizedTime(),
1336
+ id_ce_certificateIssuer: GeneralNames(),
1337
+ }
1338
+
1339
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
1340
+