Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .venv/lib/python3.11/site-packages/googleapis_common_protos-1.66.0.dist-info/LICENSE +202 -0
- .venv/lib/python3.11/site-packages/googleapis_common_protos-1.66.0.dist-info/WHEEL +6 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/pem.py +58 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc1155.py +96 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc1901.py +22 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc1902.py +129 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc1905.py +135 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2315.py +294 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2459.py +1339 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2511.py +258 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2631.py +37 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2876.py +56 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc2985.py +588 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3114.py +77 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3161.py +142 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3274.py +59 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3280.py +1543 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3412.py +53 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3447.py +45 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3537.py +34 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3560.py +74 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3565.py +57 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3657.py +66 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3709.py +207 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3739.py +203 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3770.py +75 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc3779.py +137 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4010.py +58 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4055.py +258 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4108.py +350 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4210.py +803 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4476.py +93 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc4985.py +49 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5035.py +199 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5126.py +577 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5208.py +56 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5636.py +113 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5639.py +49 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5649.py +33 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5652.py +761 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5753.py +157 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5913.py +44 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5916.py +35 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5917.py +55 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5924.py +19 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5934.py +786 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc5940.py +59 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc6019.py +45 -0
- .venv/lib/python3.11/site-packages/pyasn1_modules/rfc6031.py +469 -0
- .venv/lib/python3.11/site-packages/pyasn1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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
.venv/lib/python3.11/site-packages/googleapis_common_protos-1.66.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (75.3.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py2-none-any
|
| 5 |
+
Tag: py3-none-any
|
| 6 |
+
|
.venv/lib/python3.11/site-packages/pyasn1_modules/pem.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
import base64
|
| 8 |
+
|
| 9 |
+
stSpam, stHam, stDump = 0, 1, 2
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# The markers parameters is in form ('start1', 'stop1'), ('start2', 'stop2')...
|
| 13 |
+
# Return is (marker-index, substrate)
|
| 14 |
+
def readPemBlocksFromFile(fileObj, *markers):
|
| 15 |
+
startMarkers = dict(map(lambda x: (x[1], x[0]),
|
| 16 |
+
enumerate(map(lambda y: y[0], markers))))
|
| 17 |
+
stopMarkers = dict(map(lambda x: (x[1], x[0]),
|
| 18 |
+
enumerate(map(lambda y: y[1], markers))))
|
| 19 |
+
idx = -1
|
| 20 |
+
substrate = ''
|
| 21 |
+
certLines = []
|
| 22 |
+
state = stSpam
|
| 23 |
+
while True:
|
| 24 |
+
certLine = fileObj.readline()
|
| 25 |
+
if not certLine:
|
| 26 |
+
break
|
| 27 |
+
certLine = certLine.strip()
|
| 28 |
+
if state == stSpam:
|
| 29 |
+
if certLine in startMarkers:
|
| 30 |
+
certLines = []
|
| 31 |
+
idx = startMarkers[certLine]
|
| 32 |
+
state = stHam
|
| 33 |
+
continue
|
| 34 |
+
if state == stHam:
|
| 35 |
+
if certLine in stopMarkers and stopMarkers[certLine] == idx:
|
| 36 |
+
state = stDump
|
| 37 |
+
else:
|
| 38 |
+
certLines.append(certLine)
|
| 39 |
+
if state == stDump:
|
| 40 |
+
substrate = ''.encode().join([base64.b64decode(x.encode()) for x in certLines])
|
| 41 |
+
break
|
| 42 |
+
return idx, substrate
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
# Backward compatibility routine
|
| 46 |
+
def readPemFromFile(fileObj,
|
| 47 |
+
startMarker='-----BEGIN CERTIFICATE-----',
|
| 48 |
+
endMarker='-----END CERTIFICATE-----'):
|
| 49 |
+
idx, substrate = readPemBlocksFromFile(fileObj, (startMarker, endMarker))
|
| 50 |
+
return substrate
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def readBase64fromText(text):
|
| 54 |
+
return base64.b64decode(text.encode())
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def readBase64FromFile(fileObj):
|
| 58 |
+
return readBase64fromText(fileObj.read())
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc1155.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/rfc1155.txt
|
| 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 tag
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class ObjectName(univ.ObjectIdentifier):
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class SimpleSyntax(univ.Choice):
|
| 26 |
+
componentType = namedtype.NamedTypes(
|
| 27 |
+
namedtype.NamedType('number', univ.Integer()),
|
| 28 |
+
namedtype.NamedType('string', univ.OctetString()),
|
| 29 |
+
namedtype.NamedType('object', univ.ObjectIdentifier()),
|
| 30 |
+
namedtype.NamedType('empty', univ.Null())
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class IpAddress(univ.OctetString):
|
| 35 |
+
tagSet = univ.OctetString.tagSet.tagImplicitly(
|
| 36 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0)
|
| 37 |
+
)
|
| 38 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(
|
| 39 |
+
4, 4
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class NetworkAddress(univ.Choice):
|
| 44 |
+
componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.NamedType('internet', IpAddress())
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class Counter(univ.Integer):
|
| 50 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 51 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 1)
|
| 52 |
+
)
|
| 53 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 54 |
+
0, 4294967295
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class Gauge(univ.Integer):
|
| 59 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 60 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)
|
| 61 |
+
)
|
| 62 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 63 |
+
0, 4294967295
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class TimeTicks(univ.Integer):
|
| 68 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 69 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 3)
|
| 70 |
+
)
|
| 71 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 72 |
+
0, 4294967295
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class Opaque(univ.OctetString):
|
| 77 |
+
tagSet = univ.OctetString.tagSet.tagImplicitly(
|
| 78 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 4)
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class ApplicationSyntax(univ.Choice):
|
| 83 |
+
componentType = namedtype.NamedTypes(
|
| 84 |
+
namedtype.NamedType('address', NetworkAddress()),
|
| 85 |
+
namedtype.NamedType('counter', Counter()),
|
| 86 |
+
namedtype.NamedType('gauge', Gauge()),
|
| 87 |
+
namedtype.NamedType('ticks', TimeTicks()),
|
| 88 |
+
namedtype.NamedType('arbitrary', Opaque())
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class ObjectSyntax(univ.Choice):
|
| 93 |
+
componentType = namedtype.NamedTypes(
|
| 94 |
+
namedtype.NamedType('simple', SimpleSyntax()),
|
| 95 |
+
namedtype.NamedType('application-wide', ApplicationSyntax())
|
| 96 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc1901.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# SNMPv2c message syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://www.ietf.org/rfc/rfc1901.txt
|
| 11 |
+
#
|
| 12 |
+
from pyasn1.type import namedtype
|
| 13 |
+
from pyasn1.type import namedval
|
| 14 |
+
from pyasn1.type import univ
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Message(univ.Sequence):
|
| 18 |
+
componentType = namedtype.NamedTypes(
|
| 19 |
+
namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('version-2c', 1)))),
|
| 20 |
+
namedtype.NamedType('community', univ.OctetString()),
|
| 21 |
+
namedtype.NamedType('data', univ.Any())
|
| 22 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc1902.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# SNMPv2c message syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://www.ietf.org/rfc/rfc1902.txt
|
| 11 |
+
#
|
| 12 |
+
from pyasn1.type import constraint
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import tag
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class Integer(univ.Integer):
|
| 19 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 20 |
+
-2147483648, 2147483647
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Integer32(univ.Integer):
|
| 25 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 26 |
+
-2147483648, 2147483647
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class OctetString(univ.OctetString):
|
| 31 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(
|
| 32 |
+
0, 65535
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class IpAddress(univ.OctetString):
|
| 37 |
+
tagSet = univ.OctetString.tagSet.tagImplicitly(
|
| 38 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x00)
|
| 39 |
+
)
|
| 40 |
+
subtypeSpec = univ.OctetString.subtypeSpec + constraint.ValueSizeConstraint(
|
| 41 |
+
4, 4
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Counter32(univ.Integer):
|
| 46 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 47 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x01)
|
| 48 |
+
)
|
| 49 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 50 |
+
0, 4294967295
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Gauge32(univ.Integer):
|
| 55 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 56 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x02)
|
| 57 |
+
)
|
| 58 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 59 |
+
0, 4294967295
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class Unsigned32(univ.Integer):
|
| 64 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 65 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x02)
|
| 66 |
+
)
|
| 67 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 68 |
+
0, 4294967295
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class TimeTicks(univ.Integer):
|
| 73 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 74 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x03)
|
| 75 |
+
)
|
| 76 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 77 |
+
0, 4294967295
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class Opaque(univ.OctetString):
|
| 82 |
+
tagSet = univ.OctetString.tagSet.tagImplicitly(
|
| 83 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x04)
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class Counter64(univ.Integer):
|
| 88 |
+
tagSet = univ.Integer.tagSet.tagImplicitly(
|
| 89 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0x06)
|
| 90 |
+
)
|
| 91 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 92 |
+
0, 18446744073709551615
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class Bits(univ.OctetString):
|
| 97 |
+
pass
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class ObjectName(univ.ObjectIdentifier):
|
| 101 |
+
pass
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
class SimpleSyntax(univ.Choice):
|
| 105 |
+
componentType = namedtype.NamedTypes(
|
| 106 |
+
namedtype.NamedType('integer-value', Integer()),
|
| 107 |
+
namedtype.NamedType('string-value', OctetString()),
|
| 108 |
+
namedtype.NamedType('objectID-value', univ.ObjectIdentifier())
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
class ApplicationSyntax(univ.Choice):
|
| 113 |
+
componentType = namedtype.NamedTypes(
|
| 114 |
+
namedtype.NamedType('ipAddress-value', IpAddress()),
|
| 115 |
+
namedtype.NamedType('counter-value', Counter32()),
|
| 116 |
+
namedtype.NamedType('timeticks-value', TimeTicks()),
|
| 117 |
+
namedtype.NamedType('arbitrary-value', Opaque()),
|
| 118 |
+
namedtype.NamedType('big-counter-value', Counter64()),
|
| 119 |
+
# This conflicts with Counter32
|
| 120 |
+
# namedtype.NamedType('unsigned-integer-value', Unsigned32()),
|
| 121 |
+
namedtype.NamedType('gauge32-value', Gauge32())
|
| 122 |
+
) # BITS misplaced?
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class ObjectSyntax(univ.Choice):
|
| 126 |
+
componentType = namedtype.NamedTypes(
|
| 127 |
+
namedtype.NamedType('simple', SimpleSyntax()),
|
| 128 |
+
namedtype.NamedType('application-wide', ApplicationSyntax())
|
| 129 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc1905.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# SNMPv2c PDU syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://www.ietf.org/rfc/rfc1905.txt
|
| 11 |
+
#
|
| 12 |
+
from pyasn1.type import constraint
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import namedval
|
| 15 |
+
from pyasn1.type import tag
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc1902
|
| 19 |
+
|
| 20 |
+
max_bindings = rfc1902.Integer(2147483647)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class _BindValue(univ.Choice):
|
| 24 |
+
componentType = namedtype.NamedTypes(
|
| 25 |
+
namedtype.NamedType('value', rfc1902.ObjectSyntax()),
|
| 26 |
+
namedtype.NamedType('unSpecified', univ.Null()),
|
| 27 |
+
namedtype.NamedType('noSuchObject',
|
| 28 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 29 |
+
namedtype.NamedType('noSuchInstance',
|
| 30 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 31 |
+
namedtype.NamedType('endOfMibView',
|
| 32 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class VarBind(univ.Sequence):
|
| 37 |
+
componentType = namedtype.NamedTypes(
|
| 38 |
+
namedtype.NamedType('name', rfc1902.ObjectName()),
|
| 39 |
+
namedtype.NamedType('', _BindValue())
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class VarBindList(univ.SequenceOf):
|
| 44 |
+
componentType = VarBind()
|
| 45 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(
|
| 46 |
+
0, max_bindings
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class PDU(univ.Sequence):
|
| 51 |
+
componentType = namedtype.NamedTypes(
|
| 52 |
+
namedtype.NamedType('request-id', rfc1902.Integer32()),
|
| 53 |
+
namedtype.NamedType('error-status', univ.Integer(
|
| 54 |
+
namedValues=namedval.NamedValues(('noError', 0), ('tooBig', 1), ('noSuchName', 2), ('badValue', 3),
|
| 55 |
+
('readOnly', 4), ('genErr', 5), ('noAccess', 6), ('wrongType', 7),
|
| 56 |
+
('wrongLength', 8), ('wrongEncoding', 9), ('wrongValue', 10),
|
| 57 |
+
('noCreation', 11), ('inconsistentValue', 12), ('resourceUnavailable', 13),
|
| 58 |
+
('commitFailed', 14), ('undoFailed', 15), ('authorizationError', 16),
|
| 59 |
+
('notWritable', 17), ('inconsistentName', 18)))),
|
| 60 |
+
namedtype.NamedType('error-index',
|
| 61 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, max_bindings))),
|
| 62 |
+
namedtype.NamedType('variable-bindings', VarBindList())
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class BulkPDU(univ.Sequence):
|
| 67 |
+
componentType = namedtype.NamedTypes(
|
| 68 |
+
namedtype.NamedType('request-id', rfc1902.Integer32()),
|
| 69 |
+
namedtype.NamedType('non-repeaters',
|
| 70 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, max_bindings))),
|
| 71 |
+
namedtype.NamedType('max-repetitions',
|
| 72 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, max_bindings))),
|
| 73 |
+
namedtype.NamedType('variable-bindings', VarBindList())
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class GetRequestPDU(PDU):
|
| 78 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 79 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
class GetNextRequestPDU(PDU):
|
| 84 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 85 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
class ResponsePDU(PDU):
|
| 90 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 91 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class SetRequestPDU(PDU):
|
| 96 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 97 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class GetBulkRequestPDU(BulkPDU):
|
| 102 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 103 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5)
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class InformRequestPDU(PDU):
|
| 108 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 109 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class SNMPv2TrapPDU(PDU):
|
| 114 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 115 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class ReportPDU(PDU):
|
| 120 |
+
tagSet = PDU.tagSet.tagImplicitly(
|
| 121 |
+
tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class PDUs(univ.Choice):
|
| 126 |
+
componentType = namedtype.NamedTypes(
|
| 127 |
+
namedtype.NamedType('get-request', GetRequestPDU()),
|
| 128 |
+
namedtype.NamedType('get-next-request', GetNextRequestPDU()),
|
| 129 |
+
namedtype.NamedType('get-bulk-request', GetBulkRequestPDU()),
|
| 130 |
+
namedtype.NamedType('response', ResponsePDU()),
|
| 131 |
+
namedtype.NamedType('set-request', SetRequestPDU()),
|
| 132 |
+
namedtype.NamedType('inform-request', InformRequestPDU()),
|
| 133 |
+
namedtype.NamedType('snmpV2-trap', SNMPv2TrapPDU()),
|
| 134 |
+
namedtype.NamedType('report', ReportPDU())
|
| 135 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2315.py
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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#7 message syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# https://opensource.apple.com/source/Security/Security-55179.1/libsecurity_asn1/asn1/pkcs7.asn.auto.html
|
| 11 |
+
#
|
| 12 |
+
# Sample captures from:
|
| 13 |
+
# openssl crl2pkcs7 -nocrl -certfile cert1.cer -out outfile.p7b
|
| 14 |
+
#
|
| 15 |
+
from pyasn1_modules.rfc2459 import *
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class Attribute(univ.Sequence):
|
| 19 |
+
componentType = namedtype.NamedTypes(
|
| 20 |
+
namedtype.NamedType('type', AttributeType()),
|
| 21 |
+
namedtype.NamedType('values', univ.SetOf(componentType=AttributeValue()))
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class AttributeValueAssertion(univ.Sequence):
|
| 26 |
+
componentType = namedtype.NamedTypes(
|
| 27 |
+
namedtype.NamedType('attributeType', AttributeType()),
|
| 28 |
+
namedtype.NamedType('attributeValue', AttributeValue(),
|
| 29 |
+
openType=opentype.OpenType('type', certificateAttributesMap))
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
pkcs_7 = univ.ObjectIdentifier('1.2.840.113549.1.7')
|
| 34 |
+
data = univ.ObjectIdentifier('1.2.840.113549.1.7.1')
|
| 35 |
+
signedData = univ.ObjectIdentifier('1.2.840.113549.1.7.2')
|
| 36 |
+
envelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.3')
|
| 37 |
+
signedAndEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.4')
|
| 38 |
+
digestedData = univ.ObjectIdentifier('1.2.840.113549.1.7.5')
|
| 39 |
+
encryptedData = univ.ObjectIdentifier('1.2.840.113549.1.7.6')
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class ContentType(univ.ObjectIdentifier):
|
| 43 |
+
pass
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class ContentEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
|
| 47 |
+
pass
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class EncryptedContent(univ.OctetString):
|
| 51 |
+
pass
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
contentTypeMap = {}
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class EncryptedContentInfo(univ.Sequence):
|
| 58 |
+
componentType = namedtype.NamedTypes(
|
| 59 |
+
namedtype.NamedType('contentType', ContentType()),
|
| 60 |
+
namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
|
| 61 |
+
namedtype.OptionalNamedType(
|
| 62 |
+
'encryptedContent', EncryptedContent().subtype(
|
| 63 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
| 64 |
+
),
|
| 65 |
+
openType=opentype.OpenType('contentType', contentTypeMap)
|
| 66 |
+
)
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class Version(univ.Integer): # overrides x509.Version
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class EncryptedData(univ.Sequence):
|
| 75 |
+
componentType = namedtype.NamedTypes(
|
| 76 |
+
namedtype.NamedType('version', Version()),
|
| 77 |
+
namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class DigestAlgorithmIdentifier(AlgorithmIdentifier):
|
| 82 |
+
pass
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class DigestAlgorithmIdentifiers(univ.SetOf):
|
| 86 |
+
componentType = DigestAlgorithmIdentifier()
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
class Digest(univ.OctetString):
|
| 90 |
+
pass
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class ContentInfo(univ.Sequence):
|
| 94 |
+
componentType = namedtype.NamedTypes(
|
| 95 |
+
namedtype.NamedType('contentType', ContentType()),
|
| 96 |
+
namedtype.OptionalNamedType(
|
| 97 |
+
'content',
|
| 98 |
+
univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)),
|
| 99 |
+
openType=opentype.OpenType('contentType', contentTypeMap)
|
| 100 |
+
)
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
class DigestedData(univ.Sequence):
|
| 105 |
+
componentType = namedtype.NamedTypes(
|
| 106 |
+
namedtype.NamedType('version', Version()),
|
| 107 |
+
namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
|
| 108 |
+
namedtype.NamedType('contentInfo', ContentInfo()),
|
| 109 |
+
namedtype.NamedType('digest', Digest())
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class IssuerAndSerialNumber(univ.Sequence):
|
| 114 |
+
componentType = namedtype.NamedTypes(
|
| 115 |
+
namedtype.NamedType('issuer', Name()),
|
| 116 |
+
namedtype.NamedType('serialNumber', CertificateSerialNumber())
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
class KeyEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
|
| 121 |
+
pass
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class EncryptedKey(univ.OctetString):
|
| 125 |
+
pass
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
class RecipientInfo(univ.Sequence):
|
| 129 |
+
componentType = namedtype.NamedTypes(
|
| 130 |
+
namedtype.NamedType('version', Version()),
|
| 131 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 132 |
+
namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 133 |
+
namedtype.NamedType('encryptedKey', EncryptedKey())
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
class RecipientInfos(univ.SetOf):
|
| 138 |
+
componentType = RecipientInfo()
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class Attributes(univ.SetOf):
|
| 142 |
+
componentType = Attribute()
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
class ExtendedCertificateInfo(univ.Sequence):
|
| 146 |
+
componentType = namedtype.NamedTypes(
|
| 147 |
+
namedtype.NamedType('version', Version()),
|
| 148 |
+
namedtype.NamedType('certificate', Certificate()),
|
| 149 |
+
namedtype.NamedType('attributes', Attributes())
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
class SignatureAlgorithmIdentifier(AlgorithmIdentifier):
|
| 154 |
+
pass
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
class Signature(univ.BitString):
|
| 158 |
+
pass
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
class ExtendedCertificate(univ.Sequence):
|
| 162 |
+
componentType = namedtype.NamedTypes(
|
| 163 |
+
namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
|
| 164 |
+
namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
|
| 165 |
+
namedtype.NamedType('signature', Signature())
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class ExtendedCertificateOrCertificate(univ.Choice):
|
| 170 |
+
componentType = namedtype.NamedTypes(
|
| 171 |
+
namedtype.NamedType('certificate', Certificate()),
|
| 172 |
+
namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
|
| 173 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
class ExtendedCertificatesAndCertificates(univ.SetOf):
|
| 178 |
+
componentType = ExtendedCertificateOrCertificate()
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
class SerialNumber(univ.Integer):
|
| 182 |
+
pass
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
class CRLEntry(univ.Sequence):
|
| 186 |
+
componentType = namedtype.NamedTypes(
|
| 187 |
+
namedtype.NamedType('userCertificate', SerialNumber()),
|
| 188 |
+
namedtype.NamedType('revocationDate', useful.UTCTime())
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class TBSCertificateRevocationList(univ.Sequence):
|
| 193 |
+
componentType = namedtype.NamedTypes(
|
| 194 |
+
namedtype.NamedType('signature', AlgorithmIdentifier()),
|
| 195 |
+
namedtype.NamedType('issuer', Name()),
|
| 196 |
+
namedtype.NamedType('lastUpdate', useful.UTCTime()),
|
| 197 |
+
namedtype.NamedType('nextUpdate', useful.UTCTime()),
|
| 198 |
+
namedtype.OptionalNamedType('revokedCertificates', univ.SequenceOf(componentType=CRLEntry()))
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
class CertificateRevocationList(univ.Sequence):
|
| 203 |
+
componentType = namedtype.NamedTypes(
|
| 204 |
+
namedtype.NamedType('tbsCertificateRevocationList', TBSCertificateRevocationList()),
|
| 205 |
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
| 206 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class CertificateRevocationLists(univ.SetOf):
|
| 211 |
+
componentType = CertificateRevocationList()
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
class DigestEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
|
| 215 |
+
pass
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
class EncryptedDigest(univ.OctetString):
|
| 219 |
+
pass
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
class SignerInfo(univ.Sequence):
|
| 223 |
+
componentType = namedtype.NamedTypes(
|
| 224 |
+
namedtype.NamedType('version', Version()),
|
| 225 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 226 |
+
namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
|
| 227 |
+
namedtype.OptionalNamedType('authenticatedAttributes', Attributes().subtype(
|
| 228 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 229 |
+
namedtype.NamedType('digestEncryptionAlgorithm', DigestEncryptionAlgorithmIdentifier()),
|
| 230 |
+
namedtype.NamedType('encryptedDigest', EncryptedDigest()),
|
| 231 |
+
namedtype.OptionalNamedType('unauthenticatedAttributes', Attributes().subtype(
|
| 232 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
class SignerInfos(univ.SetOf):
|
| 237 |
+
componentType = SignerInfo()
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class SignedAndEnvelopedData(univ.Sequence):
|
| 241 |
+
componentType = namedtype.NamedTypes(
|
| 242 |
+
namedtype.NamedType('version', Version()),
|
| 243 |
+
namedtype.NamedType('recipientInfos', RecipientInfos()),
|
| 244 |
+
namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
|
| 245 |
+
namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
|
| 246 |
+
namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(
|
| 247 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 248 |
+
namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(
|
| 249 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 250 |
+
namedtype.NamedType('signerInfos', SignerInfos())
|
| 251 |
+
)
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
class EnvelopedData(univ.Sequence):
|
| 255 |
+
componentType = namedtype.NamedTypes(
|
| 256 |
+
namedtype.NamedType('version', Version()),
|
| 257 |
+
namedtype.NamedType('recipientInfos', RecipientInfos()),
|
| 258 |
+
namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
class DigestInfo(univ.Sequence):
|
| 263 |
+
componentType = namedtype.NamedTypes(
|
| 264 |
+
namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
|
| 265 |
+
namedtype.NamedType('digest', Digest())
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class SignedData(univ.Sequence):
|
| 270 |
+
componentType = namedtype.NamedTypes(
|
| 271 |
+
namedtype.NamedType('version', Version()),
|
| 272 |
+
namedtype.OptionalNamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
|
| 273 |
+
namedtype.NamedType('contentInfo', ContentInfo()),
|
| 274 |
+
namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(
|
| 275 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 276 |
+
namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(
|
| 277 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 278 |
+
namedtype.OptionalNamedType('signerInfos', SignerInfos())
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
class Data(univ.OctetString):
|
| 283 |
+
pass
|
| 284 |
+
|
| 285 |
+
_contentTypeMapUpdate = {
|
| 286 |
+
data: Data(),
|
| 287 |
+
signedData: SignedData(),
|
| 288 |
+
envelopedData: EnvelopedData(),
|
| 289 |
+
signedAndEnvelopedData: SignedAndEnvelopedData(),
|
| 290 |
+
digestedData: DigestedData(),
|
| 291 |
+
encryptedData: EncryptedData()
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
contentTypeMap.update(_contentTypeMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2459.py
ADDED
|
@@ -0,0 +1,1339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-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 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 9 |
+
#
|
| 10 |
+
# X.509 message syntax
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/x509.asn
|
| 14 |
+
# http://www.ietf.org/rfc/rfc2459.txt
|
| 15 |
+
#
|
| 16 |
+
# Sample captures from:
|
| 17 |
+
# http://wiki.wireshark.org/SampleCaptures/
|
| 18 |
+
#
|
| 19 |
+
from pyasn1.type import char
|
| 20 |
+
from pyasn1.type import constraint
|
| 21 |
+
from pyasn1.type import namedtype
|
| 22 |
+
from pyasn1.type import namedval
|
| 23 |
+
from pyasn1.type import opentype
|
| 24 |
+
from pyasn1.type import tag
|
| 25 |
+
from pyasn1.type import univ
|
| 26 |
+
from pyasn1.type import useful
|
| 27 |
+
|
| 28 |
+
MAX = float('inf')
|
| 29 |
+
|
| 30 |
+
#
|
| 31 |
+
# PKIX1Explicit88
|
| 32 |
+
#
|
| 33 |
+
|
| 34 |
+
# Upper Bounds
|
| 35 |
+
ub_name = univ.Integer(32768)
|
| 36 |
+
ub_common_name = univ.Integer(64)
|
| 37 |
+
ub_locality_name = univ.Integer(128)
|
| 38 |
+
ub_state_name = univ.Integer(128)
|
| 39 |
+
ub_organization_name = univ.Integer(64)
|
| 40 |
+
ub_organizational_unit_name = univ.Integer(64)
|
| 41 |
+
ub_title = univ.Integer(64)
|
| 42 |
+
ub_match = univ.Integer(128)
|
| 43 |
+
ub_emailaddress_length = univ.Integer(128)
|
| 44 |
+
ub_common_name_length = univ.Integer(64)
|
| 45 |
+
ub_country_name_alpha_length = univ.Integer(2)
|
| 46 |
+
ub_country_name_numeric_length = univ.Integer(3)
|
| 47 |
+
ub_domain_defined_attributes = univ.Integer(4)
|
| 48 |
+
ub_domain_defined_attribute_type_length = univ.Integer(8)
|
| 49 |
+
ub_domain_defined_attribute_value_length = univ.Integer(128)
|
| 50 |
+
ub_domain_name_length = univ.Integer(16)
|
| 51 |
+
ub_extension_attributes = univ.Integer(256)
|
| 52 |
+
ub_e163_4_number_length = univ.Integer(15)
|
| 53 |
+
ub_e163_4_sub_address_length = univ.Integer(40)
|
| 54 |
+
ub_generation_qualifier_length = univ.Integer(3)
|
| 55 |
+
ub_given_name_length = univ.Integer(16)
|
| 56 |
+
ub_initials_length = univ.Integer(5)
|
| 57 |
+
ub_integer_options = univ.Integer(256)
|
| 58 |
+
ub_numeric_user_id_length = univ.Integer(32)
|
| 59 |
+
ub_organization_name_length = univ.Integer(64)
|
| 60 |
+
ub_organizational_unit_name_length = univ.Integer(32)
|
| 61 |
+
ub_organizational_units = univ.Integer(4)
|
| 62 |
+
ub_pds_name_length = univ.Integer(16)
|
| 63 |
+
ub_pds_parameter_length = univ.Integer(30)
|
| 64 |
+
ub_pds_physical_address_lines = univ.Integer(6)
|
| 65 |
+
ub_postal_code_length = univ.Integer(16)
|
| 66 |
+
ub_surname_length = univ.Integer(40)
|
| 67 |
+
ub_terminal_id_length = univ.Integer(24)
|
| 68 |
+
ub_unformatted_address_length = univ.Integer(180)
|
| 69 |
+
ub_x121_address_length = univ.Integer(16)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class UniversalString(char.UniversalString):
|
| 73 |
+
pass
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class BMPString(char.BMPString):
|
| 77 |
+
pass
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class UTF8String(char.UTF8String):
|
| 81 |
+
pass
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
|
| 85 |
+
id_pe = univ.ObjectIdentifier('1.3.6.1.5.5.7.1')
|
| 86 |
+
id_qt = univ.ObjectIdentifier('1.3.6.1.5.5.7.2')
|
| 87 |
+
id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
|
| 88 |
+
id_ad = univ.ObjectIdentifier('1.3.6.1.5.5.7.48')
|
| 89 |
+
|
| 90 |
+
id_qt_cps = univ.ObjectIdentifier('1.3.6.1.5.5.7.2.1')
|
| 91 |
+
id_qt_unotice = univ.ObjectIdentifier('1.3.6.1.5.5.7.2.2')
|
| 92 |
+
|
| 93 |
+
id_ad_ocsp = univ.ObjectIdentifier('1.3.6.1.5.5.7.48.1')
|
| 94 |
+
id_ad_caIssuers = univ.ObjectIdentifier('1.3.6.1.5.5.7.48.2')
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
id_at = univ.ObjectIdentifier('2.5.4')
|
| 100 |
+
id_at_name = univ.ObjectIdentifier('2.5.4.41')
|
| 101 |
+
# preserve misspelled variable for compatibility
|
| 102 |
+
id_at_sutname = id_at_surname = univ.ObjectIdentifier('2.5.4.4')
|
| 103 |
+
id_at_givenName = univ.ObjectIdentifier('2.5.4.42')
|
| 104 |
+
id_at_initials = univ.ObjectIdentifier('2.5.4.43')
|
| 105 |
+
id_at_generationQualifier = univ.ObjectIdentifier('2.5.4.44')
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class X520name(univ.Choice):
|
| 109 |
+
componentType = namedtype.NamedTypes(
|
| 110 |
+
namedtype.NamedType('teletexString',
|
| 111 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 112 |
+
namedtype.NamedType('printableString',
|
| 113 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 114 |
+
namedtype.NamedType('universalString',
|
| 115 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 116 |
+
namedtype.NamedType('utf8String',
|
| 117 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 118 |
+
namedtype.NamedType('bmpString',
|
| 119 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name)))
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
id_at_commonName = univ.ObjectIdentifier('2.5.4.3')
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class X520CommonName(univ.Choice):
|
| 127 |
+
componentType = namedtype.NamedTypes(
|
| 128 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 129 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 130 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 131 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 132 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 133 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 134 |
+
namedtype.NamedType('utf8String',
|
| 135 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 136 |
+
namedtype.NamedType('bmpString',
|
| 137 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name)))
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
id_at_localityName = univ.ObjectIdentifier('2.5.4.7')
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class X520LocalityName(univ.Choice):
|
| 145 |
+
componentType = namedtype.NamedTypes(
|
| 146 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 147 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 148 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 149 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 150 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 151 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 152 |
+
namedtype.NamedType('utf8String',
|
| 153 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 154 |
+
namedtype.NamedType('bmpString',
|
| 155 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name)))
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
id_at_stateOrProvinceName = univ.ObjectIdentifier('2.5.4.8')
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class X520StateOrProvinceName(univ.Choice):
|
| 163 |
+
componentType = namedtype.NamedTypes(
|
| 164 |
+
namedtype.NamedType('teletexString',
|
| 165 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 166 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 167 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 168 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 169 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 170 |
+
namedtype.NamedType('utf8String',
|
| 171 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 172 |
+
namedtype.NamedType('bmpString',
|
| 173 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name)))
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
id_at_organizationName = univ.ObjectIdentifier('2.5.4.10')
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
class X520OrganizationName(univ.Choice):
|
| 181 |
+
componentType = namedtype.NamedTypes(
|
| 182 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 183 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 184 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 185 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 186 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 187 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 188 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 189 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 190 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
| 191 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name)))
|
| 192 |
+
)
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
id_at_organizationalUnitName = univ.ObjectIdentifier('2.5.4.11')
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
class X520OrganizationalUnitName(univ.Choice):
|
| 199 |
+
componentType = namedtype.NamedTypes(
|
| 200 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 201 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 202 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 203 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 204 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 205 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 206 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 207 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 208 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
| 209 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name)))
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
id_at_title = univ.ObjectIdentifier('2.5.4.12')
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
class X520Title(univ.Choice):
|
| 217 |
+
componentType = namedtype.NamedTypes(
|
| 218 |
+
namedtype.NamedType('teletexString',
|
| 219 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 220 |
+
namedtype.NamedType('printableString',
|
| 221 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 222 |
+
namedtype.NamedType('universalString',
|
| 223 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 224 |
+
namedtype.NamedType('utf8String',
|
| 225 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 226 |
+
namedtype.NamedType('bmpString',
|
| 227 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title)))
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
id_at_dnQualifier = univ.ObjectIdentifier('2.5.4.46')
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
class X520dnQualifier(char.PrintableString):
|
| 235 |
+
pass
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
id_at_countryName = univ.ObjectIdentifier('2.5.4.6')
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
class X520countryName(char.PrintableString):
|
| 242 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(2, 2)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
pkcs_9 = univ.ObjectIdentifier('1.2.840.113549.1.9')
|
| 246 |
+
|
| 247 |
+
emailAddress = univ.ObjectIdentifier('1.2.840.113549.1.9.1')
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
class Pkcs9email(char.IA5String):
|
| 251 |
+
subtypeSpec = char.IA5String.subtypeSpec + constraint.ValueSizeConstraint(1, ub_emailaddress_length)
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
# ----
|
| 255 |
+
|
| 256 |
+
class DSAPrivateKey(univ.Sequence):
|
| 257 |
+
"""PKIX compliant DSA private key structure"""
|
| 258 |
+
componentType = namedtype.NamedTypes(
|
| 259 |
+
namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('v1', 0)))),
|
| 260 |
+
namedtype.NamedType('p', univ.Integer()),
|
| 261 |
+
namedtype.NamedType('q', univ.Integer()),
|
| 262 |
+
namedtype.NamedType('g', univ.Integer()),
|
| 263 |
+
namedtype.NamedType('public', univ.Integer()),
|
| 264 |
+
namedtype.NamedType('private', univ.Integer())
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
# ----
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
class DirectoryString(univ.Choice):
|
| 272 |
+
componentType = namedtype.NamedTypes(
|
| 273 |
+
namedtype.NamedType('teletexString',
|
| 274 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 275 |
+
namedtype.NamedType('printableString',
|
| 276 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 277 |
+
namedtype.NamedType('universalString',
|
| 278 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 279 |
+
namedtype.NamedType('utf8String',
|
| 280 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 281 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 282 |
+
namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 283 |
+
# hm, this should not be here!? XXX
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
# certificate and CRL specific structures begin here
|
| 288 |
+
|
| 289 |
+
class AlgorithmIdentifier(univ.Sequence):
|
| 290 |
+
componentType = namedtype.NamedTypes(
|
| 291 |
+
namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
|
| 292 |
+
namedtype.OptionalNamedType('parameters', univ.Any())
|
| 293 |
+
)
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
# Algorithm OIDs and parameter structures
|
| 298 |
+
|
| 299 |
+
pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
|
| 300 |
+
rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
|
| 301 |
+
md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
|
| 302 |
+
md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
|
| 303 |
+
sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
|
| 304 |
+
id_dsa_with_sha1 = univ.ObjectIdentifier('1.2.840.10040.4.3')
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
class Dss_Sig_Value(univ.Sequence):
|
| 308 |
+
componentType = namedtype.NamedTypes(
|
| 309 |
+
namedtype.NamedType('r', univ.Integer()),
|
| 310 |
+
namedtype.NamedType('s', univ.Integer())
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
dhpublicnumber = univ.ObjectIdentifier('1.2.840.10046.2.1')
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
class ValidationParms(univ.Sequence):
|
| 318 |
+
componentType = namedtype.NamedTypes(
|
| 319 |
+
namedtype.NamedType('seed', univ.BitString()),
|
| 320 |
+
namedtype.NamedType('pgenCounter', univ.Integer())
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
class DomainParameters(univ.Sequence):
|
| 325 |
+
componentType = namedtype.NamedTypes(
|
| 326 |
+
namedtype.NamedType('p', univ.Integer()),
|
| 327 |
+
namedtype.NamedType('g', univ.Integer()),
|
| 328 |
+
namedtype.NamedType('q', univ.Integer()),
|
| 329 |
+
namedtype.NamedType('j', univ.Integer()),
|
| 330 |
+
namedtype.OptionalNamedType('validationParms', ValidationParms())
|
| 331 |
+
)
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
id_dsa = univ.ObjectIdentifier('1.2.840.10040.4.1')
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
class Dss_Parms(univ.Sequence):
|
| 338 |
+
componentType = namedtype.NamedTypes(
|
| 339 |
+
namedtype.NamedType('p', univ.Integer()),
|
| 340 |
+
namedtype.NamedType('q', univ.Integer()),
|
| 341 |
+
namedtype.NamedType('g', univ.Integer())
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
# x400 address syntax starts here
|
| 346 |
+
|
| 347 |
+
teletex_domain_defined_attributes = univ.Integer(6)
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
class TeletexDomainDefinedAttribute(univ.Sequence):
|
| 351 |
+
componentType = namedtype.NamedTypes(
|
| 352 |
+
namedtype.NamedType('type', char.TeletexString().subtype(
|
| 353 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
|
| 354 |
+
namedtype.NamedType('value', char.TeletexString())
|
| 355 |
+
)
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
class TeletexDomainDefinedAttributes(univ.SequenceOf):
|
| 359 |
+
componentType = TeletexDomainDefinedAttribute()
|
| 360 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
terminal_type = univ.Integer(23)
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
class TerminalType(univ.Integer):
|
| 367 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, ub_integer_options)
|
| 368 |
+
namedValues = namedval.NamedValues(
|
| 369 |
+
('telex', 3),
|
| 370 |
+
('teletelex', 4),
|
| 371 |
+
('g3-facsimile', 5),
|
| 372 |
+
('g4-facsimile', 6),
|
| 373 |
+
('ia5-terminal', 7),
|
| 374 |
+
('videotex', 8)
|
| 375 |
+
)
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
class PresentationAddress(univ.Sequence):
|
| 379 |
+
componentType = namedtype.NamedTypes(
|
| 380 |
+
namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
|
| 381 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 382 |
+
namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
|
| 383 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 384 |
+
namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
|
| 385 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 386 |
+
namedtype.OptionalNamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
|
| 387 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3),
|
| 388 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 389 |
+
)
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
extended_network_address = univ.Integer(22)
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
class E163_4_address(univ.Sequence):
|
| 396 |
+
componentType = namedtype.NamedTypes(
|
| 397 |
+
namedtype.NamedType('number', char.NumericString().subtype(
|
| 398 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length),
|
| 399 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 400 |
+
namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(
|
| 401 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length),
|
| 402 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 403 |
+
)
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
class ExtendedNetworkAddress(univ.Choice):
|
| 407 |
+
componentType = namedtype.NamedTypes(
|
| 408 |
+
namedtype.NamedType('e163-4-address', E163_4_address()),
|
| 409 |
+
namedtype.NamedType('psap-address', PresentationAddress().subtype(
|
| 410 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
class PDSParameter(univ.Set):
|
| 415 |
+
componentType = namedtype.NamedTypes(
|
| 416 |
+
namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype(
|
| 417 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))),
|
| 418 |
+
namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
|
| 419 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))
|
| 420 |
+
)
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
local_postal_attributes = univ.Integer(21)
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
class LocalPostalAttributes(PDSParameter):
|
| 427 |
+
pass
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
class UniquePostalName(PDSParameter):
|
| 431 |
+
pass
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
unique_postal_name = univ.Integer(20)
|
| 435 |
+
|
| 436 |
+
poste_restante_address = univ.Integer(19)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
class PosteRestanteAddress(PDSParameter):
|
| 440 |
+
pass
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
post_office_box_address = univ.Integer(18)
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
class PostOfficeBoxAddress(PDSParameter):
|
| 447 |
+
pass
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
street_address = univ.Integer(17)
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
class StreetAddress(PDSParameter):
|
| 454 |
+
pass
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
class UnformattedPostalAddress(univ.Set):
|
| 458 |
+
componentType = namedtype.NamedTypes(
|
| 459 |
+
namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype(
|
| 460 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)).subtype(
|
| 461 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_physical_address_lines)))),
|
| 462 |
+
namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
|
| 463 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length)))
|
| 464 |
+
)
|
| 465 |
+
|
| 466 |
+
|
| 467 |
+
physical_delivery_office_name = univ.Integer(10)
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
class PhysicalDeliveryOfficeName(PDSParameter):
|
| 471 |
+
pass
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
physical_delivery_office_number = univ.Integer(11)
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
class PhysicalDeliveryOfficeNumber(PDSParameter):
|
| 478 |
+
pass
|
| 479 |
+
|
| 480 |
+
|
| 481 |
+
extension_OR_address_components = univ.Integer(12)
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
class ExtensionORAddressComponents(PDSParameter):
|
| 485 |
+
pass
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
physical_delivery_personal_name = univ.Integer(13)
|
| 489 |
+
|
| 490 |
+
|
| 491 |
+
class PhysicalDeliveryPersonalName(PDSParameter):
|
| 492 |
+
pass
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
physical_delivery_organization_name = univ.Integer(14)
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
class PhysicalDeliveryOrganizationName(PDSParameter):
|
| 499 |
+
pass
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
extension_physical_delivery_address_components = univ.Integer(15)
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
class ExtensionPhysicalDeliveryAddressComponents(PDSParameter):
|
| 506 |
+
pass
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
unformatted_postal_address = univ.Integer(16)
|
| 510 |
+
|
| 511 |
+
postal_code = univ.Integer(9)
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
class PostalCode(univ.Choice):
|
| 515 |
+
componentType = namedtype.NamedTypes(
|
| 516 |
+
namedtype.NamedType('numeric-code', char.NumericString().subtype(
|
| 517 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))),
|
| 518 |
+
namedtype.NamedType('printable-code', char.PrintableString().subtype(
|
| 519 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length)))
|
| 520 |
+
)
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
class PhysicalDeliveryCountryName(univ.Choice):
|
| 524 |
+
componentType = namedtype.NamedTypes(
|
| 525 |
+
namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
|
| 526 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length,
|
| 527 |
+
ub_country_name_numeric_length))),
|
| 528 |
+
namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
|
| 529 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
|
| 530 |
+
)
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
class PDSName(char.PrintableString):
|
| 534 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_pds_name_length)
|
| 535 |
+
|
| 536 |
+
|
| 537 |
+
physical_delivery_country_name = univ.Integer(8)
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
class TeletexOrganizationalUnitName(char.TeletexString):
|
| 541 |
+
subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
pds_name = univ.Integer(7)
|
| 545 |
+
|
| 546 |
+
teletex_organizational_unit_names = univ.Integer(5)
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
class TeletexOrganizationalUnitNames(univ.SequenceOf):
|
| 550 |
+
componentType = TeletexOrganizationalUnitName()
|
| 551 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_organizational_units)
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
teletex_personal_name = univ.Integer(4)
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
class TeletexPersonalName(univ.Set):
|
| 558 |
+
componentType = namedtype.NamedTypes(
|
| 559 |
+
namedtype.NamedType('surname', char.TeletexString().subtype(
|
| 560 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length),
|
| 561 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 562 |
+
namedtype.OptionalNamedType('given-name', char.TeletexString().subtype(
|
| 563 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length),
|
| 564 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 565 |
+
namedtype.OptionalNamedType('initials', char.TeletexString().subtype(
|
| 566 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length),
|
| 567 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 568 |
+
namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype(
|
| 569 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length),
|
| 570 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 571 |
+
)
|
| 572 |
+
|
| 573 |
+
|
| 574 |
+
teletex_organization_name = univ.Integer(3)
|
| 575 |
+
|
| 576 |
+
|
| 577 |
+
class TeletexOrganizationName(char.TeletexString):
|
| 578 |
+
subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organization_name_length)
|
| 579 |
+
|
| 580 |
+
|
| 581 |
+
teletex_common_name = univ.Integer(2)
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
class TeletexCommonName(char.TeletexString):
|
| 585 |
+
subtypeSpec = char.TeletexString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_common_name_length)
|
| 586 |
+
|
| 587 |
+
|
| 588 |
+
class CommonName(char.PrintableString):
|
| 589 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_common_name_length)
|
| 590 |
+
|
| 591 |
+
|
| 592 |
+
common_name = univ.Integer(1)
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
class ExtensionAttribute(univ.Sequence):
|
| 596 |
+
componentType = namedtype.NamedTypes(
|
| 597 |
+
namedtype.NamedType('extension-attribute-type', univ.Integer().subtype(
|
| 598 |
+
subtypeSpec=constraint.ValueSizeConstraint(0, ub_extension_attributes),
|
| 599 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 600 |
+
namedtype.NamedType('extension-attribute-value',
|
| 601 |
+
univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 602 |
+
)
|
| 603 |
+
|
| 604 |
+
|
| 605 |
+
class ExtensionAttributes(univ.SetOf):
|
| 606 |
+
componentType = ExtensionAttribute()
|
| 607 |
+
sizeSpec = univ.SetOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_extension_attributes)
|
| 608 |
+
|
| 609 |
+
|
| 610 |
+
class BuiltInDomainDefinedAttribute(univ.Sequence):
|
| 611 |
+
componentType = namedtype.NamedTypes(
|
| 612 |
+
namedtype.NamedType('type', char.PrintableString().subtype(
|
| 613 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
|
| 614 |
+
namedtype.NamedType('value', char.PrintableString().subtype(
|
| 615 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
|
| 616 |
+
)
|
| 617 |
+
|
| 618 |
+
|
| 619 |
+
class BuiltInDomainDefinedAttributes(univ.SequenceOf):
|
| 620 |
+
componentType = BuiltInDomainDefinedAttribute()
|
| 621 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
|
| 622 |
+
|
| 623 |
+
|
| 624 |
+
class OrganizationalUnitName(char.PrintableString):
|
| 625 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
class OrganizationalUnitNames(univ.SequenceOf):
|
| 629 |
+
componentType = OrganizationalUnitName()
|
| 630 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, ub_organizational_units)
|
| 631 |
+
|
| 632 |
+
|
| 633 |
+
class PersonalName(univ.Set):
|
| 634 |
+
componentType = namedtype.NamedTypes(
|
| 635 |
+
namedtype.NamedType('surname', char.PrintableString().subtype(
|
| 636 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length),
|
| 637 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 638 |
+
namedtype.OptionalNamedType('given-name', char.PrintableString().subtype(
|
| 639 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length),
|
| 640 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 641 |
+
namedtype.OptionalNamedType('initials', char.PrintableString().subtype(
|
| 642 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length),
|
| 643 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 644 |
+
namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype(
|
| 645 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length),
|
| 646 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 647 |
+
)
|
| 648 |
+
|
| 649 |
+
|
| 650 |
+
class NumericUserIdentifier(char.NumericString):
|
| 651 |
+
subtypeSpec = char.NumericString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_numeric_user_id_length)
|
| 652 |
+
|
| 653 |
+
|
| 654 |
+
class OrganizationName(char.PrintableString):
|
| 655 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_organization_name_length)
|
| 656 |
+
|
| 657 |
+
|
| 658 |
+
class PrivateDomainName(univ.Choice):
|
| 659 |
+
componentType = namedtype.NamedTypes(
|
| 660 |
+
namedtype.NamedType('numeric', char.NumericString().subtype(
|
| 661 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))),
|
| 662 |
+
namedtype.NamedType('printable', char.PrintableString().subtype(
|
| 663 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length)))
|
| 664 |
+
)
|
| 665 |
+
|
| 666 |
+
|
| 667 |
+
class TerminalIdentifier(char.PrintableString):
|
| 668 |
+
subtypeSpec = char.PrintableString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_terminal_id_length)
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
class X121Address(char.NumericString):
|
| 672 |
+
subtypeSpec = char.NumericString.subtypeSpec + constraint.ValueSizeConstraint(1, ub_x121_address_length)
|
| 673 |
+
|
| 674 |
+
|
| 675 |
+
class NetworkAddress(X121Address):
|
| 676 |
+
pass
|
| 677 |
+
|
| 678 |
+
|
| 679 |
+
class AdministrationDomainName(univ.Choice):
|
| 680 |
+
tagSet = univ.Choice.tagSet.tagExplicitly(
|
| 681 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2)
|
| 682 |
+
)
|
| 683 |
+
componentType = namedtype.NamedTypes(
|
| 684 |
+
namedtype.NamedType('numeric', char.NumericString().subtype(
|
| 685 |
+
subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))),
|
| 686 |
+
namedtype.NamedType('printable', char.PrintableString().subtype(
|
| 687 |
+
subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
|
| 688 |
+
)
|
| 689 |
+
|
| 690 |
+
|
| 691 |
+
class CountryName(univ.Choice):
|
| 692 |
+
tagSet = univ.Choice.tagSet.tagExplicitly(
|
| 693 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1)
|
| 694 |
+
)
|
| 695 |
+
componentType = namedtype.NamedTypes(
|
| 696 |
+
namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
|
| 697 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length,
|
| 698 |
+
ub_country_name_numeric_length))),
|
| 699 |
+
namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
|
| 700 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
|
| 701 |
+
)
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
class BuiltInStandardAttributes(univ.Sequence):
|
| 705 |
+
componentType = namedtype.NamedTypes(
|
| 706 |
+
namedtype.OptionalNamedType('country-name', CountryName()),
|
| 707 |
+
namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()),
|
| 708 |
+
namedtype.OptionalNamedType('network-address', NetworkAddress().subtype(
|
| 709 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 710 |
+
namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype(
|
| 711 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 712 |
+
namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype(
|
| 713 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 714 |
+
namedtype.OptionalNamedType('organization-name', OrganizationName().subtype(
|
| 715 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 716 |
+
namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype(
|
| 717 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 718 |
+
namedtype.OptionalNamedType('personal-name', PersonalName().subtype(
|
| 719 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
|
| 720 |
+
namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype(
|
| 721 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6)))
|
| 722 |
+
)
|
| 723 |
+
|
| 724 |
+
|
| 725 |
+
class ORAddress(univ.Sequence):
|
| 726 |
+
componentType = namedtype.NamedTypes(
|
| 727 |
+
namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()),
|
| 728 |
+
namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()),
|
| 729 |
+
namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes())
|
| 730 |
+
)
|
| 731 |
+
|
| 732 |
+
|
| 733 |
+
#
|
| 734 |
+
# PKIX1Implicit88
|
| 735 |
+
#
|
| 736 |
+
|
| 737 |
+
id_ce_invalidityDate = univ.ObjectIdentifier('2.5.29.24')
|
| 738 |
+
|
| 739 |
+
|
| 740 |
+
class InvalidityDate(useful.GeneralizedTime):
|
| 741 |
+
pass
|
| 742 |
+
|
| 743 |
+
|
| 744 |
+
id_holdinstruction_none = univ.ObjectIdentifier('2.2.840.10040.2.1')
|
| 745 |
+
id_holdinstruction_callissuer = univ.ObjectIdentifier('2.2.840.10040.2.2')
|
| 746 |
+
id_holdinstruction_reject = univ.ObjectIdentifier('2.2.840.10040.2.3')
|
| 747 |
+
|
| 748 |
+
holdInstruction = univ.ObjectIdentifier('2.2.840.10040.2')
|
| 749 |
+
|
| 750 |
+
id_ce_holdInstructionCode = univ.ObjectIdentifier('2.5.29.23')
|
| 751 |
+
|
| 752 |
+
|
| 753 |
+
class HoldInstructionCode(univ.ObjectIdentifier):
|
| 754 |
+
pass
|
| 755 |
+
|
| 756 |
+
|
| 757 |
+
id_ce_cRLReasons = univ.ObjectIdentifier('2.5.29.21')
|
| 758 |
+
|
| 759 |
+
|
| 760 |
+
class CRLReason(univ.Enumerated):
|
| 761 |
+
namedValues = namedval.NamedValues(
|
| 762 |
+
('unspecified', 0),
|
| 763 |
+
('keyCompromise', 1),
|
| 764 |
+
('cACompromise', 2),
|
| 765 |
+
('affiliationChanged', 3),
|
| 766 |
+
('superseded', 4),
|
| 767 |
+
('cessationOfOperation', 5),
|
| 768 |
+
('certificateHold', 6),
|
| 769 |
+
('removeFromCRL', 8)
|
| 770 |
+
)
|
| 771 |
+
|
| 772 |
+
|
| 773 |
+
id_ce_cRLNumber = univ.ObjectIdentifier('2.5.29.20')
|
| 774 |
+
|
| 775 |
+
|
| 776 |
+
class CRLNumber(univ.Integer):
|
| 777 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, MAX)
|
| 778 |
+
|
| 779 |
+
|
| 780 |
+
class BaseCRLNumber(CRLNumber):
|
| 781 |
+
pass
|
| 782 |
+
|
| 783 |
+
|
| 784 |
+
id_kp_serverAuth = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.1')
|
| 785 |
+
id_kp_clientAuth = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.2')
|
| 786 |
+
id_kp_codeSigning = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.3')
|
| 787 |
+
id_kp_emailProtection = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.4')
|
| 788 |
+
id_kp_ipsecEndSystem = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.5')
|
| 789 |
+
id_kp_ipsecTunnel = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.6')
|
| 790 |
+
id_kp_ipsecUser = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.7')
|
| 791 |
+
id_kp_timeStamping = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.8')
|
| 792 |
+
id_pe_authorityInfoAccess = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.1')
|
| 793 |
+
id_ce_extKeyUsage = univ.ObjectIdentifier('2.5.29.37')
|
| 794 |
+
|
| 795 |
+
|
| 796 |
+
class KeyPurposeId(univ.ObjectIdentifier):
|
| 797 |
+
pass
|
| 798 |
+
|
| 799 |
+
|
| 800 |
+
class ExtKeyUsageSyntax(univ.SequenceOf):
|
| 801 |
+
componentType = KeyPurposeId()
|
| 802 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 803 |
+
|
| 804 |
+
|
| 805 |
+
class ReasonFlags(univ.BitString):
|
| 806 |
+
namedValues = namedval.NamedValues(
|
| 807 |
+
('unused', 0),
|
| 808 |
+
('keyCompromise', 1),
|
| 809 |
+
('cACompromise', 2),
|
| 810 |
+
('affiliationChanged', 3),
|
| 811 |
+
('superseded', 4),
|
| 812 |
+
('cessationOfOperation', 5),
|
| 813 |
+
('certificateHold', 6)
|
| 814 |
+
)
|
| 815 |
+
|
| 816 |
+
|
| 817 |
+
class SkipCerts(univ.Integer):
|
| 818 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, MAX)
|
| 819 |
+
|
| 820 |
+
|
| 821 |
+
id_ce_policyConstraints = univ.ObjectIdentifier('2.5.29.36')
|
| 822 |
+
|
| 823 |
+
|
| 824 |
+
class PolicyConstraints(univ.Sequence):
|
| 825 |
+
componentType = namedtype.NamedTypes(
|
| 826 |
+
namedtype.OptionalNamedType('requireExplicitPolicy', SkipCerts().subtype(
|
| 827 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 828 |
+
namedtype.OptionalNamedType('inhibitPolicyMapping', SkipCerts().subtype(
|
| 829 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 830 |
+
)
|
| 831 |
+
|
| 832 |
+
|
| 833 |
+
id_ce_basicConstraints = univ.ObjectIdentifier('2.5.29.19')
|
| 834 |
+
|
| 835 |
+
|
| 836 |
+
class BasicConstraints(univ.Sequence):
|
| 837 |
+
componentType = namedtype.NamedTypes(
|
| 838 |
+
namedtype.DefaultedNamedType('cA', univ.Boolean(False)),
|
| 839 |
+
namedtype.OptionalNamedType('pathLenConstraint',
|
| 840 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
|
| 841 |
+
)
|
| 842 |
+
|
| 843 |
+
|
| 844 |
+
id_ce_subjectDirectoryAttributes = univ.ObjectIdentifier('2.5.29.9')
|
| 845 |
+
|
| 846 |
+
|
| 847 |
+
class EDIPartyName(univ.Sequence):
|
| 848 |
+
componentType = namedtype.NamedTypes(
|
| 849 |
+
namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype(
|
| 850 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 851 |
+
namedtype.NamedType('partyName',
|
| 852 |
+
DirectoryString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 853 |
+
)
|
| 854 |
+
|
| 855 |
+
|
| 856 |
+
|
| 857 |
+
id_ce_deltaCRLIndicator = univ.ObjectIdentifier('2.5.29.27')
|
| 858 |
+
|
| 859 |
+
|
| 860 |
+
|
| 861 |
+
class BaseDistance(univ.Integer):
|
| 862 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, MAX)
|
| 863 |
+
|
| 864 |
+
|
| 865 |
+
id_ce_cRLDistributionPoints = univ.ObjectIdentifier('2.5.29.31')
|
| 866 |
+
|
| 867 |
+
|
| 868 |
+
id_ce_issuingDistributionPoint = univ.ObjectIdentifier('2.5.29.28')
|
| 869 |
+
|
| 870 |
+
|
| 871 |
+
|
| 872 |
+
|
| 873 |
+
id_ce_nameConstraints = univ.ObjectIdentifier('2.5.29.30')
|
| 874 |
+
|
| 875 |
+
|
| 876 |
+
class DisplayText(univ.Choice):
|
| 877 |
+
componentType = namedtype.NamedTypes(
|
| 878 |
+
namedtype.NamedType('visibleString',
|
| 879 |
+
char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 880 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 881 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
|
| 882 |
+
)
|
| 883 |
+
|
| 884 |
+
|
| 885 |
+
class NoticeReference(univ.Sequence):
|
| 886 |
+
componentType = namedtype.NamedTypes(
|
| 887 |
+
namedtype.NamedType('organization', DisplayText()),
|
| 888 |
+
namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer()))
|
| 889 |
+
)
|
| 890 |
+
|
| 891 |
+
|
| 892 |
+
class UserNotice(univ.Sequence):
|
| 893 |
+
componentType = namedtype.NamedTypes(
|
| 894 |
+
namedtype.OptionalNamedType('noticeRef', NoticeReference()),
|
| 895 |
+
namedtype.OptionalNamedType('explicitText', DisplayText())
|
| 896 |
+
)
|
| 897 |
+
|
| 898 |
+
|
| 899 |
+
class CPSuri(char.IA5String):
|
| 900 |
+
pass
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
class PolicyQualifierId(univ.ObjectIdentifier):
|
| 904 |
+
subtypeSpec = univ.ObjectIdentifier.subtypeSpec + constraint.SingleValueConstraint(id_qt_cps, id_qt_unotice)
|
| 905 |
+
|
| 906 |
+
|
| 907 |
+
class CertPolicyId(univ.ObjectIdentifier):
|
| 908 |
+
pass
|
| 909 |
+
|
| 910 |
+
|
| 911 |
+
class PolicyQualifierInfo(univ.Sequence):
|
| 912 |
+
componentType = namedtype.NamedTypes(
|
| 913 |
+
namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
|
| 914 |
+
namedtype.NamedType('qualifier', univ.Any())
|
| 915 |
+
)
|
| 916 |
+
|
| 917 |
+
|
| 918 |
+
id_ce_certificatePolicies = univ.ObjectIdentifier('2.5.29.32')
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
class PolicyInformation(univ.Sequence):
|
| 922 |
+
componentType = namedtype.NamedTypes(
|
| 923 |
+
namedtype.NamedType('policyIdentifier', CertPolicyId()),
|
| 924 |
+
namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo()).subtype(
|
| 925 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 926 |
+
)
|
| 927 |
+
|
| 928 |
+
|
| 929 |
+
class CertificatePolicies(univ.SequenceOf):
|
| 930 |
+
componentType = PolicyInformation()
|
| 931 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 932 |
+
|
| 933 |
+
|
| 934 |
+
id_ce_policyMappings = univ.ObjectIdentifier('2.5.29.33')
|
| 935 |
+
|
| 936 |
+
|
| 937 |
+
class PolicyMapping(univ.Sequence):
|
| 938 |
+
componentType = namedtype.NamedTypes(
|
| 939 |
+
namedtype.NamedType('issuerDomainPolicy', CertPolicyId()),
|
| 940 |
+
namedtype.NamedType('subjectDomainPolicy', CertPolicyId())
|
| 941 |
+
)
|
| 942 |
+
|
| 943 |
+
|
| 944 |
+
class PolicyMappings(univ.SequenceOf):
|
| 945 |
+
componentType = PolicyMapping()
|
| 946 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 947 |
+
|
| 948 |
+
|
| 949 |
+
id_ce_privateKeyUsagePeriod = univ.ObjectIdentifier('2.5.29.16')
|
| 950 |
+
|
| 951 |
+
|
| 952 |
+
class PrivateKeyUsagePeriod(univ.Sequence):
|
| 953 |
+
componentType = namedtype.NamedTypes(
|
| 954 |
+
namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype(
|
| 955 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 956 |
+
namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype(
|
| 957 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 958 |
+
)
|
| 959 |
+
|
| 960 |
+
|
| 961 |
+
id_ce_keyUsage = univ.ObjectIdentifier('2.5.29.15')
|
| 962 |
+
|
| 963 |
+
|
| 964 |
+
class KeyUsage(univ.BitString):
|
| 965 |
+
namedValues = namedval.NamedValues(
|
| 966 |
+
('digitalSignature', 0),
|
| 967 |
+
('nonRepudiation', 1),
|
| 968 |
+
('keyEncipherment', 2),
|
| 969 |
+
('dataEncipherment', 3),
|
| 970 |
+
('keyAgreement', 4),
|
| 971 |
+
('keyCertSign', 5),
|
| 972 |
+
('cRLSign', 6),
|
| 973 |
+
('encipherOnly', 7),
|
| 974 |
+
('decipherOnly', 8)
|
| 975 |
+
)
|
| 976 |
+
|
| 977 |
+
|
| 978 |
+
id_ce = univ.ObjectIdentifier('2.5.29')
|
| 979 |
+
|
| 980 |
+
id_ce_authorityKeyIdentifier = univ.ObjectIdentifier('2.5.29.35')
|
| 981 |
+
|
| 982 |
+
|
| 983 |
+
class KeyIdentifier(univ.OctetString):
|
| 984 |
+
pass
|
| 985 |
+
|
| 986 |
+
|
| 987 |
+
id_ce_subjectKeyIdentifier = univ.ObjectIdentifier('2.5.29.14')
|
| 988 |
+
|
| 989 |
+
|
| 990 |
+
class SubjectKeyIdentifier(KeyIdentifier):
|
| 991 |
+
pass
|
| 992 |
+
|
| 993 |
+
|
| 994 |
+
id_ce_certificateIssuer = univ.ObjectIdentifier('2.5.29.29')
|
| 995 |
+
|
| 996 |
+
|
| 997 |
+
id_ce_subjectAltName = univ.ObjectIdentifier('2.5.29.17')
|
| 998 |
+
|
| 999 |
+
|
| 1000 |
+
id_ce_issuerAltName = univ.ObjectIdentifier('2.5.29.18')
|
| 1001 |
+
|
| 1002 |
+
|
| 1003 |
+
class AttributeValue(univ.Any):
|
| 1004 |
+
pass
|
| 1005 |
+
|
| 1006 |
+
|
| 1007 |
+
class AttributeType(univ.ObjectIdentifier):
|
| 1008 |
+
pass
|
| 1009 |
+
|
| 1010 |
+
certificateAttributesMap = {}
|
| 1011 |
+
|
| 1012 |
+
|
| 1013 |
+
class AttributeTypeAndValue(univ.Sequence):
|
| 1014 |
+
componentType = namedtype.NamedTypes(
|
| 1015 |
+
namedtype.NamedType('type', AttributeType()),
|
| 1016 |
+
namedtype.NamedType('value', AttributeValue(),
|
| 1017 |
+
openType=opentype.OpenType('type', certificateAttributesMap))
|
| 1018 |
+
)
|
| 1019 |
+
|
| 1020 |
+
|
| 1021 |
+
class Attribute(univ.Sequence):
|
| 1022 |
+
componentType = namedtype.NamedTypes(
|
| 1023 |
+
namedtype.NamedType('type', AttributeType()),
|
| 1024 |
+
namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
|
| 1025 |
+
)
|
| 1026 |
+
|
| 1027 |
+
|
| 1028 |
+
class SubjectDirectoryAttributes(univ.SequenceOf):
|
| 1029 |
+
componentType = Attribute()
|
| 1030 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1031 |
+
|
| 1032 |
+
|
| 1033 |
+
class RelativeDistinguishedName(univ.SetOf):
|
| 1034 |
+
componentType = AttributeTypeAndValue()
|
| 1035 |
+
|
| 1036 |
+
|
| 1037 |
+
class RDNSequence(univ.SequenceOf):
|
| 1038 |
+
componentType = RelativeDistinguishedName()
|
| 1039 |
+
|
| 1040 |
+
|
| 1041 |
+
class Name(univ.Choice):
|
| 1042 |
+
componentType = namedtype.NamedTypes(
|
| 1043 |
+
namedtype.NamedType('', RDNSequence())
|
| 1044 |
+
)
|
| 1045 |
+
|
| 1046 |
+
class CertificateSerialNumber(univ.Integer):
|
| 1047 |
+
pass
|
| 1048 |
+
|
| 1049 |
+
|
| 1050 |
+
class AnotherName(univ.Sequence):
|
| 1051 |
+
componentType = namedtype.NamedTypes(
|
| 1052 |
+
namedtype.NamedType('type-id', univ.ObjectIdentifier()),
|
| 1053 |
+
namedtype.NamedType('value',
|
| 1054 |
+
univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 1055 |
+
)
|
| 1056 |
+
|
| 1057 |
+
|
| 1058 |
+
class GeneralName(univ.Choice):
|
| 1059 |
+
componentType = namedtype.NamedTypes(
|
| 1060 |
+
namedtype.NamedType('otherName',
|
| 1061 |
+
AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1062 |
+
namedtype.NamedType('rfc822Name',
|
| 1063 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1064 |
+
namedtype.NamedType('dNSName',
|
| 1065 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 1066 |
+
namedtype.NamedType('x400Address',
|
| 1067 |
+
ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 1068 |
+
namedtype.NamedType('directoryName',
|
| 1069 |
+
Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 1070 |
+
namedtype.NamedType('ediPartyName',
|
| 1071 |
+
EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
|
| 1072 |
+
namedtype.NamedType('uniformResourceIdentifier',
|
| 1073 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
|
| 1074 |
+
namedtype.NamedType('iPAddress', univ.OctetString().subtype(
|
| 1075 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 1076 |
+
namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype(
|
| 1077 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)))
|
| 1078 |
+
)
|
| 1079 |
+
|
| 1080 |
+
|
| 1081 |
+
class GeneralNames(univ.SequenceOf):
|
| 1082 |
+
componentType = GeneralName()
|
| 1083 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1084 |
+
|
| 1085 |
+
|
| 1086 |
+
class AccessDescription(univ.Sequence):
|
| 1087 |
+
componentType = namedtype.NamedTypes(
|
| 1088 |
+
namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
|
| 1089 |
+
namedtype.NamedType('accessLocation', GeneralName())
|
| 1090 |
+
)
|
| 1091 |
+
|
| 1092 |
+
|
| 1093 |
+
class AuthorityInfoAccessSyntax(univ.SequenceOf):
|
| 1094 |
+
componentType = AccessDescription()
|
| 1095 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1096 |
+
|
| 1097 |
+
|
| 1098 |
+
class AuthorityKeyIdentifier(univ.Sequence):
|
| 1099 |
+
componentType = namedtype.NamedTypes(
|
| 1100 |
+
namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype(
|
| 1101 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1102 |
+
namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype(
|
| 1103 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1104 |
+
namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype(
|
| 1105 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 1106 |
+
)
|
| 1107 |
+
|
| 1108 |
+
|
| 1109 |
+
class DistributionPointName(univ.Choice):
|
| 1110 |
+
componentType = namedtype.NamedTypes(
|
| 1111 |
+
namedtype.NamedType('fullName', GeneralNames().subtype(
|
| 1112 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1113 |
+
namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype(
|
| 1114 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 1115 |
+
)
|
| 1116 |
+
|
| 1117 |
+
|
| 1118 |
+
class DistributionPoint(univ.Sequence):
|
| 1119 |
+
componentType = namedtype.NamedTypes(
|
| 1120 |
+
namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
|
| 1121 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1122 |
+
namedtype.OptionalNamedType('reasons', ReasonFlags().subtype(
|
| 1123 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1124 |
+
namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype(
|
| 1125 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
| 1126 |
+
)
|
| 1127 |
+
|
| 1128 |
+
|
| 1129 |
+
class CRLDistPointsSyntax(univ.SequenceOf):
|
| 1130 |
+
componentType = DistributionPoint()
|
| 1131 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1132 |
+
|
| 1133 |
+
|
| 1134 |
+
class IssuingDistributionPoint(univ.Sequence):
|
| 1135 |
+
componentType = namedtype.NamedTypes(
|
| 1136 |
+
namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
|
| 1137 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1138 |
+
namedtype.NamedType('onlyContainsUserCerts', univ.Boolean(False).subtype(
|
| 1139 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1140 |
+
namedtype.NamedType('onlyContainsCACerts', univ.Boolean(False).subtype(
|
| 1141 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 1142 |
+
namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype(
|
| 1143 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 1144 |
+
namedtype.NamedType('indirectCRL', univ.Boolean(False).subtype(
|
| 1145 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 1146 |
+
)
|
| 1147 |
+
|
| 1148 |
+
|
| 1149 |
+
class GeneralSubtree(univ.Sequence):
|
| 1150 |
+
componentType = namedtype.NamedTypes(
|
| 1151 |
+
namedtype.NamedType('base', GeneralName()),
|
| 1152 |
+
namedtype.DefaultedNamedType('minimum', BaseDistance(0).subtype(
|
| 1153 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1154 |
+
namedtype.OptionalNamedType('maximum', BaseDistance().subtype(
|
| 1155 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 1156 |
+
)
|
| 1157 |
+
|
| 1158 |
+
|
| 1159 |
+
class GeneralSubtrees(univ.SequenceOf):
|
| 1160 |
+
componentType = GeneralSubtree()
|
| 1161 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1162 |
+
|
| 1163 |
+
|
| 1164 |
+
class NameConstraints(univ.Sequence):
|
| 1165 |
+
componentType = namedtype.NamedTypes(
|
| 1166 |
+
namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype(
|
| 1167 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1168 |
+
namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype(
|
| 1169 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 1170 |
+
)
|
| 1171 |
+
|
| 1172 |
+
|
| 1173 |
+
class CertificateIssuer(GeneralNames):
|
| 1174 |
+
pass
|
| 1175 |
+
|
| 1176 |
+
|
| 1177 |
+
class SubjectAltName(GeneralNames):
|
| 1178 |
+
pass
|
| 1179 |
+
|
| 1180 |
+
|
| 1181 |
+
class IssuerAltName(GeneralNames):
|
| 1182 |
+
pass
|
| 1183 |
+
|
| 1184 |
+
|
| 1185 |
+
certificateExtensionsMap = {}
|
| 1186 |
+
|
| 1187 |
+
|
| 1188 |
+
class Extension(univ.Sequence):
|
| 1189 |
+
componentType = namedtype.NamedTypes(
|
| 1190 |
+
namedtype.NamedType('extnID', univ.ObjectIdentifier()),
|
| 1191 |
+
namedtype.DefaultedNamedType('critical', univ.Boolean('False')),
|
| 1192 |
+
namedtype.NamedType('extnValue', univ.OctetString(),
|
| 1193 |
+
openType=opentype.OpenType('extnID', certificateExtensionsMap))
|
| 1194 |
+
)
|
| 1195 |
+
|
| 1196 |
+
|
| 1197 |
+
class Extensions(univ.SequenceOf):
|
| 1198 |
+
componentType = Extension()
|
| 1199 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 1200 |
+
|
| 1201 |
+
|
| 1202 |
+
class SubjectPublicKeyInfo(univ.Sequence):
|
| 1203 |
+
componentType = namedtype.NamedTypes(
|
| 1204 |
+
namedtype.NamedType('algorithm', AlgorithmIdentifier()),
|
| 1205 |
+
namedtype.NamedType('subjectPublicKey', univ.BitString())
|
| 1206 |
+
)
|
| 1207 |
+
|
| 1208 |
+
|
| 1209 |
+
class UniqueIdentifier(univ.BitString):
|
| 1210 |
+
pass
|
| 1211 |
+
|
| 1212 |
+
|
| 1213 |
+
class Time(univ.Choice):
|
| 1214 |
+
componentType = namedtype.NamedTypes(
|
| 1215 |
+
namedtype.NamedType('utcTime', useful.UTCTime()),
|
| 1216 |
+
namedtype.NamedType('generalTime', useful.GeneralizedTime())
|
| 1217 |
+
)
|
| 1218 |
+
|
| 1219 |
+
|
| 1220 |
+
class Validity(univ.Sequence):
|
| 1221 |
+
componentType = namedtype.NamedTypes(
|
| 1222 |
+
namedtype.NamedType('notBefore', Time()),
|
| 1223 |
+
namedtype.NamedType('notAfter', Time())
|
| 1224 |
+
)
|
| 1225 |
+
|
| 1226 |
+
|
| 1227 |
+
class Version(univ.Integer):
|
| 1228 |
+
namedValues = namedval.NamedValues(
|
| 1229 |
+
('v1', 0), ('v2', 1), ('v3', 2)
|
| 1230 |
+
)
|
| 1231 |
+
|
| 1232 |
+
|
| 1233 |
+
class TBSCertificate(univ.Sequence):
|
| 1234 |
+
componentType = namedtype.NamedTypes(
|
| 1235 |
+
namedtype.DefaultedNamedType('version', Version('v1').subtype(
|
| 1236 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1237 |
+
namedtype.NamedType('serialNumber', CertificateSerialNumber()),
|
| 1238 |
+
namedtype.NamedType('signature', AlgorithmIdentifier()),
|
| 1239 |
+
namedtype.NamedType('issuer', Name()),
|
| 1240 |
+
namedtype.NamedType('validity', Validity()),
|
| 1241 |
+
namedtype.NamedType('subject', Name()),
|
| 1242 |
+
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
|
| 1243 |
+
namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype(
|
| 1244 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1245 |
+
namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype(
|
| 1246 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 1247 |
+
namedtype.OptionalNamedType('extensions', Extensions().subtype(
|
| 1248 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 1249 |
+
)
|
| 1250 |
+
|
| 1251 |
+
|
| 1252 |
+
class Certificate(univ.Sequence):
|
| 1253 |
+
componentType = namedtype.NamedTypes(
|
| 1254 |
+
namedtype.NamedType('tbsCertificate', TBSCertificate()),
|
| 1255 |
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
| 1256 |
+
namedtype.NamedType('signatureValue', univ.BitString())
|
| 1257 |
+
)
|
| 1258 |
+
|
| 1259 |
+
# CRL structures
|
| 1260 |
+
|
| 1261 |
+
class RevokedCertificate(univ.Sequence):
|
| 1262 |
+
componentType = namedtype.NamedTypes(
|
| 1263 |
+
namedtype.NamedType('userCertificate', CertificateSerialNumber()),
|
| 1264 |
+
namedtype.NamedType('revocationDate', Time()),
|
| 1265 |
+
namedtype.OptionalNamedType('crlEntryExtensions', Extensions())
|
| 1266 |
+
)
|
| 1267 |
+
|
| 1268 |
+
|
| 1269 |
+
class TBSCertList(univ.Sequence):
|
| 1270 |
+
componentType = namedtype.NamedTypes(
|
| 1271 |
+
namedtype.OptionalNamedType('version', Version()),
|
| 1272 |
+
namedtype.NamedType('signature', AlgorithmIdentifier()),
|
| 1273 |
+
namedtype.NamedType('issuer', Name()),
|
| 1274 |
+
namedtype.NamedType('thisUpdate', Time()),
|
| 1275 |
+
namedtype.OptionalNamedType('nextUpdate', Time()),
|
| 1276 |
+
namedtype.OptionalNamedType('revokedCertificates', univ.SequenceOf(componentType=RevokedCertificate())),
|
| 1277 |
+
namedtype.OptionalNamedType('crlExtensions', Extensions().subtype(
|
| 1278 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 1279 |
+
)
|
| 1280 |
+
|
| 1281 |
+
|
| 1282 |
+
class CertificateList(univ.Sequence):
|
| 1283 |
+
componentType = namedtype.NamedTypes(
|
| 1284 |
+
namedtype.NamedType('tbsCertList', TBSCertList()),
|
| 1285 |
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
| 1286 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 1287 |
+
)
|
| 1288 |
+
|
| 1289 |
+
# map of AttributeType -> AttributeValue
|
| 1290 |
+
|
| 1291 |
+
_certificateAttributesMapUpdate = {
|
| 1292 |
+
id_at_name: X520name(),
|
| 1293 |
+
id_at_surname: X520name(),
|
| 1294 |
+
id_at_givenName: X520name(),
|
| 1295 |
+
id_at_initials: X520name(),
|
| 1296 |
+
id_at_generationQualifier: X520name(),
|
| 1297 |
+
id_at_commonName: X520CommonName(),
|
| 1298 |
+
id_at_localityName: X520LocalityName(),
|
| 1299 |
+
id_at_stateOrProvinceName: X520StateOrProvinceName(),
|
| 1300 |
+
id_at_organizationName: X520OrganizationName(),
|
| 1301 |
+
id_at_organizationalUnitName: X520OrganizationalUnitName(),
|
| 1302 |
+
id_at_title: X520Title(),
|
| 1303 |
+
id_at_dnQualifier: X520dnQualifier(),
|
| 1304 |
+
id_at_countryName: X520countryName(),
|
| 1305 |
+
emailAddress: Pkcs9email(),
|
| 1306 |
+
}
|
| 1307 |
+
|
| 1308 |
+
certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
| 1309 |
+
|
| 1310 |
+
|
| 1311 |
+
# map of Certificate Extension OIDs to Extensions
|
| 1312 |
+
|
| 1313 |
+
_certificateExtensionsMapUpdate = {
|
| 1314 |
+
id_ce_authorityKeyIdentifier: AuthorityKeyIdentifier(),
|
| 1315 |
+
id_ce_subjectKeyIdentifier: SubjectKeyIdentifier(),
|
| 1316 |
+
id_ce_keyUsage: KeyUsage(),
|
| 1317 |
+
id_ce_privateKeyUsagePeriod: PrivateKeyUsagePeriod(),
|
| 1318 |
+
id_ce_certificatePolicies: CertificatePolicies(),
|
| 1319 |
+
id_ce_policyMappings: PolicyMappings(),
|
| 1320 |
+
id_ce_subjectAltName: SubjectAltName(),
|
| 1321 |
+
id_ce_issuerAltName: IssuerAltName(),
|
| 1322 |
+
id_ce_subjectDirectoryAttributes: SubjectDirectoryAttributes(),
|
| 1323 |
+
id_ce_basicConstraints: BasicConstraints(),
|
| 1324 |
+
id_ce_nameConstraints: NameConstraints(),
|
| 1325 |
+
id_ce_policyConstraints: PolicyConstraints(),
|
| 1326 |
+
id_ce_extKeyUsage: ExtKeyUsageSyntax(),
|
| 1327 |
+
id_ce_cRLDistributionPoints: CRLDistPointsSyntax(),
|
| 1328 |
+
id_pe_authorityInfoAccess: AuthorityInfoAccessSyntax(),
|
| 1329 |
+
id_ce_cRLNumber: univ.Integer(),
|
| 1330 |
+
id_ce_deltaCRLIndicator: BaseCRLNumber(),
|
| 1331 |
+
id_ce_issuingDistributionPoint: IssuingDistributionPoint(),
|
| 1332 |
+
id_ce_cRLReasons: CRLReason(),
|
| 1333 |
+
id_ce_holdInstructionCode: univ.ObjectIdentifier(),
|
| 1334 |
+
id_ce_invalidityDate: useful.GeneralizedTime(),
|
| 1335 |
+
id_ce_certificateIssuer: GeneralNames(),
|
| 1336 |
+
}
|
| 1337 |
+
|
| 1338 |
+
certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
| 1339 |
+
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2511.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# X.509 certificate Request Message Format (CRMF) syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://tools.ietf.org/html/rfc2511
|
| 11 |
+
#
|
| 12 |
+
# Sample captures could be obtained with OpenSSL
|
| 13 |
+
#
|
| 14 |
+
from pyasn1_modules import rfc2315
|
| 15 |
+
from pyasn1_modules.rfc2459 import *
|
| 16 |
+
|
| 17 |
+
MAX = float('inf')
|
| 18 |
+
|
| 19 |
+
id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
|
| 20 |
+
id_pkip = univ.ObjectIdentifier('1.3.6.1.5.5.7.5')
|
| 21 |
+
id_regCtrl = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1')
|
| 22 |
+
id_regCtrl_regToken = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.1')
|
| 23 |
+
id_regCtrl_authenticator = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.2')
|
| 24 |
+
id_regCtrl_pkiPublicationInfo = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.3')
|
| 25 |
+
id_regCtrl_pkiArchiveOptions = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.4')
|
| 26 |
+
id_regCtrl_oldCertID = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.5')
|
| 27 |
+
id_regCtrl_protocolEncrKey = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.6')
|
| 28 |
+
id_regInfo = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2')
|
| 29 |
+
id_regInfo_utf8Pairs = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2.1')
|
| 30 |
+
id_regInfo_certReq = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.2.2')
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# This should be in PKIX Certificate Extensions module
|
| 34 |
+
|
| 35 |
+
class GeneralName(univ.OctetString):
|
| 36 |
+
pass
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# end of PKIX Certificate Extensions module
|
| 40 |
+
|
| 41 |
+
class UTF8Pairs(char.UTF8String):
|
| 42 |
+
pass
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class ProtocolEncrKey(SubjectPublicKeyInfo):
|
| 46 |
+
pass
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class CertId(univ.Sequence):
|
| 50 |
+
componentType = namedtype.NamedTypes(
|
| 51 |
+
namedtype.NamedType('issuer', GeneralName()),
|
| 52 |
+
namedtype.NamedType('serialNumber', univ.Integer())
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class OldCertId(CertId):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class KeyGenParameters(univ.OctetString):
|
| 61 |
+
pass
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class EncryptedValue(univ.Sequence):
|
| 65 |
+
componentType = namedtype.NamedTypes(
|
| 66 |
+
namedtype.OptionalNamedType('intendedAlg', AlgorithmIdentifier().subtype(
|
| 67 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 68 |
+
namedtype.OptionalNamedType('symmAlg', AlgorithmIdentifier().subtype(
|
| 69 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 70 |
+
namedtype.OptionalNamedType('encSymmKey', univ.BitString().subtype(
|
| 71 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 72 |
+
namedtype.OptionalNamedType('keyAlg', AlgorithmIdentifier().subtype(
|
| 73 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 74 |
+
namedtype.OptionalNamedType('valueHint', univ.OctetString().subtype(
|
| 75 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 76 |
+
namedtype.NamedType('encValue', univ.BitString())
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class EncryptedKey(univ.Choice):
|
| 81 |
+
componentType = namedtype.NamedTypes(
|
| 82 |
+
namedtype.NamedType('encryptedValue', EncryptedValue()),
|
| 83 |
+
namedtype.NamedType('envelopedData', rfc2315.EnvelopedData().subtype(
|
| 84 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
class PKIArchiveOptions(univ.Choice):
|
| 89 |
+
componentType = namedtype.NamedTypes(
|
| 90 |
+
namedtype.NamedType('encryptedPrivKey', EncryptedKey().subtype(
|
| 91 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 92 |
+
namedtype.NamedType('keyGenParameters', KeyGenParameters().subtype(
|
| 93 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 94 |
+
namedtype.NamedType('archiveRemGenPrivKey',
|
| 95 |
+
univ.Boolean().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class SinglePubInfo(univ.Sequence):
|
| 100 |
+
componentType = namedtype.NamedTypes(
|
| 101 |
+
namedtype.NamedType('pubMethod', univ.Integer(
|
| 102 |
+
namedValues=namedval.NamedValues(('dontCare', 0), ('x500', 1), ('web', 2), ('ldap', 3)))),
|
| 103 |
+
namedtype.OptionalNamedType('pubLocation', GeneralName())
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class PKIPublicationInfo(univ.Sequence):
|
| 108 |
+
componentType = namedtype.NamedTypes(
|
| 109 |
+
namedtype.NamedType('action',
|
| 110 |
+
univ.Integer(namedValues=namedval.NamedValues(('dontPublish', 0), ('pleasePublish', 1)))),
|
| 111 |
+
namedtype.OptionalNamedType('pubInfos', univ.SequenceOf(componentType=SinglePubInfo()).subtype(
|
| 112 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class Authenticator(char.UTF8String):
|
| 117 |
+
pass
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
class RegToken(char.UTF8String):
|
| 121 |
+
pass
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class SubsequentMessage(univ.Integer):
|
| 125 |
+
namedValues = namedval.NamedValues(
|
| 126 |
+
('encrCert', 0),
|
| 127 |
+
('challengeResp', 1)
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
class POPOPrivKey(univ.Choice):
|
| 132 |
+
componentType = namedtype.NamedTypes(
|
| 133 |
+
namedtype.NamedType('thisMessage',
|
| 134 |
+
univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 135 |
+
namedtype.NamedType('subsequentMessage', SubsequentMessage().subtype(
|
| 136 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 137 |
+
namedtype.NamedType('dhMAC',
|
| 138 |
+
univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class PBMParameter(univ.Sequence):
|
| 143 |
+
componentType = namedtype.NamedTypes(
|
| 144 |
+
namedtype.NamedType('salt', univ.OctetString()),
|
| 145 |
+
namedtype.NamedType('owf', AlgorithmIdentifier()),
|
| 146 |
+
namedtype.NamedType('iterationCount', univ.Integer()),
|
| 147 |
+
namedtype.NamedType('mac', AlgorithmIdentifier())
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
class PKMACValue(univ.Sequence):
|
| 152 |
+
componentType = namedtype.NamedTypes(
|
| 153 |
+
namedtype.NamedType('algId', AlgorithmIdentifier()),
|
| 154 |
+
namedtype.NamedType('value', univ.BitString())
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class POPOSigningKeyInput(univ.Sequence):
|
| 159 |
+
componentType = namedtype.NamedTypes(
|
| 160 |
+
namedtype.NamedType(
|
| 161 |
+
'authInfo', univ.Choice(
|
| 162 |
+
componentType=namedtype.NamedTypes(
|
| 163 |
+
namedtype.NamedType(
|
| 164 |
+
'sender', GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
|
| 165 |
+
),
|
| 166 |
+
namedtype.NamedType('publicKeyMAC', PKMACValue())
|
| 167 |
+
)
|
| 168 |
+
)
|
| 169 |
+
),
|
| 170 |
+
namedtype.NamedType('publicKey', SubjectPublicKeyInfo())
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
class POPOSigningKey(univ.Sequence):
|
| 175 |
+
componentType = namedtype.NamedTypes(
|
| 176 |
+
namedtype.OptionalNamedType('poposkInput', POPOSigningKeyInput().subtype(
|
| 177 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 178 |
+
namedtype.NamedType('algorithmIdentifier', AlgorithmIdentifier()),
|
| 179 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class ProofOfPossession(univ.Choice):
|
| 184 |
+
componentType = namedtype.NamedTypes(
|
| 185 |
+
namedtype.NamedType('raVerified',
|
| 186 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 187 |
+
namedtype.NamedType('signature', POPOSigningKey().subtype(
|
| 188 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 189 |
+
namedtype.NamedType('keyEncipherment', POPOPrivKey().subtype(
|
| 190 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 191 |
+
namedtype.NamedType('keyAgreement', POPOPrivKey().subtype(
|
| 192 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
class Controls(univ.SequenceOf):
|
| 197 |
+
componentType = AttributeTypeAndValue()
|
| 198 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class OptionalValidity(univ.Sequence):
|
| 202 |
+
componentType = namedtype.NamedTypes(
|
| 203 |
+
namedtype.OptionalNamedType('notBefore',
|
| 204 |
+
Time().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 205 |
+
namedtype.OptionalNamedType('notAfter',
|
| 206 |
+
Time().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 207 |
+
)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class CertTemplate(univ.Sequence):
|
| 211 |
+
componentType = namedtype.NamedTypes(
|
| 212 |
+
namedtype.OptionalNamedType('version', Version().subtype(
|
| 213 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 214 |
+
namedtype.OptionalNamedType('serialNumber', univ.Integer().subtype(
|
| 215 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 216 |
+
namedtype.OptionalNamedType('signingAlg', AlgorithmIdentifier().subtype(
|
| 217 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 218 |
+
namedtype.OptionalNamedType('issuer', Name().subtype(
|
| 219 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 220 |
+
namedtype.OptionalNamedType('validity', OptionalValidity().subtype(
|
| 221 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 222 |
+
namedtype.OptionalNamedType('subject', Name().subtype(
|
| 223 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 224 |
+
namedtype.OptionalNamedType('publicKey', SubjectPublicKeyInfo().subtype(
|
| 225 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
|
| 226 |
+
namedtype.OptionalNamedType('issuerUID', UniqueIdentifier().subtype(
|
| 227 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 228 |
+
namedtype.OptionalNamedType('subjectUID', UniqueIdentifier().subtype(
|
| 229 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))),
|
| 230 |
+
namedtype.OptionalNamedType('extensions', Extensions().subtype(
|
| 231 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class CertRequest(univ.Sequence):
|
| 236 |
+
componentType = namedtype.NamedTypes(
|
| 237 |
+
namedtype.NamedType('certReqId', univ.Integer()),
|
| 238 |
+
namedtype.NamedType('certTemplate', CertTemplate()),
|
| 239 |
+
namedtype.OptionalNamedType('controls', Controls())
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class CertReq(CertRequest):
|
| 244 |
+
pass
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
class CertReqMsg(univ.Sequence):
|
| 248 |
+
componentType = namedtype.NamedTypes(
|
| 249 |
+
namedtype.NamedType('certReq', CertRequest()),
|
| 250 |
+
namedtype.OptionalNamedType('pop', ProofOfPossession()),
|
| 251 |
+
namedtype.OptionalNamedType('regInfo', univ.SequenceOf(componentType=AttributeTypeAndValue()).subtype(
|
| 252 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
class CertReqMessages(univ.SequenceOf):
|
| 257 |
+
componentType = CertReqMsg()
|
| 258 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2631.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/rfc2631.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid5897
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import tag
|
| 19 |
+
from pyasn1.type import univ
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class KeySpecificInfo(univ.Sequence):
|
| 23 |
+
componentType = namedtype.NamedTypes(
|
| 24 |
+
namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
|
| 25 |
+
namedtype.NamedType('counter', univ.OctetString().subtype(
|
| 26 |
+
subtypeSpec=constraint.ValueSizeConstraint(4, 4)))
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class OtherInfo(univ.Sequence):
|
| 31 |
+
componentType = namedtype.NamedTypes(
|
| 32 |
+
namedtype.NamedType('keyInfo', KeySpecificInfo()),
|
| 33 |
+
namedtype.OptionalNamedType('partyAInfo', univ.OctetString().subtype(
|
| 34 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 35 |
+
namedtype.NamedType('suppPubInfo', univ.OctetString().subtype(
|
| 36 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 37 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2876.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# KEA and SKIPJACK Algorithms in CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc2876.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import namedtype
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
from pyasn1_modules import rfc5751
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
id_fortezzaConfidentialityAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.4')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
id_fortezzaWrap80 = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.23')
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
id_kEAKeyEncryptionAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.24')
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
id_keyExchangeAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.1.22')
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class Skipjack_Parm(univ.Sequence):
|
| 35 |
+
componentType = namedtype.NamedTypes(
|
| 36 |
+
namedtype.NamedType('initialization-vector', univ.OctetString())
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Update the Algorithm Identifier map in rfc5280.py.
|
| 41 |
+
|
| 42 |
+
_algorithmIdentifierMapUpdate = {
|
| 43 |
+
id_fortezzaConfidentialityAlgorithm: Skipjack_Parm(),
|
| 44 |
+
id_kEAKeyEncryptionAlgorithm: rfc5280.AlgorithmIdentifier(),
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# Update the SMIMECapabilities Attribute map in rfc5751.py
|
| 51 |
+
|
| 52 |
+
_smimeCapabilityMapUpdate = {
|
| 53 |
+
id_kEAKeyEncryptionAlgorithm: rfc5280.AlgorithmIdentifier(),
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc2985.py
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# PKCS#9: Selected Attribute Types (Version 2.0)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc2985.txt
|
| 13 |
+
#
|
| 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 opentype
|
| 20 |
+
from pyasn1.type import tag
|
| 21 |
+
from pyasn1.type import univ
|
| 22 |
+
from pyasn1.type import useful
|
| 23 |
+
|
| 24 |
+
from pyasn1_modules import rfc7292
|
| 25 |
+
from pyasn1_modules import rfc5958
|
| 26 |
+
from pyasn1_modules import rfc5652
|
| 27 |
+
from pyasn1_modules import rfc5280
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _OID(*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 |
+
MAX = float('inf')
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Imports from RFC 5280
|
| 45 |
+
|
| 46 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 47 |
+
|
| 48 |
+
Attribute = rfc5280.Attribute
|
| 49 |
+
|
| 50 |
+
EmailAddress = rfc5280.EmailAddress
|
| 51 |
+
|
| 52 |
+
Extensions = rfc5280.Extensions
|
| 53 |
+
|
| 54 |
+
Time = rfc5280.Time
|
| 55 |
+
|
| 56 |
+
X520countryName = rfc5280.X520countryName
|
| 57 |
+
|
| 58 |
+
X520SerialNumber = rfc5280.X520SerialNumber
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
# Imports from RFC 5652
|
| 62 |
+
|
| 63 |
+
ContentInfo = rfc5652.ContentInfo
|
| 64 |
+
|
| 65 |
+
ContentType = rfc5652.ContentType
|
| 66 |
+
|
| 67 |
+
Countersignature = rfc5652.Countersignature
|
| 68 |
+
|
| 69 |
+
MessageDigest = rfc5652.MessageDigest
|
| 70 |
+
|
| 71 |
+
SignerInfo = rfc5652.SignerInfo
|
| 72 |
+
|
| 73 |
+
SigningTime = rfc5652.SigningTime
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
# Imports from RFC 5958
|
| 77 |
+
|
| 78 |
+
EncryptedPrivateKeyInfo = rfc5958.EncryptedPrivateKeyInfo
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
# Imports from RFC 7292
|
| 82 |
+
|
| 83 |
+
PFX = rfc7292.PFX
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# TODO:
|
| 87 |
+
# Need a place to import PKCS15Token; it does not yet appear in an RFC
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
# SingleAttribute is the same as Attribute in RFC 5280, except that the
|
| 91 |
+
# attrValues SET must have one and only one member
|
| 92 |
+
|
| 93 |
+
class AttributeType(univ.ObjectIdentifier):
|
| 94 |
+
pass
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class AttributeValue(univ.Any):
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class AttributeValues(univ.SetOf):
|
| 102 |
+
pass
|
| 103 |
+
|
| 104 |
+
AttributeValues.componentType = AttributeValue()
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class SingleAttributeValues(univ.SetOf):
|
| 108 |
+
pass
|
| 109 |
+
|
| 110 |
+
SingleAttributeValues.componentType = AttributeValue()
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class SingleAttribute(univ.Sequence):
|
| 114 |
+
pass
|
| 115 |
+
|
| 116 |
+
SingleAttribute.componentType = namedtype.NamedTypes(
|
| 117 |
+
namedtype.NamedType('type', AttributeType()),
|
| 118 |
+
namedtype.NamedType('values',
|
| 119 |
+
AttributeValues().subtype(sizeSpec=constraint.ValueSizeConstraint(1, 1)),
|
| 120 |
+
openType=opentype.OpenType('type', rfc5280.certificateAttributesMap)
|
| 121 |
+
)
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# CMSAttribute is the same as Attribute in RFC 5652, and CMSSingleAttribute
|
| 126 |
+
# is the companion where the attrValues SET must have one and only one member
|
| 127 |
+
|
| 128 |
+
CMSAttribute = rfc5652.Attribute
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
class CMSSingleAttribute(univ.Sequence):
|
| 132 |
+
pass
|
| 133 |
+
|
| 134 |
+
CMSSingleAttribute.componentType = namedtype.NamedTypes(
|
| 135 |
+
namedtype.NamedType('attrType', AttributeType()),
|
| 136 |
+
namedtype.NamedType('attrValues',
|
| 137 |
+
AttributeValues().subtype(sizeSpec=constraint.ValueSizeConstraint(1, 1)),
|
| 138 |
+
openType=opentype.OpenType('attrType', rfc5652.cmsAttributesMap)
|
| 139 |
+
)
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
# DirectoryString is the same as RFC 5280, except the length is limited to 255
|
| 144 |
+
|
| 145 |
+
class DirectoryString(univ.Choice):
|
| 146 |
+
pass
|
| 147 |
+
|
| 148 |
+
DirectoryString.componentType = namedtype.NamedTypes(
|
| 149 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 150 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
| 151 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 152 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
| 153 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 154 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
| 155 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 156 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
| 157 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
| 158 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255)))
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
# PKCS9String is DirectoryString with an additional choice of IA5String,
|
| 163 |
+
# and the SIZE is limited to 255
|
| 164 |
+
|
| 165 |
+
class PKCS9String(univ.Choice):
|
| 166 |
+
pass
|
| 167 |
+
|
| 168 |
+
PKCS9String.componentType = namedtype.NamedTypes(
|
| 169 |
+
namedtype.NamedType('ia5String', char.IA5String().subtype(
|
| 170 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 255))),
|
| 171 |
+
namedtype.NamedType('directoryString', DirectoryString())
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# Upper Bounds
|
| 176 |
+
|
| 177 |
+
pkcs_9_ub_pkcs9String = univ.Integer(255)
|
| 178 |
+
|
| 179 |
+
pkcs_9_ub_challengePassword = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 180 |
+
|
| 181 |
+
pkcs_9_ub_emailAddress = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 182 |
+
|
| 183 |
+
pkcs_9_ub_friendlyName = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 184 |
+
|
| 185 |
+
pkcs_9_ub_match = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 186 |
+
|
| 187 |
+
pkcs_9_ub_signingDescription = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 188 |
+
|
| 189 |
+
pkcs_9_ub_unstructuredAddress = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 190 |
+
|
| 191 |
+
pkcs_9_ub_unstructuredName = univ.Integer(pkcs_9_ub_pkcs9String)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
ub_name = univ.Integer(32768)
|
| 195 |
+
|
| 196 |
+
pkcs_9_ub_placeOfBirth = univ.Integer(ub_name)
|
| 197 |
+
|
| 198 |
+
pkcs_9_ub_pseudonym = univ.Integer(ub_name)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
# Object Identifier Arcs
|
| 202 |
+
|
| 203 |
+
ietf_at = _OID(1, 3, 6, 1, 5, 5, 7, 9)
|
| 204 |
+
|
| 205 |
+
id_at = _OID(2, 5, 4)
|
| 206 |
+
|
| 207 |
+
pkcs_9 = _OID(1, 2, 840, 113549, 1, 9)
|
| 208 |
+
|
| 209 |
+
pkcs_9_mo = _OID(pkcs_9, 0)
|
| 210 |
+
|
| 211 |
+
smime = _OID(pkcs_9, 16)
|
| 212 |
+
|
| 213 |
+
certTypes = _OID(pkcs_9, 22)
|
| 214 |
+
|
| 215 |
+
crlTypes = _OID(pkcs_9, 23)
|
| 216 |
+
|
| 217 |
+
pkcs_9_oc = _OID(pkcs_9, 24)
|
| 218 |
+
|
| 219 |
+
pkcs_9_at = _OID(pkcs_9, 25)
|
| 220 |
+
|
| 221 |
+
pkcs_9_sx = _OID(pkcs_9, 26)
|
| 222 |
+
|
| 223 |
+
pkcs_9_mr = _OID(pkcs_9, 27)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
# Object Identifiers for Syntaxes for use with LDAP-accessible directories
|
| 227 |
+
|
| 228 |
+
pkcs_9_sx_pkcs9String = _OID(pkcs_9_sx, 1)
|
| 229 |
+
|
| 230 |
+
pkcs_9_sx_signingTime = _OID(pkcs_9_sx, 2)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
# Object Identifiers for object classes
|
| 234 |
+
|
| 235 |
+
pkcs_9_oc_pkcsEntity = _OID(pkcs_9_oc, 1)
|
| 236 |
+
|
| 237 |
+
pkcs_9_oc_naturalPerson = _OID(pkcs_9_oc, 2)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
# Object Identifiers for matching rules
|
| 241 |
+
|
| 242 |
+
pkcs_9_mr_caseIgnoreMatch = _OID(pkcs_9_mr, 1)
|
| 243 |
+
|
| 244 |
+
pkcs_9_mr_signingTimeMatch = _OID(pkcs_9_mr, 2)
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
# PKCS #7 PDU
|
| 248 |
+
|
| 249 |
+
pkcs_9_at_pkcs7PDU = _OID(pkcs_9_at, 5)
|
| 250 |
+
|
| 251 |
+
pKCS7PDU = Attribute()
|
| 252 |
+
pKCS7PDU['type'] = pkcs_9_at_pkcs7PDU
|
| 253 |
+
pKCS7PDU['values'][0] = ContentInfo()
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
# PKCS #12 token
|
| 257 |
+
|
| 258 |
+
pkcs_9_at_userPKCS12 = _OID(2, 16, 840, 1, 113730, 3, 1, 216)
|
| 259 |
+
|
| 260 |
+
userPKCS12 = Attribute()
|
| 261 |
+
userPKCS12['type'] = pkcs_9_at_userPKCS12
|
| 262 |
+
userPKCS12['values'][0] = PFX()
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
# PKCS #15 token
|
| 266 |
+
|
| 267 |
+
pkcs_9_at_pkcs15Token = _OID(pkcs_9_at, 1)
|
| 268 |
+
|
| 269 |
+
# TODO: Once PKCS15Token can be imported, this can be included
|
| 270 |
+
#
|
| 271 |
+
# pKCS15Token = Attribute()
|
| 272 |
+
# userPKCS12['type'] = pkcs_9_at_pkcs15Token
|
| 273 |
+
# userPKCS12['values'][0] = PKCS15Token()
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
# PKCS #8 encrypted private key information
|
| 277 |
+
|
| 278 |
+
pkcs_9_at_encryptedPrivateKeyInfo = _OID(pkcs_9_at, 2)
|
| 279 |
+
|
| 280 |
+
encryptedPrivateKeyInfo = Attribute()
|
| 281 |
+
encryptedPrivateKeyInfo['type'] = pkcs_9_at_encryptedPrivateKeyInfo
|
| 282 |
+
encryptedPrivateKeyInfo['values'][0] = EncryptedPrivateKeyInfo()
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
# Electronic-mail address
|
| 286 |
+
|
| 287 |
+
pkcs_9_at_emailAddress = rfc5280.id_emailAddress
|
| 288 |
+
|
| 289 |
+
emailAddress = Attribute()
|
| 290 |
+
emailAddress['type'] = pkcs_9_at_emailAddress
|
| 291 |
+
emailAddress['values'][0] = EmailAddress()
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
# Unstructured name
|
| 295 |
+
|
| 296 |
+
pkcs_9_at_unstructuredName = _OID(pkcs_9, 2)
|
| 297 |
+
|
| 298 |
+
unstructuredName = Attribute()
|
| 299 |
+
unstructuredName['type'] = pkcs_9_at_unstructuredName
|
| 300 |
+
unstructuredName['values'][0] = PKCS9String()
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
# Unstructured address
|
| 304 |
+
|
| 305 |
+
pkcs_9_at_unstructuredAddress = _OID(pkcs_9, 8)
|
| 306 |
+
|
| 307 |
+
unstructuredAddress = Attribute()
|
| 308 |
+
unstructuredAddress['type'] = pkcs_9_at_unstructuredAddress
|
| 309 |
+
unstructuredAddress['values'][0] = DirectoryString()
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
# Date of birth
|
| 313 |
+
|
| 314 |
+
pkcs_9_at_dateOfBirth = _OID(ietf_at, 1)
|
| 315 |
+
|
| 316 |
+
dateOfBirth = SingleAttribute()
|
| 317 |
+
dateOfBirth['type'] = pkcs_9_at_dateOfBirth
|
| 318 |
+
dateOfBirth['values'][0] = useful.GeneralizedTime()
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
# Place of birth
|
| 322 |
+
|
| 323 |
+
pkcs_9_at_placeOfBirth = _OID(ietf_at, 2)
|
| 324 |
+
|
| 325 |
+
placeOfBirth = SingleAttribute()
|
| 326 |
+
placeOfBirth['type'] = pkcs_9_at_placeOfBirth
|
| 327 |
+
placeOfBirth['values'][0] = DirectoryString()
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
# Gender
|
| 331 |
+
|
| 332 |
+
class GenderString(char.PrintableString):
|
| 333 |
+
pass
|
| 334 |
+
|
| 335 |
+
GenderString.subtypeSpec = constraint.ValueSizeConstraint(1, 1)
|
| 336 |
+
GenderString.subtypeSpec = constraint.SingleValueConstraint("M", "F", "m", "f")
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
pkcs_9_at_gender = _OID(ietf_at, 3)
|
| 340 |
+
|
| 341 |
+
gender = SingleAttribute()
|
| 342 |
+
gender['type'] = pkcs_9_at_gender
|
| 343 |
+
gender['values'][0] = GenderString()
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
# Country of citizenship
|
| 347 |
+
|
| 348 |
+
pkcs_9_at_countryOfCitizenship = _OID(ietf_at, 4)
|
| 349 |
+
|
| 350 |
+
countryOfCitizenship = Attribute()
|
| 351 |
+
countryOfCitizenship['type'] = pkcs_9_at_countryOfCitizenship
|
| 352 |
+
countryOfCitizenship['values'][0] = X520countryName()
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
# Country of residence
|
| 356 |
+
|
| 357 |
+
pkcs_9_at_countryOfResidence = _OID(ietf_at, 5)
|
| 358 |
+
|
| 359 |
+
countryOfResidence = Attribute()
|
| 360 |
+
countryOfResidence['type'] = pkcs_9_at_countryOfResidence
|
| 361 |
+
countryOfResidence['values'][0] = X520countryName()
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
# Pseudonym
|
| 365 |
+
|
| 366 |
+
id_at_pseudonym = _OID(2, 5, 4, 65)
|
| 367 |
+
|
| 368 |
+
pseudonym = Attribute()
|
| 369 |
+
pseudonym['type'] = id_at_pseudonym
|
| 370 |
+
pseudonym['values'][0] = DirectoryString()
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
# Serial number
|
| 374 |
+
|
| 375 |
+
id_at_serialNumber = rfc5280.id_at_serialNumber
|
| 376 |
+
|
| 377 |
+
serialNumber = Attribute()
|
| 378 |
+
serialNumber['type'] = id_at_serialNumber
|
| 379 |
+
serialNumber['values'][0] = X520SerialNumber()
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
# Content type
|
| 383 |
+
|
| 384 |
+
pkcs_9_at_contentType = rfc5652.id_contentType
|
| 385 |
+
|
| 386 |
+
contentType = CMSSingleAttribute()
|
| 387 |
+
contentType['attrType'] = pkcs_9_at_contentType
|
| 388 |
+
contentType['attrValues'][0] = ContentType()
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
# Message digest
|
| 392 |
+
|
| 393 |
+
pkcs_9_at_messageDigest = rfc5652.id_messageDigest
|
| 394 |
+
|
| 395 |
+
messageDigest = CMSSingleAttribute()
|
| 396 |
+
messageDigest['attrType'] = pkcs_9_at_messageDigest
|
| 397 |
+
messageDigest['attrValues'][0] = MessageDigest()
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
# Signing time
|
| 401 |
+
|
| 402 |
+
pkcs_9_at_signingTime = rfc5652.id_signingTime
|
| 403 |
+
|
| 404 |
+
signingTime = CMSSingleAttribute()
|
| 405 |
+
signingTime['attrType'] = pkcs_9_at_signingTime
|
| 406 |
+
signingTime['attrValues'][0] = SigningTime()
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
# Random nonce
|
| 410 |
+
|
| 411 |
+
class RandomNonce(univ.OctetString):
|
| 412 |
+
pass
|
| 413 |
+
|
| 414 |
+
RandomNonce.subtypeSpec = constraint.ValueSizeConstraint(4, MAX)
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
pkcs_9_at_randomNonce = _OID(pkcs_9_at, 3)
|
| 418 |
+
|
| 419 |
+
randomNonce = CMSSingleAttribute()
|
| 420 |
+
randomNonce['attrType'] = pkcs_9_at_randomNonce
|
| 421 |
+
randomNonce['attrValues'][0] = RandomNonce()
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
# Sequence number
|
| 425 |
+
|
| 426 |
+
class SequenceNumber(univ.Integer):
|
| 427 |
+
pass
|
| 428 |
+
|
| 429 |
+
SequenceNumber.subtypeSpec = constraint.ValueRangeConstraint(1, MAX)
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
pkcs_9_at_sequenceNumber = _OID(pkcs_9_at, 4)
|
| 433 |
+
|
| 434 |
+
sequenceNumber = CMSSingleAttribute()
|
| 435 |
+
sequenceNumber['attrType'] = pkcs_9_at_sequenceNumber
|
| 436 |
+
sequenceNumber['attrValues'][0] = SequenceNumber()
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
# Countersignature
|
| 440 |
+
|
| 441 |
+
pkcs_9_at_counterSignature = rfc5652.id_countersignature
|
| 442 |
+
|
| 443 |
+
counterSignature = CMSAttribute()
|
| 444 |
+
counterSignature['attrType'] = pkcs_9_at_counterSignature
|
| 445 |
+
counterSignature['attrValues'][0] = Countersignature()
|
| 446 |
+
|
| 447 |
+
|
| 448 |
+
# Challenge password
|
| 449 |
+
|
| 450 |
+
pkcs_9_at_challengePassword = _OID(pkcs_9, 7)
|
| 451 |
+
|
| 452 |
+
challengePassword = SingleAttribute()
|
| 453 |
+
challengePassword['type'] = pkcs_9_at_challengePassword
|
| 454 |
+
challengePassword['values'][0] = DirectoryString()
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
# Extension request
|
| 458 |
+
|
| 459 |
+
class ExtensionRequest(Extensions):
|
| 460 |
+
pass
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
pkcs_9_at_extensionRequest = _OID(pkcs_9, 14)
|
| 464 |
+
|
| 465 |
+
extensionRequest = SingleAttribute()
|
| 466 |
+
extensionRequest['type'] = pkcs_9_at_extensionRequest
|
| 467 |
+
extensionRequest['values'][0] = ExtensionRequest()
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
# Extended-certificate attributes (deprecated)
|
| 471 |
+
|
| 472 |
+
class AttributeSet(univ.SetOf):
|
| 473 |
+
pass
|
| 474 |
+
|
| 475 |
+
AttributeSet.componentType = Attribute()
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
pkcs_9_at_extendedCertificateAttributes = _OID(pkcs_9, 9)
|
| 479 |
+
|
| 480 |
+
extendedCertificateAttributes = SingleAttribute()
|
| 481 |
+
extendedCertificateAttributes['type'] = pkcs_9_at_extendedCertificateAttributes
|
| 482 |
+
extendedCertificateAttributes['values'][0] = AttributeSet()
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
# Friendly name
|
| 486 |
+
|
| 487 |
+
class FriendlyName(char.BMPString):
|
| 488 |
+
pass
|
| 489 |
+
|
| 490 |
+
FriendlyName.subtypeSpec = constraint.ValueSizeConstraint(1, pkcs_9_ub_friendlyName)
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
pkcs_9_at_friendlyName = _OID(pkcs_9, 20)
|
| 494 |
+
|
| 495 |
+
friendlyName = SingleAttribute()
|
| 496 |
+
friendlyName['type'] = pkcs_9_at_friendlyName
|
| 497 |
+
friendlyName['values'][0] = FriendlyName()
|
| 498 |
+
|
| 499 |
+
|
| 500 |
+
# Local key identifier
|
| 501 |
+
|
| 502 |
+
pkcs_9_at_localKeyId = _OID(pkcs_9, 21)
|
| 503 |
+
|
| 504 |
+
localKeyId = SingleAttribute()
|
| 505 |
+
localKeyId['type'] = pkcs_9_at_localKeyId
|
| 506 |
+
localKeyId['values'][0] = univ.OctetString()
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
# Signing description
|
| 510 |
+
|
| 511 |
+
pkcs_9_at_signingDescription = _OID(pkcs_9, 13)
|
| 512 |
+
|
| 513 |
+
signingDescription = CMSSingleAttribute()
|
| 514 |
+
signingDescription['attrType'] = pkcs_9_at_signingDescription
|
| 515 |
+
signingDescription['attrValues'][0] = DirectoryString()
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
# S/MIME capabilities
|
| 519 |
+
|
| 520 |
+
class SMIMECapability(AlgorithmIdentifier):
|
| 521 |
+
pass
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
class SMIMECapabilities(univ.SequenceOf):
|
| 525 |
+
pass
|
| 526 |
+
|
| 527 |
+
SMIMECapabilities.componentType = SMIMECapability()
|
| 528 |
+
|
| 529 |
+
|
| 530 |
+
pkcs_9_at_smimeCapabilities = _OID(pkcs_9, 15)
|
| 531 |
+
|
| 532 |
+
smimeCapabilities = CMSSingleAttribute()
|
| 533 |
+
smimeCapabilities['attrType'] = pkcs_9_at_smimeCapabilities
|
| 534 |
+
smimeCapabilities['attrValues'][0] = SMIMECapabilities()
|
| 535 |
+
|
| 536 |
+
|
| 537 |
+
# Certificate Attribute Map
|
| 538 |
+
|
| 539 |
+
_certificateAttributesMapUpdate = {
|
| 540 |
+
# Attribute types for use with the "pkcsEntity" object class
|
| 541 |
+
pkcs_9_at_pkcs7PDU: ContentInfo(),
|
| 542 |
+
pkcs_9_at_userPKCS12: PFX(),
|
| 543 |
+
# TODO: Once PKCS15Token can be imported, this can be included
|
| 544 |
+
# pkcs_9_at_pkcs15Token: PKCS15Token(),
|
| 545 |
+
pkcs_9_at_encryptedPrivateKeyInfo: EncryptedPrivateKeyInfo(),
|
| 546 |
+
# Attribute types for use with the "naturalPerson" object class
|
| 547 |
+
pkcs_9_at_emailAddress: EmailAddress(),
|
| 548 |
+
pkcs_9_at_unstructuredName: PKCS9String(),
|
| 549 |
+
pkcs_9_at_unstructuredAddress: DirectoryString(),
|
| 550 |
+
pkcs_9_at_dateOfBirth: useful.GeneralizedTime(),
|
| 551 |
+
pkcs_9_at_placeOfBirth: DirectoryString(),
|
| 552 |
+
pkcs_9_at_gender: GenderString(),
|
| 553 |
+
pkcs_9_at_countryOfCitizenship: X520countryName(),
|
| 554 |
+
pkcs_9_at_countryOfResidence: X520countryName(),
|
| 555 |
+
id_at_pseudonym: DirectoryString(),
|
| 556 |
+
id_at_serialNumber: X520SerialNumber(),
|
| 557 |
+
# Attribute types for use with PKCS #10 certificate requests
|
| 558 |
+
pkcs_9_at_challengePassword: DirectoryString(),
|
| 559 |
+
pkcs_9_at_extensionRequest: ExtensionRequest(),
|
| 560 |
+
pkcs_9_at_extendedCertificateAttributes: AttributeSet(),
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
# CMS Attribute Map
|
| 567 |
+
|
| 568 |
+
# Note: pkcs_9_at_smimeCapabilities is not included in the map because
|
| 569 |
+
# the definition in RFC 5751 is preferred, which produces the same
|
| 570 |
+
# encoding, but it allows different parameters for SMIMECapability
|
| 571 |
+
# and AlgorithmIdentifier.
|
| 572 |
+
|
| 573 |
+
_cmsAttributesMapUpdate = {
|
| 574 |
+
# Attribute types for use in PKCS #7 data (a.k.a. CMS)
|
| 575 |
+
pkcs_9_at_contentType: ContentType(),
|
| 576 |
+
pkcs_9_at_messageDigest: MessageDigest(),
|
| 577 |
+
pkcs_9_at_signingTime: SigningTime(),
|
| 578 |
+
pkcs_9_at_randomNonce: RandomNonce(),
|
| 579 |
+
pkcs_9_at_sequenceNumber: SequenceNumber(),
|
| 580 |
+
pkcs_9_at_counterSignature: Countersignature(),
|
| 581 |
+
# Attributes for use in PKCS #12 "PFX" PDUs or PKCS #15 tokens
|
| 582 |
+
pkcs_9_at_friendlyName: FriendlyName(),
|
| 583 |
+
pkcs_9_at_localKeyId: univ.OctetString(),
|
| 584 |
+
pkcs_9_at_signingDescription: DirectoryString(),
|
| 585 |
+
# pkcs_9_at_smimeCapabilities: SMIMECapabilities(),
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3114.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# TEST Company Classification Policies
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc3114.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import char
|
| 16 |
+
from pyasn1.type import namedval
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5755
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
id_smime = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, ))
|
| 23 |
+
|
| 24 |
+
id_tsp = id_smime + (7, )
|
| 25 |
+
|
| 26 |
+
id_tsp_TEST_Amoco = id_tsp + (1, )
|
| 27 |
+
|
| 28 |
+
class Amoco_SecurityClassification(univ.Integer):
|
| 29 |
+
namedValues = namedval.NamedValues(
|
| 30 |
+
('amoco-general', 6),
|
| 31 |
+
('amoco-confidential', 7),
|
| 32 |
+
('amoco-highly-confidential', 8)
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
id_tsp_TEST_Caterpillar = id_tsp + (2, )
|
| 37 |
+
|
| 38 |
+
class Caterpillar_SecurityClassification(univ.Integer):
|
| 39 |
+
namedValues = namedval.NamedValues(
|
| 40 |
+
('caterpillar-public', 6),
|
| 41 |
+
('caterpillar-green', 7),
|
| 42 |
+
('caterpillar-yellow', 8),
|
| 43 |
+
('caterpillar-red', 9)
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
id_tsp_TEST_Whirlpool = id_tsp + (3, )
|
| 48 |
+
|
| 49 |
+
class Whirlpool_SecurityClassification(univ.Integer):
|
| 50 |
+
namedValues = namedval.NamedValues(
|
| 51 |
+
('whirlpool-public', 6),
|
| 52 |
+
('whirlpool-internal', 7),
|
| 53 |
+
('whirlpool-confidential', 8)
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
id_tsp_TEST_Whirlpool_Categories = id_tsp + (4, )
|
| 58 |
+
|
| 59 |
+
class SecurityCategoryValues(univ.SequenceOf):
|
| 60 |
+
componentType = char.UTF8String()
|
| 61 |
+
|
| 62 |
+
# Example SecurityCategoryValues: "LAW DEPARTMENT USE ONLY"
|
| 63 |
+
# Example SecurityCategoryValues: "HUMAN RESOURCES USE ONLY"
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
# Also, the privacy mark in the security label can contain a string,
|
| 67 |
+
# such as: "ATTORNEY-CLIENT PRIVILEGED INFORMATION"
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# Map of security category type OIDs to security category added
|
| 71 |
+
# to the ones that are in rfc5755.py
|
| 72 |
+
|
| 73 |
+
_securityCategoryMapUpdate = {
|
| 74 |
+
id_tsp_TEST_Whirlpool_Categories: SecurityCategoryValues(),
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
rfc5755.securityCategoryMap.update(_securityCategoryMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3161.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Time-Stamp Protocol (TSP)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc3161.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 tag
|
| 19 |
+
from pyasn1.type import univ
|
| 20 |
+
from pyasn1.type import useful
|
| 21 |
+
|
| 22 |
+
from pyasn1_modules import rfc4210
|
| 23 |
+
from pyasn1_modules import rfc5280
|
| 24 |
+
from pyasn1_modules import rfc5652
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
Extensions = rfc5280.Extensions
|
| 28 |
+
|
| 29 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 30 |
+
|
| 31 |
+
GeneralName = rfc5280.GeneralName
|
| 32 |
+
|
| 33 |
+
ContentInfo = rfc5652.ContentInfo
|
| 34 |
+
|
| 35 |
+
PKIFreeText = rfc4210.PKIFreeText
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
id_ct_TSTInfo = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.4')
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class Accuracy(univ.Sequence):
|
| 42 |
+
pass
|
| 43 |
+
|
| 44 |
+
Accuracy.componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.OptionalNamedType('seconds', univ.Integer()),
|
| 46 |
+
namedtype.OptionalNamedType('millis', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 999)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 47 |
+
namedtype.OptionalNamedType('micros', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 999)).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class MessageImprint(univ.Sequence):
|
| 52 |
+
pass
|
| 53 |
+
|
| 54 |
+
MessageImprint.componentType = namedtype.NamedTypes(
|
| 55 |
+
namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
|
| 56 |
+
namedtype.NamedType('hashedMessage', univ.OctetString())
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class PKIFailureInfo(univ.BitString):
|
| 61 |
+
pass
|
| 62 |
+
|
| 63 |
+
PKIFailureInfo.namedValues = namedval.NamedValues(
|
| 64 |
+
('badAlg', 0),
|
| 65 |
+
('badRequest', 2),
|
| 66 |
+
('badDataFormat', 5),
|
| 67 |
+
('timeNotAvailable', 14),
|
| 68 |
+
('unacceptedPolicy', 15),
|
| 69 |
+
('unacceptedExtension', 16),
|
| 70 |
+
('addInfoNotAvailable', 17),
|
| 71 |
+
('systemFailure', 25)
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class PKIStatus(univ.Integer):
|
| 76 |
+
pass
|
| 77 |
+
|
| 78 |
+
PKIStatus.namedValues = namedval.NamedValues(
|
| 79 |
+
('granted', 0),
|
| 80 |
+
('grantedWithMods', 1),
|
| 81 |
+
('rejection', 2),
|
| 82 |
+
('waiting', 3),
|
| 83 |
+
('revocationWarning', 4),
|
| 84 |
+
('revocationNotification', 5)
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
class PKIStatusInfo(univ.Sequence):
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
PKIStatusInfo.componentType = namedtype.NamedTypes(
|
| 92 |
+
namedtype.NamedType('status', PKIStatus()),
|
| 93 |
+
namedtype.OptionalNamedType('statusString', PKIFreeText()),
|
| 94 |
+
namedtype.OptionalNamedType('failInfo', PKIFailureInfo())
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class TSAPolicyId(univ.ObjectIdentifier):
|
| 99 |
+
pass
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class TSTInfo(univ.Sequence):
|
| 103 |
+
pass
|
| 104 |
+
|
| 105 |
+
TSTInfo.componentType = namedtype.NamedTypes(
|
| 106 |
+
namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('v1', 1)))),
|
| 107 |
+
namedtype.NamedType('policy', TSAPolicyId()),
|
| 108 |
+
namedtype.NamedType('messageImprint', MessageImprint()),
|
| 109 |
+
namedtype.NamedType('serialNumber', univ.Integer()),
|
| 110 |
+
namedtype.NamedType('genTime', useful.GeneralizedTime()),
|
| 111 |
+
namedtype.OptionalNamedType('accuracy', Accuracy()),
|
| 112 |
+
namedtype.DefaultedNamedType('ordering', univ.Boolean().subtype(value=0)),
|
| 113 |
+
namedtype.OptionalNamedType('nonce', univ.Integer()),
|
| 114 |
+
namedtype.OptionalNamedType('tsa', GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 115 |
+
namedtype.OptionalNamedType('extensions', Extensions().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class TimeStampReq(univ.Sequence):
|
| 120 |
+
pass
|
| 121 |
+
|
| 122 |
+
TimeStampReq.componentType = namedtype.NamedTypes(
|
| 123 |
+
namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('v1', 1)))),
|
| 124 |
+
namedtype.NamedType('messageImprint', MessageImprint()),
|
| 125 |
+
namedtype.OptionalNamedType('reqPolicy', TSAPolicyId()),
|
| 126 |
+
namedtype.OptionalNamedType('nonce', univ.Integer()),
|
| 127 |
+
namedtype.DefaultedNamedType('certReq', univ.Boolean().subtype(value=0)),
|
| 128 |
+
namedtype.OptionalNamedType('extensions', Extensions().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
class TimeStampToken(ContentInfo):
|
| 133 |
+
pass
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class TimeStampResp(univ.Sequence):
|
| 137 |
+
pass
|
| 138 |
+
|
| 139 |
+
TimeStampResp.componentType = namedtype.NamedTypes(
|
| 140 |
+
namedtype.NamedType('status', PKIStatusInfo()),
|
| 141 |
+
namedtype.OptionalNamedType('timeStampToken', TimeStampToken())
|
| 142 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3274.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# CMS Compressed Data Content Type
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc3274.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
from pyasn1_modules import rfc5652
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class CompressionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 24 |
+
pass
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# The CMS Compressed Data Content Type
|
| 28 |
+
|
| 29 |
+
id_ct_compressedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.9')
|
| 30 |
+
|
| 31 |
+
class CompressedData(univ.Sequence):
|
| 32 |
+
pass
|
| 33 |
+
|
| 34 |
+
CompressedData.componentType = namedtype.NamedTypes(
|
| 35 |
+
namedtype.NamedType('version', rfc5652.CMSVersion()), # Always set to 0
|
| 36 |
+
namedtype.NamedType('compressionAlgorithm', CompressionAlgorithmIdentifier()),
|
| 37 |
+
namedtype.NamedType('encapContentInfo', rfc5652.EncapsulatedContentInfo())
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# Algorithm identifier for the zLib Compression Algorithm
|
| 42 |
+
# This includes cpa_zlibCompress as defined in RFC 6268,
|
| 43 |
+
# from https://www.rfc-editor.org/rfc/rfc6268.txt
|
| 44 |
+
|
| 45 |
+
id_alg_zlibCompress = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.8')
|
| 46 |
+
|
| 47 |
+
cpa_zlibCompress = rfc5280.AlgorithmIdentifier()
|
| 48 |
+
cpa_zlibCompress['algorithm'] = id_alg_zlibCompress
|
| 49 |
+
# cpa_zlibCompress['parameters'] are absent
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
# Map of Content Type OIDs to Content Types is added to thr
|
| 53 |
+
# ones that are in rfc5652.py
|
| 54 |
+
|
| 55 |
+
_cmsContentTypesMapUpdate = {
|
| 56 |
+
id_ct_compressedData: CompressedData(),
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3280.py
ADDED
|
@@ -0,0 +1,1543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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 and Certificate
|
| 10 |
+
# Revocation List (CRL) Profile
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# http://www.ietf.org/rfc/rfc3280.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 |
+
from pyasn1.type import useful
|
| 22 |
+
|
| 23 |
+
MAX = float('inf')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _OID(*components):
|
| 27 |
+
output = []
|
| 28 |
+
for x in tuple(components):
|
| 29 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 30 |
+
output.extend(list(x))
|
| 31 |
+
else:
|
| 32 |
+
output.append(int(x))
|
| 33 |
+
|
| 34 |
+
return univ.ObjectIdentifier(output)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
unformatted_postal_address = univ.Integer(16)
|
| 38 |
+
|
| 39 |
+
ub_organizational_units = univ.Integer(4)
|
| 40 |
+
|
| 41 |
+
ub_organizational_unit_name_length = univ.Integer(32)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class OrganizationalUnitName(char.PrintableString):
|
| 45 |
+
pass
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
OrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class OrganizationalUnitNames(univ.SequenceOf):
|
| 52 |
+
pass
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
OrganizationalUnitNames.componentType = OrganizationalUnitName()
|
| 56 |
+
OrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class AttributeType(univ.ObjectIdentifier):
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
id_at = _OID(2, 5, 4)
|
| 64 |
+
|
| 65 |
+
id_at_name = _OID(id_at, 41)
|
| 66 |
+
|
| 67 |
+
ub_pds_parameter_length = univ.Integer(30)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class PDSParameter(univ.Set):
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
PDSParameter.componentType = namedtype.NamedTypes(
|
| 75 |
+
namedtype.OptionalNamedType('printable-string', char.PrintableString().subtype(
|
| 76 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length))),
|
| 77 |
+
namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
|
| 78 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class PhysicalDeliveryOrganizationName(PDSParameter):
|
| 83 |
+
pass
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
ub_organization_name_length = univ.Integer(64)
|
| 87 |
+
|
| 88 |
+
ub_domain_defined_attribute_type_length = univ.Integer(8)
|
| 89 |
+
|
| 90 |
+
ub_domain_defined_attribute_value_length = univ.Integer(128)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class TeletexDomainDefinedAttribute(univ.Sequence):
|
| 94 |
+
pass
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
TeletexDomainDefinedAttribute.componentType = namedtype.NamedTypes(
|
| 98 |
+
namedtype.NamedType('type', char.TeletexString().subtype(
|
| 99 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
|
| 100 |
+
namedtype.NamedType('value', char.TeletexString().subtype(
|
| 101 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
id_pkix = _OID(1, 3, 6, 1, 5, 5, 7)
|
| 105 |
+
|
| 106 |
+
id_qt = _OID(id_pkix, 2)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class PresentationAddress(univ.Sequence):
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
PresentationAddress.componentType = namedtype.NamedTypes(
|
| 114 |
+
namedtype.OptionalNamedType('pSelector', univ.OctetString().subtype(
|
| 115 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 116 |
+
namedtype.OptionalNamedType('sSelector', univ.OctetString().subtype(
|
| 117 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 118 |
+
namedtype.OptionalNamedType('tSelector', univ.OctetString().subtype(
|
| 119 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 120 |
+
namedtype.NamedType('nAddresses', univ.SetOf(componentType=univ.OctetString()).subtype(
|
| 121 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class AlgorithmIdentifier(univ.Sequence):
|
| 126 |
+
pass
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
AlgorithmIdentifier.componentType = namedtype.NamedTypes(
|
| 130 |
+
namedtype.NamedType('algorithm', univ.ObjectIdentifier()),
|
| 131 |
+
namedtype.OptionalNamedType('parameters', univ.Any())
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class UniqueIdentifier(univ.BitString):
|
| 136 |
+
pass
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class Extension(univ.Sequence):
|
| 140 |
+
pass
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
Extension.componentType = namedtype.NamedTypes(
|
| 144 |
+
namedtype.NamedType('extnID', univ.ObjectIdentifier()),
|
| 145 |
+
namedtype.DefaultedNamedType('critical', univ.Boolean().subtype(value=0)),
|
| 146 |
+
namedtype.NamedType('extnValue', univ.OctetString())
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
class Extensions(univ.SequenceOf):
|
| 151 |
+
pass
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
Extensions.componentType = Extension()
|
| 155 |
+
Extensions.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class CertificateSerialNumber(univ.Integer):
|
| 159 |
+
pass
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class SubjectPublicKeyInfo(univ.Sequence):
|
| 163 |
+
pass
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
SubjectPublicKeyInfo.componentType = namedtype.NamedTypes(
|
| 167 |
+
namedtype.NamedType('algorithm', AlgorithmIdentifier()),
|
| 168 |
+
namedtype.NamedType('subjectPublicKey', univ.BitString())
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
class Time(univ.Choice):
|
| 173 |
+
pass
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
Time.componentType = namedtype.NamedTypes(
|
| 177 |
+
namedtype.NamedType('utcTime', useful.UTCTime()),
|
| 178 |
+
namedtype.NamedType('generalTime', useful.GeneralizedTime())
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
class Validity(univ.Sequence):
|
| 183 |
+
pass
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
Validity.componentType = namedtype.NamedTypes(
|
| 187 |
+
namedtype.NamedType('notBefore', Time()),
|
| 188 |
+
namedtype.NamedType('notAfter', Time())
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class Version(univ.Integer):
|
| 193 |
+
pass
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
Version.namedValues = namedval.NamedValues(
|
| 197 |
+
('v1', 0),
|
| 198 |
+
('v2', 1),
|
| 199 |
+
('v3', 2)
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
class AttributeValue(univ.Any):
|
| 204 |
+
pass
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
class AttributeTypeAndValue(univ.Sequence):
|
| 208 |
+
pass
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
AttributeTypeAndValue.componentType = namedtype.NamedTypes(
|
| 212 |
+
namedtype.NamedType('type', AttributeType()),
|
| 213 |
+
namedtype.NamedType('value', AttributeValue())
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
class RelativeDistinguishedName(univ.SetOf):
|
| 218 |
+
pass
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
RelativeDistinguishedName.componentType = AttributeTypeAndValue()
|
| 222 |
+
RelativeDistinguishedName.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
class RDNSequence(univ.SequenceOf):
|
| 226 |
+
pass
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
RDNSequence.componentType = RelativeDistinguishedName()
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
class Name(univ.Choice):
|
| 233 |
+
pass
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
Name.componentType = namedtype.NamedTypes(
|
| 237 |
+
namedtype.NamedType('rdnSequence', RDNSequence())
|
| 238 |
+
)
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
class TBSCertificate(univ.Sequence):
|
| 242 |
+
pass
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
TBSCertificate.componentType = namedtype.NamedTypes(
|
| 246 |
+
namedtype.DefaultedNamedType('version',
|
| 247 |
+
Version().subtype(explicitTag=tag.Tag(tag.tagClassContext,
|
| 248 |
+
tag.tagFormatSimple, 0)).subtype(value="v1")),
|
| 249 |
+
namedtype.NamedType('serialNumber', CertificateSerialNumber()),
|
| 250 |
+
namedtype.NamedType('signature', AlgorithmIdentifier()),
|
| 251 |
+
namedtype.NamedType('issuer', Name()),
|
| 252 |
+
namedtype.NamedType('validity', Validity()),
|
| 253 |
+
namedtype.NamedType('subject', Name()),
|
| 254 |
+
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
|
| 255 |
+
namedtype.OptionalNamedType('issuerUniqueID', UniqueIdentifier().subtype(
|
| 256 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 257 |
+
namedtype.OptionalNamedType('subjectUniqueID', UniqueIdentifier().subtype(
|
| 258 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 259 |
+
namedtype.OptionalNamedType('extensions',
|
| 260 |
+
Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
class Certificate(univ.Sequence):
|
| 265 |
+
pass
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
Certificate.componentType = namedtype.NamedTypes(
|
| 269 |
+
namedtype.NamedType('tbsCertificate', TBSCertificate()),
|
| 270 |
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
| 271 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
+
ub_surname_length = univ.Integer(40)
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class TeletexOrganizationName(char.TeletexString):
|
| 278 |
+
pass
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
TeletexOrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
|
| 282 |
+
|
| 283 |
+
ub_e163_4_sub_address_length = univ.Integer(40)
|
| 284 |
+
|
| 285 |
+
teletex_common_name = univ.Integer(2)
|
| 286 |
+
|
| 287 |
+
ub_country_name_alpha_length = univ.Integer(2)
|
| 288 |
+
|
| 289 |
+
ub_country_name_numeric_length = univ.Integer(3)
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
class CountryName(univ.Choice):
|
| 293 |
+
pass
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
CountryName.tagSet = univ.Choice.tagSet.tagExplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1))
|
| 297 |
+
CountryName.componentType = namedtype.NamedTypes(
|
| 298 |
+
namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
|
| 299 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
|
| 300 |
+
namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
|
| 301 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
|
| 302 |
+
)
|
| 303 |
+
|
| 304 |
+
extension_OR_address_components = univ.Integer(12)
|
| 305 |
+
|
| 306 |
+
id_at_dnQualifier = _OID(id_at, 46)
|
| 307 |
+
|
| 308 |
+
ub_e163_4_number_length = univ.Integer(15)
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
class ExtendedNetworkAddress(univ.Choice):
|
| 312 |
+
pass
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
ExtendedNetworkAddress.componentType = namedtype.NamedTypes(
|
| 316 |
+
namedtype.NamedType('e163-4-address', univ.Sequence(componentType=namedtype.NamedTypes(
|
| 317 |
+
namedtype.NamedType('number', char.NumericString().subtype(
|
| 318 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_number_length)).subtype(
|
| 319 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 320 |
+
namedtype.OptionalNamedType('sub-address', char.NumericString().subtype(
|
| 321 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_e163_4_sub_address_length)).subtype(
|
| 322 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 323 |
+
))
|
| 324 |
+
),
|
| 325 |
+
namedtype.NamedType('psap-address', PresentationAddress().subtype(
|
| 326 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 327 |
+
)
|
| 328 |
+
|
| 329 |
+
terminal_type = univ.Integer(23)
|
| 330 |
+
|
| 331 |
+
id_domainComponent = _OID(0, 9, 2342, 19200300, 100, 1, 25)
|
| 332 |
+
|
| 333 |
+
ub_state_name = univ.Integer(128)
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
class X520StateOrProvinceName(univ.Choice):
|
| 337 |
+
pass
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
X520StateOrProvinceName.componentType = namedtype.NamedTypes(
|
| 341 |
+
namedtype.NamedType('teletexString',
|
| 342 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 343 |
+
namedtype.NamedType('printableString',
|
| 344 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 345 |
+
namedtype.NamedType('universalString',
|
| 346 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 347 |
+
namedtype.NamedType('utf8String',
|
| 348 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name))),
|
| 349 |
+
namedtype.NamedType('bmpString',
|
| 350 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_state_name)))
|
| 351 |
+
)
|
| 352 |
+
|
| 353 |
+
ub_organization_name = univ.Integer(64)
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
class X520OrganizationName(univ.Choice):
|
| 357 |
+
pass
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
X520OrganizationName.componentType = namedtype.NamedTypes(
|
| 361 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 362 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 363 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 364 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 365 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 366 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 367 |
+
namedtype.NamedType('utf8String',
|
| 368 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name))),
|
| 369 |
+
namedtype.NamedType('bmpString',
|
| 370 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_organization_name)))
|
| 371 |
+
)
|
| 372 |
+
|
| 373 |
+
ub_emailaddress_length = univ.Integer(128)
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
class ExtensionPhysicalDeliveryAddressComponents(PDSParameter):
|
| 377 |
+
pass
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
id_at_surname = _OID(id_at, 4)
|
| 381 |
+
|
| 382 |
+
ub_common_name_length = univ.Integer(64)
|
| 383 |
+
|
| 384 |
+
id_ad = _OID(id_pkix, 48)
|
| 385 |
+
|
| 386 |
+
ub_numeric_user_id_length = univ.Integer(32)
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
class NumericUserIdentifier(char.NumericString):
|
| 390 |
+
pass
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
NumericUserIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_numeric_user_id_length)
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
class OrganizationName(char.PrintableString):
|
| 397 |
+
pass
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
OrganizationName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organization_name_length)
|
| 401 |
+
|
| 402 |
+
ub_domain_name_length = univ.Integer(16)
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
class AdministrationDomainName(univ.Choice):
|
| 406 |
+
pass
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
AdministrationDomainName.tagSet = univ.Choice.tagSet.tagExplicitly(
|
| 410 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 2))
|
| 411 |
+
AdministrationDomainName.componentType = namedtype.NamedTypes(
|
| 412 |
+
namedtype.NamedType('numeric', char.NumericString().subtype(
|
| 413 |
+
subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length))),
|
| 414 |
+
namedtype.NamedType('printable', char.PrintableString().subtype(
|
| 415 |
+
subtypeSpec=constraint.ValueSizeConstraint(0, ub_domain_name_length)))
|
| 416 |
+
)
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
class PrivateDomainName(univ.Choice):
|
| 420 |
+
pass
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
PrivateDomainName.componentType = namedtype.NamedTypes(
|
| 424 |
+
namedtype.NamedType('numeric', char.NumericString().subtype(
|
| 425 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length))),
|
| 426 |
+
namedtype.NamedType('printable', char.PrintableString().subtype(
|
| 427 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_name_length)))
|
| 428 |
+
)
|
| 429 |
+
|
| 430 |
+
ub_generation_qualifier_length = univ.Integer(3)
|
| 431 |
+
|
| 432 |
+
ub_given_name_length = univ.Integer(16)
|
| 433 |
+
|
| 434 |
+
ub_initials_length = univ.Integer(5)
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
class PersonalName(univ.Set):
|
| 438 |
+
pass
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
PersonalName.componentType = namedtype.NamedTypes(
|
| 442 |
+
namedtype.NamedType('surname', char.PrintableString().subtype(
|
| 443 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
|
| 444 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 445 |
+
namedtype.OptionalNamedType('given-name', char.PrintableString().subtype(
|
| 446 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
|
| 447 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 448 |
+
namedtype.OptionalNamedType('initials', char.PrintableString().subtype(
|
| 449 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
|
| 450 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 451 |
+
namedtype.OptionalNamedType('generation-qualifier', char.PrintableString().subtype(
|
| 452 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
|
| 453 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 454 |
+
)
|
| 455 |
+
|
| 456 |
+
ub_terminal_id_length = univ.Integer(24)
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
class TerminalIdentifier(char.PrintableString):
|
| 460 |
+
pass
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
TerminalIdentifier.subtypeSpec = constraint.ValueSizeConstraint(1, ub_terminal_id_length)
|
| 464 |
+
|
| 465 |
+
ub_x121_address_length = univ.Integer(16)
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
class X121Address(char.NumericString):
|
| 469 |
+
pass
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
X121Address.subtypeSpec = constraint.ValueSizeConstraint(1, ub_x121_address_length)
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
class NetworkAddress(X121Address):
|
| 476 |
+
pass
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
class BuiltInStandardAttributes(univ.Sequence):
|
| 480 |
+
pass
|
| 481 |
+
|
| 482 |
+
|
| 483 |
+
BuiltInStandardAttributes.componentType = namedtype.NamedTypes(
|
| 484 |
+
namedtype.OptionalNamedType('country-name', CountryName()),
|
| 485 |
+
namedtype.OptionalNamedType('administration-domain-name', AdministrationDomainName()),
|
| 486 |
+
namedtype.OptionalNamedType('network-address', NetworkAddress().subtype(
|
| 487 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 488 |
+
namedtype.OptionalNamedType('terminal-identifier', TerminalIdentifier().subtype(
|
| 489 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 490 |
+
namedtype.OptionalNamedType('private-domain-name', PrivateDomainName().subtype(
|
| 491 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 492 |
+
namedtype.OptionalNamedType('organization-name', OrganizationName().subtype(
|
| 493 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 494 |
+
namedtype.OptionalNamedType('numeric-user-identifier', NumericUserIdentifier().subtype(
|
| 495 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 496 |
+
namedtype.OptionalNamedType('personal-name', PersonalName().subtype(
|
| 497 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 498 |
+
namedtype.OptionalNamedType('organizational-unit-names', OrganizationalUnitNames().subtype(
|
| 499 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6)))
|
| 500 |
+
)
|
| 501 |
+
|
| 502 |
+
ub_domain_defined_attributes = univ.Integer(4)
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
class BuiltInDomainDefinedAttribute(univ.Sequence):
|
| 506 |
+
pass
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
BuiltInDomainDefinedAttribute.componentType = namedtype.NamedTypes(
|
| 510 |
+
namedtype.NamedType('type', char.PrintableString().subtype(
|
| 511 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_type_length))),
|
| 512 |
+
namedtype.NamedType('value', char.PrintableString().subtype(
|
| 513 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_domain_defined_attribute_value_length)))
|
| 514 |
+
)
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
class BuiltInDomainDefinedAttributes(univ.SequenceOf):
|
| 518 |
+
pass
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
BuiltInDomainDefinedAttributes.componentType = BuiltInDomainDefinedAttribute()
|
| 522 |
+
BuiltInDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
|
| 523 |
+
|
| 524 |
+
ub_extension_attributes = univ.Integer(256)
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
class ExtensionAttribute(univ.Sequence):
|
| 528 |
+
pass
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
ExtensionAttribute.componentType = namedtype.NamedTypes(
|
| 532 |
+
namedtype.NamedType('extension-attribute-type', univ.Integer().subtype(
|
| 533 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, ub_extension_attributes)).subtype(
|
| 534 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 535 |
+
namedtype.NamedType('extension-attribute-value',
|
| 536 |
+
univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 537 |
+
)
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
class ExtensionAttributes(univ.SetOf):
|
| 541 |
+
pass
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
ExtensionAttributes.componentType = ExtensionAttribute()
|
| 545 |
+
ExtensionAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_extension_attributes)
|
| 546 |
+
|
| 547 |
+
|
| 548 |
+
class ORAddress(univ.Sequence):
|
| 549 |
+
pass
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
ORAddress.componentType = namedtype.NamedTypes(
|
| 553 |
+
namedtype.NamedType('built-in-standard-attributes', BuiltInStandardAttributes()),
|
| 554 |
+
namedtype.OptionalNamedType('built-in-domain-defined-attributes', BuiltInDomainDefinedAttributes()),
|
| 555 |
+
namedtype.OptionalNamedType('extension-attributes', ExtensionAttributes())
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
id_pe = _OID(id_pkix, 1)
|
| 559 |
+
|
| 560 |
+
ub_title = univ.Integer(64)
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
class X520Title(univ.Choice):
|
| 564 |
+
pass
|
| 565 |
+
|
| 566 |
+
|
| 567 |
+
X520Title.componentType = namedtype.NamedTypes(
|
| 568 |
+
namedtype.NamedType('teletexString',
|
| 569 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 570 |
+
namedtype.NamedType('printableString',
|
| 571 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 572 |
+
namedtype.NamedType('universalString',
|
| 573 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 574 |
+
namedtype.NamedType('utf8String',
|
| 575 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title))),
|
| 576 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_title)))
|
| 577 |
+
)
|
| 578 |
+
|
| 579 |
+
id_at_organizationalUnitName = _OID(id_at, 11)
|
| 580 |
+
|
| 581 |
+
|
| 582 |
+
class EmailAddress(char.IA5String):
|
| 583 |
+
pass
|
| 584 |
+
|
| 585 |
+
|
| 586 |
+
EmailAddress.subtypeSpec = constraint.ValueSizeConstraint(1, ub_emailaddress_length)
|
| 587 |
+
|
| 588 |
+
physical_delivery_country_name = univ.Integer(8)
|
| 589 |
+
|
| 590 |
+
id_at_givenName = _OID(id_at, 42)
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
class TeletexCommonName(char.TeletexString):
|
| 594 |
+
pass
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
TeletexCommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
|
| 598 |
+
|
| 599 |
+
id_qt_cps = _OID(id_qt, 1)
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
class LocalPostalAttributes(PDSParameter):
|
| 603 |
+
pass
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
class StreetAddress(PDSParameter):
|
| 607 |
+
pass
|
| 608 |
+
|
| 609 |
+
|
| 610 |
+
id_kp = _OID(id_pkix, 3)
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
class DirectoryString(univ.Choice):
|
| 614 |
+
pass
|
| 615 |
+
|
| 616 |
+
|
| 617 |
+
DirectoryString.componentType = namedtype.NamedTypes(
|
| 618 |
+
namedtype.NamedType('teletexString',
|
| 619 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 620 |
+
namedtype.NamedType('printableString',
|
| 621 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 622 |
+
namedtype.NamedType('universalString',
|
| 623 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 624 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 625 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 626 |
+
)
|
| 627 |
+
|
| 628 |
+
|
| 629 |
+
class DomainComponent(char.IA5String):
|
| 630 |
+
pass
|
| 631 |
+
|
| 632 |
+
|
| 633 |
+
id_at_initials = _OID(id_at, 43)
|
| 634 |
+
|
| 635 |
+
id_qt_unotice = _OID(id_qt, 2)
|
| 636 |
+
|
| 637 |
+
ub_pds_name_length = univ.Integer(16)
|
| 638 |
+
|
| 639 |
+
|
| 640 |
+
class PDSName(char.PrintableString):
|
| 641 |
+
pass
|
| 642 |
+
|
| 643 |
+
|
| 644 |
+
PDSName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_pds_name_length)
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
class PosteRestanteAddress(PDSParameter):
|
| 648 |
+
pass
|
| 649 |
+
|
| 650 |
+
|
| 651 |
+
class DistinguishedName(RDNSequence):
|
| 652 |
+
pass
|
| 653 |
+
|
| 654 |
+
|
| 655 |
+
class CommonName(char.PrintableString):
|
| 656 |
+
pass
|
| 657 |
+
|
| 658 |
+
|
| 659 |
+
CommonName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_common_name_length)
|
| 660 |
+
|
| 661 |
+
ub_serial_number = univ.Integer(64)
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
class X520SerialNumber(char.PrintableString):
|
| 665 |
+
pass
|
| 666 |
+
|
| 667 |
+
|
| 668 |
+
X520SerialNumber.subtypeSpec = constraint.ValueSizeConstraint(1, ub_serial_number)
|
| 669 |
+
|
| 670 |
+
id_at_generationQualifier = _OID(id_at, 44)
|
| 671 |
+
|
| 672 |
+
ub_organizational_unit_name = univ.Integer(64)
|
| 673 |
+
|
| 674 |
+
id_ad_ocsp = _OID(id_ad, 1)
|
| 675 |
+
|
| 676 |
+
|
| 677 |
+
class TeletexOrganizationalUnitName(char.TeletexString):
|
| 678 |
+
pass
|
| 679 |
+
|
| 680 |
+
|
| 681 |
+
TeletexOrganizationalUnitName.subtypeSpec = constraint.ValueSizeConstraint(1, ub_organizational_unit_name_length)
|
| 682 |
+
|
| 683 |
+
|
| 684 |
+
class TeletexPersonalName(univ.Set):
|
| 685 |
+
pass
|
| 686 |
+
|
| 687 |
+
|
| 688 |
+
TeletexPersonalName.componentType = namedtype.NamedTypes(
|
| 689 |
+
namedtype.NamedType('surname', char.TeletexString().subtype(
|
| 690 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_surname_length)).subtype(
|
| 691 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 692 |
+
namedtype.OptionalNamedType('given-name', char.TeletexString().subtype(
|
| 693 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_given_name_length)).subtype(
|
| 694 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 695 |
+
namedtype.OptionalNamedType('initials', char.TeletexString().subtype(
|
| 696 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_initials_length)).subtype(
|
| 697 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 698 |
+
namedtype.OptionalNamedType('generation-qualifier', char.TeletexString().subtype(
|
| 699 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_generation_qualifier_length)).subtype(
|
| 700 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 701 |
+
)
|
| 702 |
+
|
| 703 |
+
|
| 704 |
+
class TeletexDomainDefinedAttributes(univ.SequenceOf):
|
| 705 |
+
pass
|
| 706 |
+
|
| 707 |
+
|
| 708 |
+
TeletexDomainDefinedAttributes.componentType = TeletexDomainDefinedAttribute()
|
| 709 |
+
TeletexDomainDefinedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, ub_domain_defined_attributes)
|
| 710 |
+
|
| 711 |
+
|
| 712 |
+
class TBSCertList(univ.Sequence):
|
| 713 |
+
pass
|
| 714 |
+
|
| 715 |
+
|
| 716 |
+
TBSCertList.componentType = namedtype.NamedTypes(
|
| 717 |
+
namedtype.OptionalNamedType('version', Version()),
|
| 718 |
+
namedtype.NamedType('signature', AlgorithmIdentifier()),
|
| 719 |
+
namedtype.NamedType('issuer', Name()),
|
| 720 |
+
namedtype.NamedType('thisUpdate', Time()),
|
| 721 |
+
namedtype.OptionalNamedType('nextUpdate', Time()),
|
| 722 |
+
namedtype.OptionalNamedType('revokedCertificates',
|
| 723 |
+
univ.SequenceOf(componentType=univ.Sequence(componentType=namedtype.NamedTypes(
|
| 724 |
+
namedtype.NamedType('userCertificate', CertificateSerialNumber()),
|
| 725 |
+
namedtype.NamedType('revocationDate', Time()),
|
| 726 |
+
namedtype.OptionalNamedType('crlEntryExtensions', Extensions())
|
| 727 |
+
))
|
| 728 |
+
)),
|
| 729 |
+
namedtype.OptionalNamedType('crlExtensions',
|
| 730 |
+
Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 731 |
+
)
|
| 732 |
+
|
| 733 |
+
local_postal_attributes = univ.Integer(21)
|
| 734 |
+
|
| 735 |
+
pkcs_9 = _OID(1, 2, 840, 113549, 1, 9)
|
| 736 |
+
|
| 737 |
+
|
| 738 |
+
class PhysicalDeliveryCountryName(univ.Choice):
|
| 739 |
+
pass
|
| 740 |
+
|
| 741 |
+
|
| 742 |
+
PhysicalDeliveryCountryName.componentType = namedtype.NamedTypes(
|
| 743 |
+
namedtype.NamedType('x121-dcc-code', char.NumericString().subtype(
|
| 744 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_numeric_length, ub_country_name_numeric_length))),
|
| 745 |
+
namedtype.NamedType('iso-3166-alpha2-code', char.PrintableString().subtype(
|
| 746 |
+
subtypeSpec=constraint.ValueSizeConstraint(ub_country_name_alpha_length, ub_country_name_alpha_length)))
|
| 747 |
+
)
|
| 748 |
+
|
| 749 |
+
ub_name = univ.Integer(32768)
|
| 750 |
+
|
| 751 |
+
|
| 752 |
+
class X520name(univ.Choice):
|
| 753 |
+
pass
|
| 754 |
+
|
| 755 |
+
|
| 756 |
+
X520name.componentType = namedtype.NamedTypes(
|
| 757 |
+
namedtype.NamedType('teletexString',
|
| 758 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 759 |
+
namedtype.NamedType('printableString',
|
| 760 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 761 |
+
namedtype.NamedType('universalString',
|
| 762 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 763 |
+
namedtype.NamedType('utf8String',
|
| 764 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
|
| 765 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name)))
|
| 766 |
+
)
|
| 767 |
+
|
| 768 |
+
id_emailAddress = _OID(pkcs_9, 1)
|
| 769 |
+
|
| 770 |
+
|
| 771 |
+
class TerminalType(univ.Integer):
|
| 772 |
+
pass
|
| 773 |
+
|
| 774 |
+
|
| 775 |
+
TerminalType.namedValues = namedval.NamedValues(
|
| 776 |
+
('telex', 3),
|
| 777 |
+
('teletex', 4),
|
| 778 |
+
('g3-facsimile', 5),
|
| 779 |
+
('g4-facsimile', 6),
|
| 780 |
+
('ia5-terminal', 7),
|
| 781 |
+
('videotex', 8)
|
| 782 |
+
)
|
| 783 |
+
|
| 784 |
+
|
| 785 |
+
class X520OrganizationalUnitName(univ.Choice):
|
| 786 |
+
pass
|
| 787 |
+
|
| 788 |
+
|
| 789 |
+
X520OrganizationalUnitName.componentType = namedtype.NamedTypes(
|
| 790 |
+
namedtype.NamedType('teletexString', char.TeletexString().subtype(
|
| 791 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 792 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 793 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 794 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 795 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 796 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 797 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name))),
|
| 798 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
| 799 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_organizational_unit_name)))
|
| 800 |
+
)
|
| 801 |
+
|
| 802 |
+
id_at_commonName = _OID(id_at, 3)
|
| 803 |
+
|
| 804 |
+
pds_name = univ.Integer(7)
|
| 805 |
+
|
| 806 |
+
post_office_box_address = univ.Integer(18)
|
| 807 |
+
|
| 808 |
+
ub_locality_name = univ.Integer(128)
|
| 809 |
+
|
| 810 |
+
|
| 811 |
+
class X520LocalityName(univ.Choice):
|
| 812 |
+
pass
|
| 813 |
+
|
| 814 |
+
|
| 815 |
+
X520LocalityName.componentType = namedtype.NamedTypes(
|
| 816 |
+
namedtype.NamedType('teletexString',
|
| 817 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 818 |
+
namedtype.NamedType('printableString', char.PrintableString().subtype(
|
| 819 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 820 |
+
namedtype.NamedType('universalString', char.UniversalString().subtype(
|
| 821 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 822 |
+
namedtype.NamedType('utf8String',
|
| 823 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name))),
|
| 824 |
+
namedtype.NamedType('bmpString',
|
| 825 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_locality_name)))
|
| 826 |
+
)
|
| 827 |
+
|
| 828 |
+
id_ad_timeStamping = _OID(id_ad, 3)
|
| 829 |
+
|
| 830 |
+
id_at_countryName = _OID(id_at, 6)
|
| 831 |
+
|
| 832 |
+
physical_delivery_personal_name = univ.Integer(13)
|
| 833 |
+
|
| 834 |
+
teletex_personal_name = univ.Integer(4)
|
| 835 |
+
|
| 836 |
+
teletex_organizational_unit_names = univ.Integer(5)
|
| 837 |
+
|
| 838 |
+
|
| 839 |
+
class PhysicalDeliveryPersonalName(PDSParameter):
|
| 840 |
+
pass
|
| 841 |
+
|
| 842 |
+
|
| 843 |
+
ub_postal_code_length = univ.Integer(16)
|
| 844 |
+
|
| 845 |
+
|
| 846 |
+
class PostalCode(univ.Choice):
|
| 847 |
+
pass
|
| 848 |
+
|
| 849 |
+
|
| 850 |
+
PostalCode.componentType = namedtype.NamedTypes(
|
| 851 |
+
namedtype.NamedType('numeric-code', char.NumericString().subtype(
|
| 852 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length))),
|
| 853 |
+
namedtype.NamedType('printable-code', char.PrintableString().subtype(
|
| 854 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_postal_code_length)))
|
| 855 |
+
)
|
| 856 |
+
|
| 857 |
+
|
| 858 |
+
class X520countryName(char.PrintableString):
|
| 859 |
+
pass
|
| 860 |
+
|
| 861 |
+
|
| 862 |
+
X520countryName.subtypeSpec = constraint.ValueSizeConstraint(2, 2)
|
| 863 |
+
|
| 864 |
+
postal_code = univ.Integer(9)
|
| 865 |
+
|
| 866 |
+
id_ad_caRepository = _OID(id_ad, 5)
|
| 867 |
+
|
| 868 |
+
extension_physical_delivery_address_components = univ.Integer(15)
|
| 869 |
+
|
| 870 |
+
|
| 871 |
+
class PostOfficeBoxAddress(PDSParameter):
|
| 872 |
+
pass
|
| 873 |
+
|
| 874 |
+
|
| 875 |
+
class PhysicalDeliveryOfficeName(PDSParameter):
|
| 876 |
+
pass
|
| 877 |
+
|
| 878 |
+
|
| 879 |
+
id_at_title = _OID(id_at, 12)
|
| 880 |
+
|
| 881 |
+
id_at_serialNumber = _OID(id_at, 5)
|
| 882 |
+
|
| 883 |
+
id_ad_caIssuers = _OID(id_ad, 2)
|
| 884 |
+
|
| 885 |
+
ub_integer_options = univ.Integer(256)
|
| 886 |
+
|
| 887 |
+
|
| 888 |
+
class CertificateList(univ.Sequence):
|
| 889 |
+
pass
|
| 890 |
+
|
| 891 |
+
|
| 892 |
+
CertificateList.componentType = namedtype.NamedTypes(
|
| 893 |
+
namedtype.NamedType('tbsCertList', TBSCertList()),
|
| 894 |
+
namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
|
| 895 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 896 |
+
)
|
| 897 |
+
|
| 898 |
+
|
| 899 |
+
class PhysicalDeliveryOfficeNumber(PDSParameter):
|
| 900 |
+
pass
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
class TeletexOrganizationalUnitNames(univ.SequenceOf):
|
| 904 |
+
pass
|
| 905 |
+
|
| 906 |
+
|
| 907 |
+
TeletexOrganizationalUnitNames.componentType = TeletexOrganizationalUnitName()
|
| 908 |
+
TeletexOrganizationalUnitNames.sizeSpec = constraint.ValueSizeConstraint(1, ub_organizational_units)
|
| 909 |
+
|
| 910 |
+
physical_delivery_office_name = univ.Integer(10)
|
| 911 |
+
|
| 912 |
+
ub_common_name = univ.Integer(64)
|
| 913 |
+
|
| 914 |
+
|
| 915 |
+
class ExtensionORAddressComponents(PDSParameter):
|
| 916 |
+
pass
|
| 917 |
+
|
| 918 |
+
|
| 919 |
+
ub_pseudonym = univ.Integer(128)
|
| 920 |
+
|
| 921 |
+
poste_restante_address = univ.Integer(19)
|
| 922 |
+
|
| 923 |
+
id_at_organizationName = _OID(id_at, 10)
|
| 924 |
+
|
| 925 |
+
physical_delivery_office_number = univ.Integer(11)
|
| 926 |
+
|
| 927 |
+
id_at_pseudonym = _OID(id_at, 65)
|
| 928 |
+
|
| 929 |
+
|
| 930 |
+
class X520CommonName(univ.Choice):
|
| 931 |
+
pass
|
| 932 |
+
|
| 933 |
+
|
| 934 |
+
X520CommonName.componentType = namedtype.NamedTypes(
|
| 935 |
+
namedtype.NamedType('teletexString',
|
| 936 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 937 |
+
namedtype.NamedType('printableString',
|
| 938 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 939 |
+
namedtype.NamedType('universalString',
|
| 940 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 941 |
+
namedtype.NamedType('utf8String',
|
| 942 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name))),
|
| 943 |
+
namedtype.NamedType('bmpString',
|
| 944 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_common_name)))
|
| 945 |
+
)
|
| 946 |
+
|
| 947 |
+
physical_delivery_organization_name = univ.Integer(14)
|
| 948 |
+
|
| 949 |
+
|
| 950 |
+
class X520dnQualifier(char.PrintableString):
|
| 951 |
+
pass
|
| 952 |
+
|
| 953 |
+
|
| 954 |
+
id_at_stateOrProvinceName = _OID(id_at, 8)
|
| 955 |
+
|
| 956 |
+
common_name = univ.Integer(1)
|
| 957 |
+
|
| 958 |
+
id_at_localityName = _OID(id_at, 7)
|
| 959 |
+
|
| 960 |
+
ub_match = univ.Integer(128)
|
| 961 |
+
|
| 962 |
+
ub_unformatted_address_length = univ.Integer(180)
|
| 963 |
+
|
| 964 |
+
|
| 965 |
+
class Attribute(univ.Sequence):
|
| 966 |
+
pass
|
| 967 |
+
|
| 968 |
+
|
| 969 |
+
Attribute.componentType = namedtype.NamedTypes(
|
| 970 |
+
namedtype.NamedType('type', AttributeType()),
|
| 971 |
+
namedtype.NamedType('values', univ.SetOf(componentType=AttributeValue()))
|
| 972 |
+
)
|
| 973 |
+
|
| 974 |
+
extended_network_address = univ.Integer(22)
|
| 975 |
+
|
| 976 |
+
unique_postal_name = univ.Integer(20)
|
| 977 |
+
|
| 978 |
+
ub_pds_physical_address_lines = univ.Integer(6)
|
| 979 |
+
|
| 980 |
+
|
| 981 |
+
class UnformattedPostalAddress(univ.Set):
|
| 982 |
+
pass
|
| 983 |
+
|
| 984 |
+
|
| 985 |
+
UnformattedPostalAddress.componentType = namedtype.NamedTypes(
|
| 986 |
+
namedtype.OptionalNamedType('printable-address', univ.SequenceOf(componentType=char.PrintableString().subtype(
|
| 987 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_pds_parameter_length)))),
|
| 988 |
+
namedtype.OptionalNamedType('teletex-string', char.TeletexString().subtype(
|
| 989 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, ub_unformatted_address_length)))
|
| 990 |
+
)
|
| 991 |
+
|
| 992 |
+
|
| 993 |
+
class UniquePostalName(PDSParameter):
|
| 994 |
+
pass
|
| 995 |
+
|
| 996 |
+
|
| 997 |
+
class X520Pseudonym(univ.Choice):
|
| 998 |
+
pass
|
| 999 |
+
|
| 1000 |
+
|
| 1001 |
+
X520Pseudonym.componentType = namedtype.NamedTypes(
|
| 1002 |
+
namedtype.NamedType('teletexString',
|
| 1003 |
+
char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
|
| 1004 |
+
namedtype.NamedType('printableString',
|
| 1005 |
+
char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
|
| 1006 |
+
namedtype.NamedType('universalString',
|
| 1007 |
+
char.UniversalString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
|
| 1008 |
+
namedtype.NamedType('utf8String',
|
| 1009 |
+
char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym))),
|
| 1010 |
+
namedtype.NamedType('bmpString',
|
| 1011 |
+
char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_pseudonym)))
|
| 1012 |
+
)
|
| 1013 |
+
|
| 1014 |
+
teletex_organization_name = univ.Integer(3)
|
| 1015 |
+
|
| 1016 |
+
teletex_domain_defined_attributes = univ.Integer(6)
|
| 1017 |
+
|
| 1018 |
+
street_address = univ.Integer(17)
|
| 1019 |
+
|
| 1020 |
+
id_kp_OCSPSigning = _OID(id_kp, 9)
|
| 1021 |
+
|
| 1022 |
+
id_ce = _OID(2, 5, 29)
|
| 1023 |
+
|
| 1024 |
+
id_ce_certificatePolicies = _OID(id_ce, 32)
|
| 1025 |
+
|
| 1026 |
+
|
| 1027 |
+
class EDIPartyName(univ.Sequence):
|
| 1028 |
+
pass
|
| 1029 |
+
|
| 1030 |
+
|
| 1031 |
+
EDIPartyName.componentType = namedtype.NamedTypes(
|
| 1032 |
+
namedtype.OptionalNamedType('nameAssigner', DirectoryString().subtype(
|
| 1033 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1034 |
+
namedtype.NamedType('partyName',
|
| 1035 |
+
DirectoryString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1036 |
+
)
|
| 1037 |
+
|
| 1038 |
+
|
| 1039 |
+
class AnotherName(univ.Sequence):
|
| 1040 |
+
pass
|
| 1041 |
+
|
| 1042 |
+
|
| 1043 |
+
AnotherName.componentType = namedtype.NamedTypes(
|
| 1044 |
+
namedtype.NamedType('type-id', univ.ObjectIdentifier()),
|
| 1045 |
+
namedtype.NamedType('value', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 1046 |
+
)
|
| 1047 |
+
|
| 1048 |
+
|
| 1049 |
+
class GeneralName(univ.Choice):
|
| 1050 |
+
pass
|
| 1051 |
+
|
| 1052 |
+
|
| 1053 |
+
GeneralName.componentType = namedtype.NamedTypes(
|
| 1054 |
+
namedtype.NamedType('otherName',
|
| 1055 |
+
AnotherName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1056 |
+
namedtype.NamedType('rfc822Name',
|
| 1057 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1058 |
+
namedtype.NamedType('dNSName',
|
| 1059 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 1060 |
+
namedtype.NamedType('x400Address',
|
| 1061 |
+
ORAddress().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 1062 |
+
namedtype.NamedType('directoryName',
|
| 1063 |
+
Name().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 1064 |
+
namedtype.NamedType('ediPartyName',
|
| 1065 |
+
EDIPartyName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 1066 |
+
namedtype.NamedType('uniformResourceIdentifier',
|
| 1067 |
+
char.IA5String().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
|
| 1068 |
+
namedtype.NamedType('iPAddress',
|
| 1069 |
+
univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 1070 |
+
namedtype.NamedType('registeredID', univ.ObjectIdentifier().subtype(
|
| 1071 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)))
|
| 1072 |
+
)
|
| 1073 |
+
|
| 1074 |
+
|
| 1075 |
+
class GeneralNames(univ.SequenceOf):
|
| 1076 |
+
pass
|
| 1077 |
+
|
| 1078 |
+
|
| 1079 |
+
GeneralNames.componentType = GeneralName()
|
| 1080 |
+
GeneralNames.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1081 |
+
|
| 1082 |
+
|
| 1083 |
+
class IssuerAltName(GeneralNames):
|
| 1084 |
+
pass
|
| 1085 |
+
|
| 1086 |
+
|
| 1087 |
+
id_ce_cRLDistributionPoints = _OID(id_ce, 31)
|
| 1088 |
+
|
| 1089 |
+
|
| 1090 |
+
class CertPolicyId(univ.ObjectIdentifier):
|
| 1091 |
+
pass
|
| 1092 |
+
|
| 1093 |
+
|
| 1094 |
+
class PolicyMappings(univ.SequenceOf):
|
| 1095 |
+
pass
|
| 1096 |
+
|
| 1097 |
+
|
| 1098 |
+
PolicyMappings.componentType = univ.Sequence(componentType=namedtype.NamedTypes(
|
| 1099 |
+
namedtype.NamedType('issuerDomainPolicy', CertPolicyId()),
|
| 1100 |
+
namedtype.NamedType('subjectDomainPolicy', CertPolicyId())
|
| 1101 |
+
))
|
| 1102 |
+
|
| 1103 |
+
PolicyMappings.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1104 |
+
|
| 1105 |
+
|
| 1106 |
+
class PolicyQualifierId(univ.ObjectIdentifier):
|
| 1107 |
+
pass
|
| 1108 |
+
|
| 1109 |
+
|
| 1110 |
+
holdInstruction = _OID(2, 2, 840, 10040, 2)
|
| 1111 |
+
|
| 1112 |
+
id_ce_subjectDirectoryAttributes = _OID(id_ce, 9)
|
| 1113 |
+
|
| 1114 |
+
id_holdinstruction_callissuer = _OID(holdInstruction, 2)
|
| 1115 |
+
|
| 1116 |
+
|
| 1117 |
+
class SubjectDirectoryAttributes(univ.SequenceOf):
|
| 1118 |
+
pass
|
| 1119 |
+
|
| 1120 |
+
|
| 1121 |
+
SubjectDirectoryAttributes.componentType = Attribute()
|
| 1122 |
+
SubjectDirectoryAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1123 |
+
|
| 1124 |
+
anyPolicy = _OID(id_ce_certificatePolicies, 0)
|
| 1125 |
+
|
| 1126 |
+
id_ce_subjectAltName = _OID(id_ce, 17)
|
| 1127 |
+
|
| 1128 |
+
id_kp_emailProtection = _OID(id_kp, 4)
|
| 1129 |
+
|
| 1130 |
+
|
| 1131 |
+
class ReasonFlags(univ.BitString):
|
| 1132 |
+
pass
|
| 1133 |
+
|
| 1134 |
+
|
| 1135 |
+
ReasonFlags.namedValues = namedval.NamedValues(
|
| 1136 |
+
('unused', 0),
|
| 1137 |
+
('keyCompromise', 1),
|
| 1138 |
+
('cACompromise', 2),
|
| 1139 |
+
('affiliationChanged', 3),
|
| 1140 |
+
('superseded', 4),
|
| 1141 |
+
('cessationOfOperation', 5),
|
| 1142 |
+
('certificateHold', 6),
|
| 1143 |
+
('privilegeWithdrawn', 7),
|
| 1144 |
+
('aACompromise', 8)
|
| 1145 |
+
)
|
| 1146 |
+
|
| 1147 |
+
|
| 1148 |
+
class DistributionPointName(univ.Choice):
|
| 1149 |
+
pass
|
| 1150 |
+
|
| 1151 |
+
|
| 1152 |
+
DistributionPointName.componentType = namedtype.NamedTypes(
|
| 1153 |
+
namedtype.NamedType('fullName',
|
| 1154 |
+
GeneralNames().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1155 |
+
namedtype.NamedType('nameRelativeToCRLIssuer', RelativeDistinguishedName().subtype(
|
| 1156 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1157 |
+
)
|
| 1158 |
+
|
| 1159 |
+
|
| 1160 |
+
class DistributionPoint(univ.Sequence):
|
| 1161 |
+
pass
|
| 1162 |
+
|
| 1163 |
+
|
| 1164 |
+
DistributionPoint.componentType = namedtype.NamedTypes(
|
| 1165 |
+
namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
|
| 1166 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1167 |
+
namedtype.OptionalNamedType('reasons', ReasonFlags().subtype(
|
| 1168 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1169 |
+
namedtype.OptionalNamedType('cRLIssuer', GeneralNames().subtype(
|
| 1170 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 1171 |
+
)
|
| 1172 |
+
|
| 1173 |
+
id_ce_keyUsage = _OID(id_ce, 15)
|
| 1174 |
+
|
| 1175 |
+
|
| 1176 |
+
class PolicyQualifierInfo(univ.Sequence):
|
| 1177 |
+
pass
|
| 1178 |
+
|
| 1179 |
+
|
| 1180 |
+
PolicyQualifierInfo.componentType = namedtype.NamedTypes(
|
| 1181 |
+
namedtype.NamedType('policyQualifierId', PolicyQualifierId()),
|
| 1182 |
+
namedtype.NamedType('qualifier', univ.Any())
|
| 1183 |
+
)
|
| 1184 |
+
|
| 1185 |
+
|
| 1186 |
+
class PolicyInformation(univ.Sequence):
|
| 1187 |
+
pass
|
| 1188 |
+
|
| 1189 |
+
|
| 1190 |
+
PolicyInformation.componentType = namedtype.NamedTypes(
|
| 1191 |
+
namedtype.NamedType('policyIdentifier', CertPolicyId()),
|
| 1192 |
+
namedtype.OptionalNamedType('policyQualifiers', univ.SequenceOf(componentType=PolicyQualifierInfo()))
|
| 1193 |
+
)
|
| 1194 |
+
|
| 1195 |
+
|
| 1196 |
+
class CertificatePolicies(univ.SequenceOf):
|
| 1197 |
+
pass
|
| 1198 |
+
|
| 1199 |
+
|
| 1200 |
+
CertificatePolicies.componentType = PolicyInformation()
|
| 1201 |
+
CertificatePolicies.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1202 |
+
|
| 1203 |
+
id_ce_basicConstraints = _OID(id_ce, 19)
|
| 1204 |
+
|
| 1205 |
+
|
| 1206 |
+
class HoldInstructionCode(univ.ObjectIdentifier):
|
| 1207 |
+
pass
|
| 1208 |
+
|
| 1209 |
+
|
| 1210 |
+
class KeyPurposeId(univ.ObjectIdentifier):
|
| 1211 |
+
pass
|
| 1212 |
+
|
| 1213 |
+
|
| 1214 |
+
class ExtKeyUsageSyntax(univ.SequenceOf):
|
| 1215 |
+
pass
|
| 1216 |
+
|
| 1217 |
+
|
| 1218 |
+
ExtKeyUsageSyntax.componentType = KeyPurposeId()
|
| 1219 |
+
ExtKeyUsageSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1220 |
+
|
| 1221 |
+
|
| 1222 |
+
class SubjectAltName(GeneralNames):
|
| 1223 |
+
pass
|
| 1224 |
+
|
| 1225 |
+
|
| 1226 |
+
class BasicConstraints(univ.Sequence):
|
| 1227 |
+
pass
|
| 1228 |
+
|
| 1229 |
+
|
| 1230 |
+
BasicConstraints.componentType = namedtype.NamedTypes(
|
| 1231 |
+
namedtype.DefaultedNamedType('cA', univ.Boolean().subtype(value=0)),
|
| 1232 |
+
namedtype.OptionalNamedType('pathLenConstraint',
|
| 1233 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
|
| 1234 |
+
)
|
| 1235 |
+
|
| 1236 |
+
|
| 1237 |
+
class SkipCerts(univ.Integer):
|
| 1238 |
+
pass
|
| 1239 |
+
|
| 1240 |
+
|
| 1241 |
+
SkipCerts.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 1242 |
+
|
| 1243 |
+
|
| 1244 |
+
class InhibitAnyPolicy(SkipCerts):
|
| 1245 |
+
pass
|
| 1246 |
+
|
| 1247 |
+
|
| 1248 |
+
class CRLNumber(univ.Integer):
|
| 1249 |
+
pass
|
| 1250 |
+
|
| 1251 |
+
|
| 1252 |
+
CRLNumber.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 1253 |
+
|
| 1254 |
+
|
| 1255 |
+
class BaseCRLNumber(CRLNumber):
|
| 1256 |
+
pass
|
| 1257 |
+
|
| 1258 |
+
|
| 1259 |
+
class KeyIdentifier(univ.OctetString):
|
| 1260 |
+
pass
|
| 1261 |
+
|
| 1262 |
+
|
| 1263 |
+
class AuthorityKeyIdentifier(univ.Sequence):
|
| 1264 |
+
pass
|
| 1265 |
+
|
| 1266 |
+
|
| 1267 |
+
AuthorityKeyIdentifier.componentType = namedtype.NamedTypes(
|
| 1268 |
+
namedtype.OptionalNamedType('keyIdentifier', KeyIdentifier().subtype(
|
| 1269 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1270 |
+
namedtype.OptionalNamedType('authorityCertIssuer', GeneralNames().subtype(
|
| 1271 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 1272 |
+
namedtype.OptionalNamedType('authorityCertSerialNumber', CertificateSerialNumber().subtype(
|
| 1273 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 1274 |
+
)
|
| 1275 |
+
|
| 1276 |
+
id_ce_nameConstraints = _OID(id_ce, 30)
|
| 1277 |
+
|
| 1278 |
+
id_kp_serverAuth = _OID(id_kp, 1)
|
| 1279 |
+
|
| 1280 |
+
id_ce_freshestCRL = _OID(id_ce, 46)
|
| 1281 |
+
|
| 1282 |
+
id_ce_cRLReasons = _OID(id_ce, 21)
|
| 1283 |
+
|
| 1284 |
+
|
| 1285 |
+
class CRLDistributionPoints(univ.SequenceOf):
|
| 1286 |
+
pass
|
| 1287 |
+
|
| 1288 |
+
|
| 1289 |
+
CRLDistributionPoints.componentType = DistributionPoint()
|
| 1290 |
+
CRLDistributionPoints.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1291 |
+
|
| 1292 |
+
|
| 1293 |
+
class FreshestCRL(CRLDistributionPoints):
|
| 1294 |
+
pass
|
| 1295 |
+
|
| 1296 |
+
|
| 1297 |
+
id_ce_inhibitAnyPolicy = _OID(id_ce, 54)
|
| 1298 |
+
|
| 1299 |
+
|
| 1300 |
+
class CRLReason(univ.Enumerated):
|
| 1301 |
+
pass
|
| 1302 |
+
|
| 1303 |
+
|
| 1304 |
+
CRLReason.namedValues = namedval.NamedValues(
|
| 1305 |
+
('unspecified', 0),
|
| 1306 |
+
('keyCompromise', 1),
|
| 1307 |
+
('cACompromise', 2),
|
| 1308 |
+
('affiliationChanged', 3),
|
| 1309 |
+
('superseded', 4),
|
| 1310 |
+
('cessationOfOperation', 5),
|
| 1311 |
+
('certificateHold', 6),
|
| 1312 |
+
('removeFromCRL', 8),
|
| 1313 |
+
('privilegeWithdrawn', 9),
|
| 1314 |
+
('aACompromise', 10)
|
| 1315 |
+
)
|
| 1316 |
+
|
| 1317 |
+
|
| 1318 |
+
class BaseDistance(univ.Integer):
|
| 1319 |
+
pass
|
| 1320 |
+
|
| 1321 |
+
|
| 1322 |
+
BaseDistance.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 1323 |
+
|
| 1324 |
+
|
| 1325 |
+
class GeneralSubtree(univ.Sequence):
|
| 1326 |
+
pass
|
| 1327 |
+
|
| 1328 |
+
|
| 1329 |
+
GeneralSubtree.componentType = namedtype.NamedTypes(
|
| 1330 |
+
namedtype.NamedType('base', GeneralName()),
|
| 1331 |
+
namedtype.DefaultedNamedType('minimum', BaseDistance().subtype(
|
| 1332 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)),
|
| 1333 |
+
namedtype.OptionalNamedType('maximum', BaseDistance().subtype(
|
| 1334 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1335 |
+
)
|
| 1336 |
+
|
| 1337 |
+
|
| 1338 |
+
class GeneralSubtrees(univ.SequenceOf):
|
| 1339 |
+
pass
|
| 1340 |
+
|
| 1341 |
+
|
| 1342 |
+
GeneralSubtrees.componentType = GeneralSubtree()
|
| 1343 |
+
GeneralSubtrees.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1344 |
+
|
| 1345 |
+
|
| 1346 |
+
class NameConstraints(univ.Sequence):
|
| 1347 |
+
pass
|
| 1348 |
+
|
| 1349 |
+
|
| 1350 |
+
NameConstraints.componentType = namedtype.NamedTypes(
|
| 1351 |
+
namedtype.OptionalNamedType('permittedSubtrees', GeneralSubtrees().subtype(
|
| 1352 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1353 |
+
namedtype.OptionalNamedType('excludedSubtrees', GeneralSubtrees().subtype(
|
| 1354 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1355 |
+
)
|
| 1356 |
+
|
| 1357 |
+
id_pe_authorityInfoAccess = _OID(id_pe, 1)
|
| 1358 |
+
|
| 1359 |
+
id_pe_subjectInfoAccess = _OID(id_pe, 11)
|
| 1360 |
+
|
| 1361 |
+
id_ce_certificateIssuer = _OID(id_ce, 29)
|
| 1362 |
+
|
| 1363 |
+
id_ce_invalidityDate = _OID(id_ce, 24)
|
| 1364 |
+
|
| 1365 |
+
|
| 1366 |
+
class DirectoryString(univ.Choice):
|
| 1367 |
+
pass
|
| 1368 |
+
|
| 1369 |
+
|
| 1370 |
+
DirectoryString.componentType = namedtype.NamedTypes(
|
| 1371 |
+
namedtype.NamedType('any', univ.Any())
|
| 1372 |
+
)
|
| 1373 |
+
|
| 1374 |
+
id_ce_authorityKeyIdentifier = _OID(id_ce, 35)
|
| 1375 |
+
|
| 1376 |
+
|
| 1377 |
+
class AccessDescription(univ.Sequence):
|
| 1378 |
+
pass
|
| 1379 |
+
|
| 1380 |
+
|
| 1381 |
+
AccessDescription.componentType = namedtype.NamedTypes(
|
| 1382 |
+
namedtype.NamedType('accessMethod', univ.ObjectIdentifier()),
|
| 1383 |
+
namedtype.NamedType('accessLocation', GeneralName())
|
| 1384 |
+
)
|
| 1385 |
+
|
| 1386 |
+
|
| 1387 |
+
class AuthorityInfoAccessSyntax(univ.SequenceOf):
|
| 1388 |
+
pass
|
| 1389 |
+
|
| 1390 |
+
|
| 1391 |
+
AuthorityInfoAccessSyntax.componentType = AccessDescription()
|
| 1392 |
+
AuthorityInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1393 |
+
|
| 1394 |
+
id_ce_issuingDistributionPoint = _OID(id_ce, 28)
|
| 1395 |
+
|
| 1396 |
+
|
| 1397 |
+
class CPSuri(char.IA5String):
|
| 1398 |
+
pass
|
| 1399 |
+
|
| 1400 |
+
|
| 1401 |
+
class DisplayText(univ.Choice):
|
| 1402 |
+
pass
|
| 1403 |
+
|
| 1404 |
+
|
| 1405 |
+
DisplayText.componentType = namedtype.NamedTypes(
|
| 1406 |
+
namedtype.NamedType('ia5String', char.IA5String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 1407 |
+
namedtype.NamedType('visibleString',
|
| 1408 |
+
char.VisibleString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 1409 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 1410 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
|
| 1411 |
+
)
|
| 1412 |
+
|
| 1413 |
+
|
| 1414 |
+
class NoticeReference(univ.Sequence):
|
| 1415 |
+
pass
|
| 1416 |
+
|
| 1417 |
+
|
| 1418 |
+
NoticeReference.componentType = namedtype.NamedTypes(
|
| 1419 |
+
namedtype.NamedType('organization', DisplayText()),
|
| 1420 |
+
namedtype.NamedType('noticeNumbers', univ.SequenceOf(componentType=univ.Integer()))
|
| 1421 |
+
)
|
| 1422 |
+
|
| 1423 |
+
|
| 1424 |
+
class UserNotice(univ.Sequence):
|
| 1425 |
+
pass
|
| 1426 |
+
|
| 1427 |
+
|
| 1428 |
+
UserNotice.componentType = namedtype.NamedTypes(
|
| 1429 |
+
namedtype.OptionalNamedType('noticeRef', NoticeReference()),
|
| 1430 |
+
namedtype.OptionalNamedType('explicitText', DisplayText())
|
| 1431 |
+
)
|
| 1432 |
+
|
| 1433 |
+
|
| 1434 |
+
class PrivateKeyUsagePeriod(univ.Sequence):
|
| 1435 |
+
pass
|
| 1436 |
+
|
| 1437 |
+
|
| 1438 |
+
PrivateKeyUsagePeriod.componentType = namedtype.NamedTypes(
|
| 1439 |
+
namedtype.OptionalNamedType('notBefore', useful.GeneralizedTime().subtype(
|
| 1440 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1441 |
+
namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime().subtype(
|
| 1442 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1443 |
+
)
|
| 1444 |
+
|
| 1445 |
+
id_ce_subjectKeyIdentifier = _OID(id_ce, 14)
|
| 1446 |
+
|
| 1447 |
+
|
| 1448 |
+
class CertificateIssuer(GeneralNames):
|
| 1449 |
+
pass
|
| 1450 |
+
|
| 1451 |
+
|
| 1452 |
+
class InvalidityDate(useful.GeneralizedTime):
|
| 1453 |
+
pass
|
| 1454 |
+
|
| 1455 |
+
|
| 1456 |
+
class SubjectInfoAccessSyntax(univ.SequenceOf):
|
| 1457 |
+
pass
|
| 1458 |
+
|
| 1459 |
+
|
| 1460 |
+
SubjectInfoAccessSyntax.componentType = AccessDescription()
|
| 1461 |
+
SubjectInfoAccessSyntax.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 1462 |
+
|
| 1463 |
+
|
| 1464 |
+
class KeyUsage(univ.BitString):
|
| 1465 |
+
pass
|
| 1466 |
+
|
| 1467 |
+
|
| 1468 |
+
KeyUsage.namedValues = namedval.NamedValues(
|
| 1469 |
+
('digitalSignature', 0),
|
| 1470 |
+
('nonRepudiation', 1),
|
| 1471 |
+
('keyEncipherment', 2),
|
| 1472 |
+
('dataEncipherment', 3),
|
| 1473 |
+
('keyAgreement', 4),
|
| 1474 |
+
('keyCertSign', 5),
|
| 1475 |
+
('cRLSign', 6),
|
| 1476 |
+
('encipherOnly', 7),
|
| 1477 |
+
('decipherOnly', 8)
|
| 1478 |
+
)
|
| 1479 |
+
|
| 1480 |
+
id_ce_extKeyUsage = _OID(id_ce, 37)
|
| 1481 |
+
|
| 1482 |
+
anyExtendedKeyUsage = _OID(id_ce_extKeyUsage, 0)
|
| 1483 |
+
|
| 1484 |
+
id_ce_privateKeyUsagePeriod = _OID(id_ce, 16)
|
| 1485 |
+
|
| 1486 |
+
id_ce_policyMappings = _OID(id_ce, 33)
|
| 1487 |
+
|
| 1488 |
+
id_ce_cRLNumber = _OID(id_ce, 20)
|
| 1489 |
+
|
| 1490 |
+
id_ce_policyConstraints = _OID(id_ce, 36)
|
| 1491 |
+
|
| 1492 |
+
id_holdinstruction_none = _OID(holdInstruction, 1)
|
| 1493 |
+
|
| 1494 |
+
id_holdinstruction_reject = _OID(holdInstruction, 3)
|
| 1495 |
+
|
| 1496 |
+
id_kp_timeStamping = _OID(id_kp, 8)
|
| 1497 |
+
|
| 1498 |
+
|
| 1499 |
+
class PolicyConstraints(univ.Sequence):
|
| 1500 |
+
pass
|
| 1501 |
+
|
| 1502 |
+
|
| 1503 |
+
PolicyConstraints.componentType = namedtype.NamedTypes(
|
| 1504 |
+
namedtype.OptionalNamedType('requireExplicitPolicy',
|
| 1505 |
+
SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 1506 |
+
namedtype.OptionalNamedType('inhibitPolicyMapping',
|
| 1507 |
+
SkipCerts().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 1508 |
+
)
|
| 1509 |
+
|
| 1510 |
+
|
| 1511 |
+
class SubjectKeyIdentifier(KeyIdentifier):
|
| 1512 |
+
pass
|
| 1513 |
+
|
| 1514 |
+
|
| 1515 |
+
id_kp_clientAuth = _OID(id_kp, 2)
|
| 1516 |
+
|
| 1517 |
+
id_ce_deltaCRLIndicator = _OID(id_ce, 27)
|
| 1518 |
+
|
| 1519 |
+
id_ce_issuerAltName = _OID(id_ce, 18)
|
| 1520 |
+
|
| 1521 |
+
id_kp_codeSigning = _OID(id_kp, 3)
|
| 1522 |
+
|
| 1523 |
+
id_ce_holdInstructionCode = _OID(id_ce, 23)
|
| 1524 |
+
|
| 1525 |
+
|
| 1526 |
+
class IssuingDistributionPoint(univ.Sequence):
|
| 1527 |
+
pass
|
| 1528 |
+
|
| 1529 |
+
|
| 1530 |
+
IssuingDistributionPoint.componentType = namedtype.NamedTypes(
|
| 1531 |
+
namedtype.OptionalNamedType('distributionPoint', DistributionPointName().subtype(
|
| 1532 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 1533 |
+
namedtype.DefaultedNamedType('onlyContainsUserCerts', univ.Boolean().subtype(
|
| 1534 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(value=0)),
|
| 1535 |
+
namedtype.DefaultedNamedType('onlyContainsCACerts', univ.Boolean().subtype(
|
| 1536 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)).subtype(value=0)),
|
| 1537 |
+
namedtype.OptionalNamedType('onlySomeReasons', ReasonFlags().subtype(
|
| 1538 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 1539 |
+
namedtype.DefaultedNamedType('indirectCRL', univ.Boolean().subtype(
|
| 1540 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)).subtype(value=0)),
|
| 1541 |
+
namedtype.DefaultedNamedType('onlyContainsAttributeCerts', univ.Boolean().subtype(
|
| 1542 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)).subtype(value=0))
|
| 1543 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3412.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/rfc3412.txt
|
| 11 |
+
#
|
| 12 |
+
from pyasn1.type import constraint
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import univ
|
| 15 |
+
|
| 16 |
+
from pyasn1_modules import rfc1905
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class ScopedPDU(univ.Sequence):
|
| 20 |
+
componentType = namedtype.NamedTypes(
|
| 21 |
+
namedtype.NamedType('contextEngineId', univ.OctetString()),
|
| 22 |
+
namedtype.NamedType('contextName', univ.OctetString()),
|
| 23 |
+
namedtype.NamedType('data', rfc1905.PDUs())
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class ScopedPduData(univ.Choice):
|
| 28 |
+
componentType = namedtype.NamedTypes(
|
| 29 |
+
namedtype.NamedType('plaintext', ScopedPDU()),
|
| 30 |
+
namedtype.NamedType('encryptedPDU', univ.OctetString()),
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class HeaderData(univ.Sequence):
|
| 35 |
+
componentType = namedtype.NamedTypes(
|
| 36 |
+
namedtype.NamedType('msgID',
|
| 37 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
|
| 38 |
+
namedtype.NamedType('msgMaxSize',
|
| 39 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(484, 2147483647))),
|
| 40 |
+
namedtype.NamedType('msgFlags', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, 1))),
|
| 41 |
+
namedtype.NamedType('msgSecurityModel',
|
| 42 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 2147483647)))
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class SNMPv3Message(univ.Sequence):
|
| 47 |
+
componentType = namedtype.NamedTypes(
|
| 48 |
+
namedtype.NamedType('msgVersion',
|
| 49 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, 2147483647))),
|
| 50 |
+
namedtype.NamedType('msgGlobalData', HeaderData()),
|
| 51 |
+
namedtype.NamedType('msgSecurityParameters', univ.OctetString()),
|
| 52 |
+
namedtype.NamedType('msgData', ScopedPduData())
|
| 53 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3447.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-1.asn
|
| 11 |
+
#
|
| 12 |
+
# Sample captures could be obtained with "openssl genrsa" command
|
| 13 |
+
#
|
| 14 |
+
from pyasn1.type import constraint
|
| 15 |
+
from pyasn1.type import namedval
|
| 16 |
+
|
| 17 |
+
from pyasn1_modules.rfc2437 import *
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class OtherPrimeInfo(univ.Sequence):
|
| 21 |
+
componentType = namedtype.NamedTypes(
|
| 22 |
+
namedtype.NamedType('prime', univ.Integer()),
|
| 23 |
+
namedtype.NamedType('exponent', univ.Integer()),
|
| 24 |
+
namedtype.NamedType('coefficient', univ.Integer())
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class OtherPrimeInfos(univ.SequenceOf):
|
| 29 |
+
componentType = OtherPrimeInfo()
|
| 30 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class RSAPrivateKey(univ.Sequence):
|
| 34 |
+
componentType = namedtype.NamedTypes(
|
| 35 |
+
namedtype.NamedType('version', univ.Integer(namedValues=namedval.NamedValues(('two-prime', 0), ('multi', 1)))),
|
| 36 |
+
namedtype.NamedType('modulus', univ.Integer()),
|
| 37 |
+
namedtype.NamedType('publicExponent', univ.Integer()),
|
| 38 |
+
namedtype.NamedType('privateExponent', univ.Integer()),
|
| 39 |
+
namedtype.NamedType('prime1', univ.Integer()),
|
| 40 |
+
namedtype.NamedType('prime2', univ.Integer()),
|
| 41 |
+
namedtype.NamedType('exponent1', univ.Integer()),
|
| 42 |
+
namedtype.NamedType('exponent2', univ.Integer()),
|
| 43 |
+
namedtype.NamedType('coefficient', univ.Integer()),
|
| 44 |
+
namedtype.OptionalNamedType('otherPrimeInfos', OtherPrimeInfos())
|
| 45 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3537.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# SEED Encryption Algorithm in CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc4010.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
id_alg_HMACwith3DESwrap = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.11')
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
id_alg_HMACwithAESwrap = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.12')
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Update the Algorithm Identifier map in rfc5280.py.
|
| 28 |
+
|
| 29 |
+
_algorithmIdentifierMapUpdate = {
|
| 30 |
+
id_alg_HMACwith3DESwrap: univ.Null(""),
|
| 31 |
+
id_alg_HMACwithAESwrap: univ.Null(""),
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3560.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# RSAES-OAEP Key Transport Algorithm in CMS
|
| 10 |
+
#
|
| 11 |
+
# Notice that all of the things needed in RFC 3560 are also defined
|
| 12 |
+
# in RFC 4055. So, they are all pulled from the RFC 4055 module into
|
| 13 |
+
# this one so that people looking a RFC 3560 can easily find them.
|
| 14 |
+
#
|
| 15 |
+
# ASN.1 source from:
|
| 16 |
+
# https://www.rfc-editor.org/rfc/rfc3560.txt
|
| 17 |
+
#
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc4055
|
| 20 |
+
|
| 21 |
+
id_sha1 = rfc4055.id_sha1
|
| 22 |
+
|
| 23 |
+
id_sha256 = rfc4055.id_sha256
|
| 24 |
+
|
| 25 |
+
id_sha384 = rfc4055.id_sha384
|
| 26 |
+
|
| 27 |
+
id_sha512 = rfc4055.id_sha512
|
| 28 |
+
|
| 29 |
+
id_mgf1 = rfc4055.id_mgf1
|
| 30 |
+
|
| 31 |
+
rsaEncryption = rfc4055.rsaEncryption
|
| 32 |
+
|
| 33 |
+
id_RSAES_OAEP = rfc4055.id_RSAES_OAEP
|
| 34 |
+
|
| 35 |
+
id_pSpecified = rfc4055.id_pSpecified
|
| 36 |
+
|
| 37 |
+
sha1Identifier = rfc4055.sha1Identifier
|
| 38 |
+
|
| 39 |
+
sha256Identifier = rfc4055.sha256Identifier
|
| 40 |
+
|
| 41 |
+
sha384Identifier = rfc4055.sha384Identifier
|
| 42 |
+
|
| 43 |
+
sha512Identifier = rfc4055.sha512Identifier
|
| 44 |
+
|
| 45 |
+
mgf1SHA1Identifier = rfc4055.mgf1SHA1Identifier
|
| 46 |
+
|
| 47 |
+
mgf1SHA256Identifier = rfc4055.mgf1SHA256Identifier
|
| 48 |
+
|
| 49 |
+
mgf1SHA384Identifier = rfc4055.mgf1SHA384Identifier
|
| 50 |
+
|
| 51 |
+
mgf1SHA512Identifier = rfc4055.mgf1SHA512Identifier
|
| 52 |
+
|
| 53 |
+
pSpecifiedEmptyIdentifier = rfc4055.pSpecifiedEmptyIdentifier
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class RSAES_OAEP_params(rfc4055.RSAES_OAEP_params):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
rSAES_OAEP_Default_Params = RSAES_OAEP_params()
|
| 61 |
+
|
| 62 |
+
rSAES_OAEP_Default_Identifier = rfc4055.rSAES_OAEP_Default_Identifier
|
| 63 |
+
|
| 64 |
+
rSAES_OAEP_SHA256_Params = rfc4055.rSAES_OAEP_SHA256_Params
|
| 65 |
+
|
| 66 |
+
rSAES_OAEP_SHA256_Identifier = rfc4055.rSAES_OAEP_SHA256_Identifier
|
| 67 |
+
|
| 68 |
+
rSAES_OAEP_SHA384_Params = rfc4055.rSAES_OAEP_SHA384_Params
|
| 69 |
+
|
| 70 |
+
rSAES_OAEP_SHA384_Identifier = rfc4055.rSAES_OAEP_SHA384_Identifier
|
| 71 |
+
|
| 72 |
+
rSAES_OAEP_SHA512_Params = rfc4055.rSAES_OAEP_SHA512_Params
|
| 73 |
+
|
| 74 |
+
rSAES_OAEP_SHA512_Identifier = rfc4055.rSAES_OAEP_SHA512_Identifier
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3565.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley.
|
| 4 |
+
# Modified by Russ Housley to add maps for use with opentypes.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Use of the Advanced Encryption Standard (AES) Encryption
|
| 10 |
+
# Algorithm in the Cryptographic Message Syntax (CMS)
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc3565.txt
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class AlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 23 |
+
pass
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class AES_IV(univ.OctetString):
|
| 27 |
+
pass
|
| 28 |
+
|
| 29 |
+
AES_IV.subtypeSpec = constraint.ValueSizeConstraint(16, 16)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
id_aes128_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.2')
|
| 33 |
+
|
| 34 |
+
id_aes192_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.22')
|
| 35 |
+
|
| 36 |
+
id_aes256_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.42')
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
|
| 40 |
+
|
| 41 |
+
id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
|
| 42 |
+
|
| 43 |
+
id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Update the Algorithm Identifier map
|
| 47 |
+
|
| 48 |
+
_algorithmIdentifierMapUpdate = {
|
| 49 |
+
id_aes128_CBC: AES_IV(),
|
| 50 |
+
id_aes192_CBC: AES_IV(),
|
| 51 |
+
id_aes256_CBC: AES_IV(),
|
| 52 |
+
id_aes128_wrap: univ.Null(),
|
| 53 |
+
id_aes192_wrap: univ.Null(),
|
| 54 |
+
id_aes256_wrap: univ.Null(),
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3657.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Camellia Algorithm in CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc3657.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
from pyasn1_modules import rfc5751
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
id_camellia128_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.2')
|
| 23 |
+
|
| 24 |
+
id_camellia192_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.3')
|
| 25 |
+
|
| 26 |
+
id_camellia256_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.4')
|
| 27 |
+
|
| 28 |
+
id_camellia128_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.2')
|
| 29 |
+
|
| 30 |
+
id_camellia192_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.3')
|
| 31 |
+
|
| 32 |
+
id_camellia256_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.4')
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class Camellia_IV(univ.OctetString):
|
| 37 |
+
subtypeSpec = constraint.ValueSizeConstraint(16, 16)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class CamelliaSMimeCapability(univ.Null):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Update the Algorithm Identifier map in rfc5280.py.
|
| 45 |
+
|
| 46 |
+
_algorithmIdentifierMapUpdate = {
|
| 47 |
+
id_camellia128_cbc: Camellia_IV(),
|
| 48 |
+
id_camellia192_cbc: Camellia_IV(),
|
| 49 |
+
id_camellia256_cbc: Camellia_IV(),
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# Update the SMIMECapabilities Attribute map in rfc5751.py
|
| 56 |
+
|
| 57 |
+
_smimeCapabilityMapUpdate = {
|
| 58 |
+
id_camellia128_cbc: CamelliaSMimeCapability(),
|
| 59 |
+
id_camellia192_cbc: CamelliaSMimeCapability(),
|
| 60 |
+
id_camellia256_cbc: CamelliaSMimeCapability(),
|
| 61 |
+
id_camellia128_wrap: CamelliaSMimeCapability(),
|
| 62 |
+
id_camellia192_wrap: CamelliaSMimeCapability(),
|
| 63 |
+
id_camellia256_wrap: CamelliaSMimeCapability(),
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3709.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 maps for use with opentypes.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 8 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 9 |
+
#
|
| 10 |
+
# Logotypes in X.509 Certificates
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc3709.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import char
|
| 17 |
+
from pyasn1.type import constraint
|
| 18 |
+
from pyasn1.type import namedtype
|
| 19 |
+
from pyasn1.type import namedval
|
| 20 |
+
from pyasn1.type import tag
|
| 21 |
+
from pyasn1.type import univ
|
| 22 |
+
|
| 23 |
+
from pyasn1_modules import rfc5280
|
| 24 |
+
from pyasn1_modules import rfc6170
|
| 25 |
+
|
| 26 |
+
MAX = float('inf')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class HashAlgAndValue(univ.Sequence):
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
HashAlgAndValue.componentType = namedtype.NamedTypes(
|
| 33 |
+
namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),
|
| 34 |
+
namedtype.NamedType('hashValue', univ.OctetString())
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class LogotypeDetails(univ.Sequence):
|
| 39 |
+
pass
|
| 40 |
+
|
| 41 |
+
LogotypeDetails.componentType = namedtype.NamedTypes(
|
| 42 |
+
namedtype.NamedType('mediaType', char.IA5String()),
|
| 43 |
+
namedtype.NamedType('logotypeHash', univ.SequenceOf(
|
| 44 |
+
componentType=HashAlgAndValue()).subtype(
|
| 45 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 46 |
+
namedtype.NamedType('logotypeURI', univ.SequenceOf(
|
| 47 |
+
componentType=char.IA5String()).subtype(
|
| 48 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class LogotypeAudioInfo(univ.Sequence):
|
| 53 |
+
pass
|
| 54 |
+
|
| 55 |
+
LogotypeAudioInfo.componentType = namedtype.NamedTypes(
|
| 56 |
+
namedtype.NamedType('fileSize', univ.Integer()),
|
| 57 |
+
namedtype.NamedType('playTime', univ.Integer()),
|
| 58 |
+
namedtype.NamedType('channels', univ.Integer()),
|
| 59 |
+
namedtype.OptionalNamedType('sampleRate', univ.Integer().subtype(
|
| 60 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 61 |
+
namedtype.OptionalNamedType('language', char.IA5String().subtype(
|
| 62 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class LogotypeAudio(univ.Sequence):
|
| 67 |
+
pass
|
| 68 |
+
|
| 69 |
+
LogotypeAudio.componentType = namedtype.NamedTypes(
|
| 70 |
+
namedtype.NamedType('audioDetails', LogotypeDetails()),
|
| 71 |
+
namedtype.OptionalNamedType('audioInfo', LogotypeAudioInfo())
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class LogotypeImageType(univ.Integer):
|
| 76 |
+
pass
|
| 77 |
+
|
| 78 |
+
LogotypeImageType.namedValues = namedval.NamedValues(
|
| 79 |
+
('grayScale', 0),
|
| 80 |
+
('color', 1)
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class LogotypeImageResolution(univ.Choice):
|
| 85 |
+
pass
|
| 86 |
+
|
| 87 |
+
LogotypeImageResolution.componentType = namedtype.NamedTypes(
|
| 88 |
+
namedtype.NamedType('numBits',
|
| 89 |
+
univ.Integer().subtype(implicitTag=tag.Tag(
|
| 90 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 91 |
+
namedtype.NamedType('tableSize',
|
| 92 |
+
univ.Integer().subtype(implicitTag=tag.Tag(
|
| 93 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class LogotypeImageInfo(univ.Sequence):
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
LogotypeImageInfo.componentType = namedtype.NamedTypes(
|
| 101 |
+
namedtype.DefaultedNamedType('type', LogotypeImageType().subtype(
|
| 102 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 103 |
+
tag.tagFormatSimple, 0)).subtype(value='color')),
|
| 104 |
+
namedtype.NamedType('fileSize', univ.Integer()),
|
| 105 |
+
namedtype.NamedType('xSize', univ.Integer()),
|
| 106 |
+
namedtype.NamedType('ySize', univ.Integer()),
|
| 107 |
+
namedtype.OptionalNamedType('resolution', LogotypeImageResolution()),
|
| 108 |
+
namedtype.OptionalNamedType('language', char.IA5String().subtype(
|
| 109 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class LogotypeImage(univ.Sequence):
|
| 114 |
+
pass
|
| 115 |
+
|
| 116 |
+
LogotypeImage.componentType = namedtype.NamedTypes(
|
| 117 |
+
namedtype.NamedType('imageDetails', LogotypeDetails()),
|
| 118 |
+
namedtype.OptionalNamedType('imageInfo', LogotypeImageInfo())
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
class LogotypeData(univ.Sequence):
|
| 123 |
+
pass
|
| 124 |
+
|
| 125 |
+
LogotypeData.componentType = namedtype.NamedTypes(
|
| 126 |
+
namedtype.OptionalNamedType('image', univ.SequenceOf(
|
| 127 |
+
componentType=LogotypeImage())),
|
| 128 |
+
namedtype.OptionalNamedType('audio', univ.SequenceOf(
|
| 129 |
+
componentType=LogotypeAudio()).subtype(
|
| 130 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 131 |
+
tag.tagFormatSimple, 1)))
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class LogotypeReference(univ.Sequence):
|
| 136 |
+
pass
|
| 137 |
+
|
| 138 |
+
LogotypeReference.componentType = namedtype.NamedTypes(
|
| 139 |
+
namedtype.NamedType('refStructHash', univ.SequenceOf(
|
| 140 |
+
componentType=HashAlgAndValue()).subtype(
|
| 141 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 142 |
+
namedtype.NamedType('refStructURI', univ.SequenceOf(
|
| 143 |
+
componentType=char.IA5String()).subtype(
|
| 144 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
class LogotypeInfo(univ.Choice):
|
| 149 |
+
pass
|
| 150 |
+
|
| 151 |
+
LogotypeInfo.componentType = namedtype.NamedTypes(
|
| 152 |
+
namedtype.NamedType('direct',
|
| 153 |
+
LogotypeData().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 154 |
+
tag.tagFormatConstructed, 0))),
|
| 155 |
+
namedtype.NamedType('indirect', LogotypeReference().subtype(
|
| 156 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 157 |
+
tag.tagFormatConstructed, 1)))
|
| 158 |
+
)
|
| 159 |
+
|
| 160 |
+
# Other logotype type and associated object identifiers
|
| 161 |
+
|
| 162 |
+
id_logo_background = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.2')
|
| 163 |
+
|
| 164 |
+
id_logo_loyalty = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.1')
|
| 165 |
+
|
| 166 |
+
id_logo_certImage = rfc6170.id_logo_certImage
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class OtherLogotypeInfo(univ.Sequence):
|
| 170 |
+
pass
|
| 171 |
+
|
| 172 |
+
OtherLogotypeInfo.componentType = namedtype.NamedTypes(
|
| 173 |
+
namedtype.NamedType('logotypeType', univ.ObjectIdentifier()),
|
| 174 |
+
namedtype.NamedType('info', LogotypeInfo())
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
# Logotype Certificate Extension
|
| 179 |
+
|
| 180 |
+
id_pe_logotype = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.12')
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class LogotypeExtn(univ.Sequence):
|
| 184 |
+
pass
|
| 185 |
+
|
| 186 |
+
LogotypeExtn.componentType = namedtype.NamedTypes(
|
| 187 |
+
namedtype.OptionalNamedType('communityLogos', univ.SequenceOf(
|
| 188 |
+
componentType=LogotypeInfo()).subtype(
|
| 189 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 190 |
+
namedtype.OptionalNamedType('issuerLogo', LogotypeInfo().subtype(
|
| 191 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 192 |
+
namedtype.OptionalNamedType('subjectLogo', LogotypeInfo().subtype(
|
| 193 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 194 |
+
namedtype.OptionalNamedType('otherLogos', univ.SequenceOf(
|
| 195 |
+
componentType=OtherLogotypeInfo()).subtype(explicitTag=tag.Tag(
|
| 196 |
+
tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
# Map of Certificate Extension OIDs to Extensions added to the
|
| 201 |
+
# ones that are in rfc5280.py
|
| 202 |
+
|
| 203 |
+
_certificateExtensionsMapUpdate = {
|
| 204 |
+
id_pe_logotype: LogotypeExtn(),
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3739.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 5 |
+
# Modified by Russ Housley to add WithComponentsConstraints to
|
| 6 |
+
# enforce the requirements that are indicated in comments.
|
| 7 |
+
#
|
| 8 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 9 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 10 |
+
#
|
| 11 |
+
# Qualified Certificates
|
| 12 |
+
#
|
| 13 |
+
# ASN.1 source from:
|
| 14 |
+
# https://www.rfc-editor.org/rfc/rfc3739.txt
|
| 15 |
+
#
|
| 16 |
+
|
| 17 |
+
from pyasn1.type import char
|
| 18 |
+
from pyasn1.type import constraint
|
| 19 |
+
from pyasn1.type import namedtype
|
| 20 |
+
from pyasn1.type import namedval
|
| 21 |
+
from pyasn1.type import opentype
|
| 22 |
+
from pyasn1.type import univ
|
| 23 |
+
from pyasn1.type import useful
|
| 24 |
+
|
| 25 |
+
from pyasn1_modules import rfc5280
|
| 26 |
+
|
| 27 |
+
MAX = float('inf')
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# Initialize the qcStatement map
|
| 31 |
+
|
| 32 |
+
qcStatementMap = { }
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# Imports from RFC 5280
|
| 36 |
+
|
| 37 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 38 |
+
|
| 39 |
+
AttributeType = rfc5280.AttributeType
|
| 40 |
+
|
| 41 |
+
DirectoryString = rfc5280.DirectoryString
|
| 42 |
+
|
| 43 |
+
GeneralName = rfc5280.GeneralName
|
| 44 |
+
|
| 45 |
+
id_pkix = rfc5280.id_pkix
|
| 46 |
+
|
| 47 |
+
id_pe = rfc5280.id_pe
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# Arc for QC personal data attributes
|
| 51 |
+
|
| 52 |
+
id_pda = id_pkix + (9, )
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
# Arc for QC statements
|
| 56 |
+
|
| 57 |
+
id_qcs = id_pkix + (11, )
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# Personal data attributes
|
| 61 |
+
|
| 62 |
+
id_pda_dateOfBirth = id_pda + (1, )
|
| 63 |
+
|
| 64 |
+
class DateOfBirth(useful.GeneralizedTime):
|
| 65 |
+
pass
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
id_pda_placeOfBirth = id_pda + (2, )
|
| 69 |
+
|
| 70 |
+
class PlaceOfBirth(DirectoryString):
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
id_pda_gender = id_pda + (3, )
|
| 75 |
+
|
| 76 |
+
class Gender(char.PrintableString):
|
| 77 |
+
subtypeSpec = constraint.ConstraintsIntersection(
|
| 78 |
+
constraint.ValueSizeConstraint(1, 1),
|
| 79 |
+
constraint.SingleValueConstraint('M', 'F', 'm', 'f')
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
id_pda_countryOfCitizenship = id_pda + (4, )
|
| 84 |
+
|
| 85 |
+
class CountryOfCitizenship(char.PrintableString):
|
| 86 |
+
subtypeSpec = constraint.ValueSizeConstraint(2, 2)
|
| 87 |
+
# ISO 3166 Country Code
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
id_pda_countryOfResidence = id_pda + (5, )
|
| 91 |
+
|
| 92 |
+
class CountryOfResidence(char.PrintableString):
|
| 93 |
+
subtypeSpec = constraint.ValueSizeConstraint(2, 2)
|
| 94 |
+
# ISO 3166 Country Code
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
# Biometric info certificate extension
|
| 98 |
+
|
| 99 |
+
id_pe_biometricInfo = id_pe + (2, )
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class PredefinedBiometricType(univ.Integer):
|
| 103 |
+
namedValues = namedval.NamedValues(
|
| 104 |
+
('picture', 0),
|
| 105 |
+
('handwritten-signature', 1)
|
| 106 |
+
)
|
| 107 |
+
subtypeSpec = constraint.SingleValueConstraint(0, 1)
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
class TypeOfBiometricData(univ.Choice):
|
| 111 |
+
componentType = namedtype.NamedTypes(
|
| 112 |
+
namedtype.NamedType('predefinedBiometricType', PredefinedBiometricType()),
|
| 113 |
+
namedtype.NamedType('biometricDataOid', univ.ObjectIdentifier())
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class BiometricData(univ.Sequence):
|
| 118 |
+
componentType = namedtype.NamedTypes(
|
| 119 |
+
namedtype.NamedType('typeOfBiometricData', TypeOfBiometricData()),
|
| 120 |
+
namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
|
| 121 |
+
namedtype.NamedType('biometricDataHash', univ.OctetString()),
|
| 122 |
+
namedtype.OptionalNamedType('sourceDataUri', char.IA5String())
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class BiometricSyntax(univ.SequenceOf):
|
| 127 |
+
componentType = BiometricData()
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# QC Statements certificate extension
|
| 131 |
+
# NOTE: This extension does not allow to mix critical and
|
| 132 |
+
# non-critical Qualified Certificate Statements. Either all
|
| 133 |
+
# statements must be critical or all statements must be
|
| 134 |
+
# non-critical.
|
| 135 |
+
|
| 136 |
+
id_pe_qcStatements = id_pe + (3, )
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class NameRegistrationAuthorities(univ.SequenceOf):
|
| 140 |
+
componentType = GeneralName()
|
| 141 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class QCStatement(univ.Sequence):
|
| 145 |
+
componentType = namedtype.NamedTypes(
|
| 146 |
+
namedtype.NamedType('statementId', univ.ObjectIdentifier()),
|
| 147 |
+
namedtype.OptionalNamedType('statementInfo', univ.Any(),
|
| 148 |
+
openType=opentype.OpenType('statementId', qcStatementMap))
|
| 149 |
+
)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class QCStatements(univ.SequenceOf):
|
| 153 |
+
componentType = QCStatement()
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
class SemanticsInformation(univ.Sequence):
|
| 157 |
+
componentType = namedtype.NamedTypes(
|
| 158 |
+
namedtype.OptionalNamedType('semanticsIndentifier',
|
| 159 |
+
univ.ObjectIdentifier()),
|
| 160 |
+
namedtype.OptionalNamedType('nameRegistrationAuthorities',
|
| 161 |
+
NameRegistrationAuthorities())
|
| 162 |
+
)
|
| 163 |
+
subtypeSpec = constraint.ConstraintsUnion(
|
| 164 |
+
constraint.WithComponentsConstraint(
|
| 165 |
+
('semanticsIndentifier', constraint.ComponentPresentConstraint())),
|
| 166 |
+
constraint.WithComponentsConstraint(
|
| 167 |
+
('nameRegistrationAuthorities', constraint.ComponentPresentConstraint()))
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
id_qcs = id_pkix + (11, )
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
id_qcs_pkixQCSyntax_v1 = id_qcs + (1, )
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
id_qcs_pkixQCSyntax_v2 = id_qcs + (2, )
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
# Map of Certificate Extension OIDs to Extensions
|
| 181 |
+
# To be added to the ones that are in rfc5280.py
|
| 182 |
+
|
| 183 |
+
_certificateExtensionsMap = {
|
| 184 |
+
id_pe_biometricInfo: BiometricSyntax(),
|
| 185 |
+
id_pe_qcStatements: QCStatements(),
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
# Map of AttributeType OIDs to AttributeValue added to the
|
| 192 |
+
# ones that are in rfc5280.py
|
| 193 |
+
|
| 194 |
+
_certificateAttributesMapUpdate = {
|
| 195 |
+
id_pda_dateOfBirth: DateOfBirth(),
|
| 196 |
+
id_pda_placeOfBirth: PlaceOfBirth(),
|
| 197 |
+
id_pda_gender: Gender(),
|
| 198 |
+
id_pda_countryOfCitizenship: CountryOfCitizenship(),
|
| 199 |
+
id_pda_countryOfResidence: CountryOfResidence(),
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
| 203 |
+
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc3770.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/rfc3770.txt
|
| 14 |
+
# https://www.rfc-editor.org/errata/eid234
|
| 15 |
+
#
|
| 16 |
+
|
| 17 |
+
from pyasn1.type import constraint
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
from pyasn1_modules import rfc5280
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
MAX = float('inf')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Extended Key Usage Values
|
| 27 |
+
|
| 28 |
+
id_kp_eapOverLAN = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.14')
|
| 29 |
+
|
| 30 |
+
id_kp_eapOverPPP = univ.ObjectIdentifier('1.3.6.1.5.5.7.3.13')
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Wireless LAN SSID Extension
|
| 34 |
+
|
| 35 |
+
id_pe_wlanSSID = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.13')
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class SSID(univ.OctetString):
|
| 39 |
+
pass
|
| 40 |
+
|
| 41 |
+
SSID.subtypeSpec = constraint.ValueSizeConstraint(1, 32)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class SSIDList(univ.SequenceOf):
|
| 45 |
+
pass
|
| 46 |
+
|
| 47 |
+
SSIDList.componentType = SSID()
|
| 48 |
+
SSIDList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Wireless LAN SSID Attribute Certificate Attribute
|
| 52 |
+
# Uses same syntax as the certificate extension: SSIDList
|
| 53 |
+
# Correction for https://www.rfc-editor.org/errata/eid234
|
| 54 |
+
|
| 55 |
+
id_aca_wlanSSID = univ.ObjectIdentifier('1.3.6.1.5.5.7.10.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/rfc3779.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 maps for use with opentypes.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 8 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 9 |
+
#
|
| 10 |
+
# X.509 Extensions for IP Addresses and AS Identifiers
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc3779.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 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 |
+
|
| 24 |
+
# IP Address Delegation Extension
|
| 25 |
+
|
| 26 |
+
id_pe_ipAddrBlocks = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.7')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class IPAddress(univ.BitString):
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class IPAddressRange(univ.Sequence):
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
+
IPAddressRange.componentType = namedtype.NamedTypes(
|
| 37 |
+
namedtype.NamedType('min', IPAddress()),
|
| 38 |
+
namedtype.NamedType('max', IPAddress())
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class IPAddressOrRange(univ.Choice):
|
| 43 |
+
pass
|
| 44 |
+
|
| 45 |
+
IPAddressOrRange.componentType = namedtype.NamedTypes(
|
| 46 |
+
namedtype.NamedType('addressPrefix', IPAddress()),
|
| 47 |
+
namedtype.NamedType('addressRange', IPAddressRange())
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class IPAddressChoice(univ.Choice):
|
| 52 |
+
pass
|
| 53 |
+
|
| 54 |
+
IPAddressChoice.componentType = namedtype.NamedTypes(
|
| 55 |
+
namedtype.NamedType('inherit', univ.Null()),
|
| 56 |
+
namedtype.NamedType('addressesOrRanges', univ.SequenceOf(
|
| 57 |
+
componentType=IPAddressOrRange())
|
| 58 |
+
)
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class IPAddressFamily(univ.Sequence):
|
| 63 |
+
pass
|
| 64 |
+
|
| 65 |
+
IPAddressFamily.componentType = namedtype.NamedTypes(
|
| 66 |
+
namedtype.NamedType('addressFamily', univ.OctetString().subtype(
|
| 67 |
+
subtypeSpec=constraint.ValueSizeConstraint(2, 3))),
|
| 68 |
+
namedtype.NamedType('ipAddressChoice', IPAddressChoice())
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class IPAddrBlocks(univ.SequenceOf):
|
| 73 |
+
pass
|
| 74 |
+
|
| 75 |
+
IPAddrBlocks.componentType = IPAddressFamily()
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
# Autonomous System Identifier Delegation Extension
|
| 79 |
+
|
| 80 |
+
id_pe_autonomousSysIds = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.8')
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
class ASId(univ.Integer):
|
| 84 |
+
pass
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class ASRange(univ.Sequence):
|
| 88 |
+
pass
|
| 89 |
+
|
| 90 |
+
ASRange.componentType = namedtype.NamedTypes(
|
| 91 |
+
namedtype.NamedType('min', ASId()),
|
| 92 |
+
namedtype.NamedType('max', ASId())
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class ASIdOrRange(univ.Choice):
|
| 97 |
+
pass
|
| 98 |
+
|
| 99 |
+
ASIdOrRange.componentType = namedtype.NamedTypes(
|
| 100 |
+
namedtype.NamedType('id', ASId()),
|
| 101 |
+
namedtype.NamedType('range', ASRange())
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class ASIdentifierChoice(univ.Choice):
|
| 106 |
+
pass
|
| 107 |
+
|
| 108 |
+
ASIdentifierChoice.componentType = namedtype.NamedTypes(
|
| 109 |
+
namedtype.NamedType('inherit', univ.Null()),
|
| 110 |
+
namedtype.NamedType('asIdsOrRanges', univ.SequenceOf(
|
| 111 |
+
componentType=ASIdOrRange())
|
| 112 |
+
)
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class ASIdentifiers(univ.Sequence):
|
| 117 |
+
pass
|
| 118 |
+
|
| 119 |
+
ASIdentifiers.componentType = namedtype.NamedTypes(
|
| 120 |
+
namedtype.OptionalNamedType('asnum', ASIdentifierChoice().subtype(
|
| 121 |
+
explicitTag=tag.Tag(tag.tagClassContext,
|
| 122 |
+
tag.tagFormatConstructed, 0))),
|
| 123 |
+
namedtype.OptionalNamedType('rdi', ASIdentifierChoice().subtype(
|
| 124 |
+
explicitTag=tag.Tag(tag.tagClassContext,
|
| 125 |
+
tag.tagFormatConstructed, 1)))
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
# Map of Certificate Extension OIDs to Extensions is added to the
|
| 130 |
+
# ones that are in rfc5280.py
|
| 131 |
+
|
| 132 |
+
_certificateExtensionsMapUpdate = {
|
| 133 |
+
id_pe_ipAddrBlocks: IPAddrBlocks(),
|
| 134 |
+
id_pe_autonomousSysIds: ASIdentifiers(),
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4010.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# SEED Encryption Algorithm in CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc4010.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
from pyasn1_modules import rfc5751
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
id_seedCBC = univ.ObjectIdentifier('1.2.410.200004.1.4')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
id_npki_app_cmsSeed_wrap = univ.ObjectIdentifier('1.2.410.200004.7.1.1.1')
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class SeedIV(univ.OctetString):
|
| 29 |
+
subtypeSpec = constraint.ValueSizeConstraint(16, 16)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class SeedCBCParameter(SeedIV):
|
| 33 |
+
pass
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class SeedSMimeCapability(univ.Null):
|
| 37 |
+
pass
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Update the Algorithm Identifier map in rfc5280.py.
|
| 41 |
+
|
| 42 |
+
_algorithmIdentifierMapUpdate = {
|
| 43 |
+
id_seedCBC: SeedCBCParameter(),
|
| 44 |
+
id_npki_app_cmsSeed_wrap: univ.Null(""),
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# Update the SMIMECapabilities Attribute map in rfc5751.py
|
| 51 |
+
|
| 52 |
+
_smimeCapabilityMapUpdate = {
|
| 53 |
+
id_seedCBC: SeedSMimeCapability(),
|
| 54 |
+
id_npki_app_cmsSeed_wrap: SeedSMimeCapability(),
|
| 55 |
+
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4055.py
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley with a very small amount of assistance from
|
| 5 |
+
# asn1ate v.0.6.0.
|
| 6 |
+
# Modified by Russ Housley to add maps for opentypes.
|
| 7 |
+
#
|
| 8 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 9 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 10 |
+
#
|
| 11 |
+
# Additional Algorithms and Identifiers for RSA Cryptography
|
| 12 |
+
# for use in Certificates and CRLs
|
| 13 |
+
#
|
| 14 |
+
# ASN.1 source from:
|
| 15 |
+
# https://www.rfc-editor.org/rfc/rfc4055.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 |
+
|
| 24 |
+
def _OID(*components):
|
| 25 |
+
output = []
|
| 26 |
+
for x in tuple(components):
|
| 27 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 28 |
+
output.extend(list(x))
|
| 29 |
+
else:
|
| 30 |
+
output.append(int(x))
|
| 31 |
+
return univ.ObjectIdentifier(output)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
id_sha1 = _OID(1, 3, 14, 3, 2, 26)
|
| 35 |
+
|
| 36 |
+
id_sha256 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 1)
|
| 37 |
+
|
| 38 |
+
id_sha384 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 2)
|
| 39 |
+
|
| 40 |
+
id_sha512 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 3)
|
| 41 |
+
|
| 42 |
+
id_sha224 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 4)
|
| 43 |
+
|
| 44 |
+
rsaEncryption = _OID(1, 2, 840, 113549, 1, 1, 1)
|
| 45 |
+
|
| 46 |
+
id_mgf1 = _OID(1, 2, 840, 113549, 1, 1, 8)
|
| 47 |
+
|
| 48 |
+
id_RSAES_OAEP = _OID(1, 2, 840, 113549, 1, 1, 7)
|
| 49 |
+
|
| 50 |
+
id_pSpecified = _OID(1, 2, 840, 113549, 1, 1, 9)
|
| 51 |
+
|
| 52 |
+
id_RSASSA_PSS = _OID(1, 2, 840, 113549, 1, 1, 10)
|
| 53 |
+
|
| 54 |
+
sha256WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 11)
|
| 55 |
+
|
| 56 |
+
sha384WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 12)
|
| 57 |
+
|
| 58 |
+
sha512WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 13)
|
| 59 |
+
|
| 60 |
+
sha224WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 14)
|
| 61 |
+
|
| 62 |
+
sha1Identifier = rfc5280.AlgorithmIdentifier()
|
| 63 |
+
sha1Identifier['algorithm'] = id_sha1
|
| 64 |
+
sha1Identifier['parameters'] = univ.Null("")
|
| 65 |
+
|
| 66 |
+
sha224Identifier = rfc5280.AlgorithmIdentifier()
|
| 67 |
+
sha224Identifier['algorithm'] = id_sha224
|
| 68 |
+
sha224Identifier['parameters'] = univ.Null("")
|
| 69 |
+
|
| 70 |
+
sha256Identifier = rfc5280.AlgorithmIdentifier()
|
| 71 |
+
sha256Identifier['algorithm'] = id_sha256
|
| 72 |
+
sha256Identifier['parameters'] = univ.Null("")
|
| 73 |
+
|
| 74 |
+
sha384Identifier = rfc5280.AlgorithmIdentifier()
|
| 75 |
+
sha384Identifier['algorithm'] = id_sha384
|
| 76 |
+
sha384Identifier['parameters'] = univ.Null("")
|
| 77 |
+
|
| 78 |
+
sha512Identifier = rfc5280.AlgorithmIdentifier()
|
| 79 |
+
sha512Identifier['algorithm'] = id_sha512
|
| 80 |
+
sha512Identifier['parameters'] = univ.Null("")
|
| 81 |
+
|
| 82 |
+
mgf1SHA1Identifier = rfc5280.AlgorithmIdentifier()
|
| 83 |
+
mgf1SHA1Identifier['algorithm'] = id_mgf1
|
| 84 |
+
mgf1SHA1Identifier['parameters'] = sha1Identifier
|
| 85 |
+
|
| 86 |
+
mgf1SHA224Identifier = rfc5280.AlgorithmIdentifier()
|
| 87 |
+
mgf1SHA224Identifier['algorithm'] = id_mgf1
|
| 88 |
+
mgf1SHA224Identifier['parameters'] = sha224Identifier
|
| 89 |
+
|
| 90 |
+
mgf1SHA256Identifier = rfc5280.AlgorithmIdentifier()
|
| 91 |
+
mgf1SHA256Identifier['algorithm'] = id_mgf1
|
| 92 |
+
mgf1SHA256Identifier['parameters'] = sha256Identifier
|
| 93 |
+
|
| 94 |
+
mgf1SHA384Identifier = rfc5280.AlgorithmIdentifier()
|
| 95 |
+
mgf1SHA384Identifier['algorithm'] = id_mgf1
|
| 96 |
+
mgf1SHA384Identifier['parameters'] = sha384Identifier
|
| 97 |
+
|
| 98 |
+
mgf1SHA512Identifier = rfc5280.AlgorithmIdentifier()
|
| 99 |
+
mgf1SHA512Identifier['algorithm'] = id_mgf1
|
| 100 |
+
mgf1SHA512Identifier['parameters'] = sha512Identifier
|
| 101 |
+
|
| 102 |
+
pSpecifiedEmptyIdentifier = rfc5280.AlgorithmIdentifier()
|
| 103 |
+
pSpecifiedEmptyIdentifier['algorithm'] = id_pSpecified
|
| 104 |
+
pSpecifiedEmptyIdentifier['parameters'] = univ.OctetString(value='')
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class RSAPublicKey(univ.Sequence):
|
| 108 |
+
pass
|
| 109 |
+
|
| 110 |
+
RSAPublicKey.componentType = namedtype.NamedTypes(
|
| 111 |
+
namedtype.NamedType('modulus', univ.Integer()),
|
| 112 |
+
namedtype.NamedType('publicExponent', univ.Integer())
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class HashAlgorithm(rfc5280.AlgorithmIdentifier):
|
| 117 |
+
pass
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
class MaskGenAlgorithm(rfc5280.AlgorithmIdentifier):
|
| 121 |
+
pass
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class RSAES_OAEP_params(univ.Sequence):
|
| 125 |
+
pass
|
| 126 |
+
|
| 127 |
+
RSAES_OAEP_params.componentType = namedtype.NamedTypes(
|
| 128 |
+
namedtype.OptionalNamedType('hashFunc', rfc5280.AlgorithmIdentifier().subtype(
|
| 129 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 130 |
+
namedtype.OptionalNamedType('maskGenFunc', rfc5280.AlgorithmIdentifier().subtype(
|
| 131 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 132 |
+
namedtype.OptionalNamedType('pSourceFunc', rfc5280.AlgorithmIdentifier().subtype(
|
| 133 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
rSAES_OAEP_Default_Params = RSAES_OAEP_params()
|
| 137 |
+
|
| 138 |
+
rSAES_OAEP_Default_Identifier = rfc5280.AlgorithmIdentifier()
|
| 139 |
+
rSAES_OAEP_Default_Identifier['algorithm'] = id_RSAES_OAEP
|
| 140 |
+
rSAES_OAEP_Default_Identifier['parameters'] = rSAES_OAEP_Default_Params
|
| 141 |
+
|
| 142 |
+
rSAES_OAEP_SHA224_Params = RSAES_OAEP_params()
|
| 143 |
+
rSAES_OAEP_SHA224_Params['hashFunc'] = sha224Identifier.subtype(
|
| 144 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 145 |
+
rSAES_OAEP_SHA224_Params['maskGenFunc'] = mgf1SHA224Identifier.subtype(
|
| 146 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 147 |
+
|
| 148 |
+
rSAES_OAEP_SHA224_Identifier = rfc5280.AlgorithmIdentifier()
|
| 149 |
+
rSAES_OAEP_SHA224_Identifier['algorithm'] = id_RSAES_OAEP
|
| 150 |
+
rSAES_OAEP_SHA224_Identifier['parameters'] = rSAES_OAEP_SHA224_Params
|
| 151 |
+
|
| 152 |
+
rSAES_OAEP_SHA256_Params = RSAES_OAEP_params()
|
| 153 |
+
rSAES_OAEP_SHA256_Params['hashFunc'] = sha256Identifier.subtype(
|
| 154 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 155 |
+
rSAES_OAEP_SHA256_Params['maskGenFunc'] = mgf1SHA256Identifier.subtype(
|
| 156 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 157 |
+
|
| 158 |
+
rSAES_OAEP_SHA256_Identifier = rfc5280.AlgorithmIdentifier()
|
| 159 |
+
rSAES_OAEP_SHA256_Identifier['algorithm'] = id_RSAES_OAEP
|
| 160 |
+
rSAES_OAEP_SHA256_Identifier['parameters'] = rSAES_OAEP_SHA256_Params
|
| 161 |
+
|
| 162 |
+
rSAES_OAEP_SHA384_Params = RSAES_OAEP_params()
|
| 163 |
+
rSAES_OAEP_SHA384_Params['hashFunc'] = sha384Identifier.subtype(
|
| 164 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 165 |
+
rSAES_OAEP_SHA384_Params['maskGenFunc'] = mgf1SHA384Identifier.subtype(
|
| 166 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 167 |
+
|
| 168 |
+
rSAES_OAEP_SHA384_Identifier = rfc5280.AlgorithmIdentifier()
|
| 169 |
+
rSAES_OAEP_SHA384_Identifier['algorithm'] = id_RSAES_OAEP
|
| 170 |
+
rSAES_OAEP_SHA384_Identifier['parameters'] = rSAES_OAEP_SHA384_Params
|
| 171 |
+
|
| 172 |
+
rSAES_OAEP_SHA512_Params = RSAES_OAEP_params()
|
| 173 |
+
rSAES_OAEP_SHA512_Params['hashFunc'] = sha512Identifier.subtype(
|
| 174 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 175 |
+
rSAES_OAEP_SHA512_Params['maskGenFunc'] = mgf1SHA512Identifier.subtype(
|
| 176 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 177 |
+
|
| 178 |
+
rSAES_OAEP_SHA512_Identifier = rfc5280.AlgorithmIdentifier()
|
| 179 |
+
rSAES_OAEP_SHA512_Identifier['algorithm'] = id_RSAES_OAEP
|
| 180 |
+
rSAES_OAEP_SHA512_Identifier['parameters'] = rSAES_OAEP_SHA512_Params
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class RSASSA_PSS_params(univ.Sequence):
|
| 184 |
+
pass
|
| 185 |
+
|
| 186 |
+
RSASSA_PSS_params.componentType = namedtype.NamedTypes(
|
| 187 |
+
namedtype.OptionalNamedType('hashAlgorithm', rfc5280.AlgorithmIdentifier().subtype(
|
| 188 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 189 |
+
namedtype.OptionalNamedType('maskGenAlgorithm', rfc5280.AlgorithmIdentifier().subtype(
|
| 190 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 191 |
+
namedtype.DefaultedNamedType('saltLength', univ.Integer(value=20).subtype(
|
| 192 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 193 |
+
namedtype.DefaultedNamedType('trailerField', univ.Integer(value=1).subtype(
|
| 194 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
rSASSA_PSS_Default_Params = RSASSA_PSS_params()
|
| 198 |
+
|
| 199 |
+
rSASSA_PSS_Default_Identifier = rfc5280.AlgorithmIdentifier()
|
| 200 |
+
rSASSA_PSS_Default_Identifier['algorithm'] = id_RSASSA_PSS
|
| 201 |
+
rSASSA_PSS_Default_Identifier['parameters'] = rSASSA_PSS_Default_Params
|
| 202 |
+
|
| 203 |
+
rSASSA_PSS_SHA224_Params = RSASSA_PSS_params()
|
| 204 |
+
rSASSA_PSS_SHA224_Params['hashAlgorithm'] = sha224Identifier.subtype(
|
| 205 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 206 |
+
rSASSA_PSS_SHA224_Params['maskGenAlgorithm'] = mgf1SHA224Identifier.subtype(
|
| 207 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 208 |
+
|
| 209 |
+
rSASSA_PSS_SHA224_Identifier = rfc5280.AlgorithmIdentifier()
|
| 210 |
+
rSASSA_PSS_SHA224_Identifier['algorithm'] = id_RSASSA_PSS
|
| 211 |
+
rSASSA_PSS_SHA224_Identifier['parameters'] = rSASSA_PSS_SHA224_Params
|
| 212 |
+
|
| 213 |
+
rSASSA_PSS_SHA256_Params = RSASSA_PSS_params()
|
| 214 |
+
rSASSA_PSS_SHA256_Params['hashAlgorithm'] = sha256Identifier.subtype(
|
| 215 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 216 |
+
rSASSA_PSS_SHA256_Params['maskGenAlgorithm'] = mgf1SHA256Identifier.subtype(
|
| 217 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 218 |
+
|
| 219 |
+
rSASSA_PSS_SHA256_Identifier = rfc5280.AlgorithmIdentifier()
|
| 220 |
+
rSASSA_PSS_SHA256_Identifier['algorithm'] = id_RSASSA_PSS
|
| 221 |
+
rSASSA_PSS_SHA256_Identifier['parameters'] = rSASSA_PSS_SHA256_Params
|
| 222 |
+
|
| 223 |
+
rSASSA_PSS_SHA384_Params = RSASSA_PSS_params()
|
| 224 |
+
rSASSA_PSS_SHA384_Params['hashAlgorithm'] = sha384Identifier.subtype(
|
| 225 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 226 |
+
rSASSA_PSS_SHA384_Params['maskGenAlgorithm'] = mgf1SHA384Identifier.subtype(
|
| 227 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 228 |
+
|
| 229 |
+
rSASSA_PSS_SHA384_Identifier = rfc5280.AlgorithmIdentifier()
|
| 230 |
+
rSASSA_PSS_SHA384_Identifier['algorithm'] = id_RSASSA_PSS
|
| 231 |
+
rSASSA_PSS_SHA384_Identifier['parameters'] = rSASSA_PSS_SHA384_Params
|
| 232 |
+
|
| 233 |
+
rSASSA_PSS_SHA512_Params = RSASSA_PSS_params()
|
| 234 |
+
rSASSA_PSS_SHA512_Params['hashAlgorithm'] = sha512Identifier.subtype(
|
| 235 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
|
| 236 |
+
rSASSA_PSS_SHA512_Params['maskGenAlgorithm'] = mgf1SHA512Identifier.subtype(
|
| 237 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
|
| 238 |
+
|
| 239 |
+
rSASSA_PSS_SHA512_Identifier = rfc5280.AlgorithmIdentifier()
|
| 240 |
+
rSASSA_PSS_SHA512_Identifier['algorithm'] = id_RSASSA_PSS
|
| 241 |
+
rSASSA_PSS_SHA512_Identifier['parameters'] = rSASSA_PSS_SHA512_Params
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
# Update the Algorithm Identifier map
|
| 245 |
+
|
| 246 |
+
_algorithmIdentifierMapUpdate = {
|
| 247 |
+
id_sha1: univ.Null(),
|
| 248 |
+
id_sha224: univ.Null(),
|
| 249 |
+
id_sha256: univ.Null(),
|
| 250 |
+
id_sha384: univ.Null(),
|
| 251 |
+
id_sha512: univ.Null(),
|
| 252 |
+
id_mgf1: rfc5280.AlgorithmIdentifier(),
|
| 253 |
+
id_pSpecified: univ.OctetString(),
|
| 254 |
+
id_RSAES_OAEP: RSAES_OAEP_params(),
|
| 255 |
+
id_RSASSA_PSS: RSASSA_PSS_params(),
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4108.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 items from the verified errata.
|
| 6 |
+
# Modified by Russ Housley to add maps for use with opentypes.
|
| 7 |
+
#
|
| 8 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 9 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 10 |
+
#
|
| 11 |
+
# CMS Firmware Wrapper
|
| 12 |
+
#
|
| 13 |
+
# ASN.1 source from:
|
| 14 |
+
# https://www.rfc-editor.org/rfc/rfc4108.txt
|
| 15 |
+
# https://www.rfc-editor.org/errata_search.php?rfc=4108
|
| 16 |
+
#
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
|
| 20 |
+
|
| 21 |
+
from pyasn1_modules import rfc5280
|
| 22 |
+
from pyasn1_modules import rfc5652
|
| 23 |
+
|
| 24 |
+
MAX = float('inf')
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class HardwareSerialEntry(univ.Choice):
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
+
HardwareSerialEntry.componentType = namedtype.NamedTypes(
|
| 31 |
+
namedtype.NamedType('all', univ.Null()),
|
| 32 |
+
namedtype.NamedType('single', univ.OctetString()),
|
| 33 |
+
namedtype.NamedType('block', univ.Sequence(componentType=namedtype.NamedTypes(
|
| 34 |
+
namedtype.NamedType('low', univ.OctetString()),
|
| 35 |
+
namedtype.NamedType('high', univ.OctetString())
|
| 36 |
+
))
|
| 37 |
+
)
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class HardwareModules(univ.Sequence):
|
| 42 |
+
pass
|
| 43 |
+
|
| 44 |
+
HardwareModules.componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.NamedType('hwType', univ.ObjectIdentifier()),
|
| 46 |
+
namedtype.NamedType('hwSerialEntries', univ.SequenceOf(componentType=HardwareSerialEntry()))
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class CommunityIdentifier(univ.Choice):
|
| 51 |
+
pass
|
| 52 |
+
|
| 53 |
+
CommunityIdentifier.componentType = namedtype.NamedTypes(
|
| 54 |
+
namedtype.NamedType('communityOID', univ.ObjectIdentifier()),
|
| 55 |
+
namedtype.NamedType('hwModuleList', HardwareModules())
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class PreferredPackageIdentifier(univ.Sequence):
|
| 61 |
+
pass
|
| 62 |
+
|
| 63 |
+
PreferredPackageIdentifier.componentType = namedtype.NamedTypes(
|
| 64 |
+
namedtype.NamedType('fwPkgID', univ.ObjectIdentifier()),
|
| 65 |
+
namedtype.NamedType('verNum', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class PreferredOrLegacyPackageIdentifier(univ.Choice):
|
| 70 |
+
pass
|
| 71 |
+
|
| 72 |
+
PreferredOrLegacyPackageIdentifier.componentType = namedtype.NamedTypes(
|
| 73 |
+
namedtype.NamedType('preferred', PreferredPackageIdentifier()),
|
| 74 |
+
namedtype.NamedType('legacy', univ.OctetString())
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class CurrentFWConfig(univ.Sequence):
|
| 79 |
+
pass
|
| 80 |
+
|
| 81 |
+
CurrentFWConfig.componentType = namedtype.NamedTypes(
|
| 82 |
+
namedtype.OptionalNamedType('fwPkgType', univ.Integer()),
|
| 83 |
+
namedtype.NamedType('fwPkgName', PreferredOrLegacyPackageIdentifier())
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class PreferredOrLegacyStalePackageIdentifier(univ.Choice):
|
| 88 |
+
pass
|
| 89 |
+
|
| 90 |
+
PreferredOrLegacyStalePackageIdentifier.componentType = namedtype.NamedTypes(
|
| 91 |
+
namedtype.NamedType('preferredStaleVerNum', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
|
| 92 |
+
namedtype.NamedType('legacyStaleVersion', univ.OctetString())
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
class FirmwarePackageLoadErrorCode(univ.Enumerated):
|
| 97 |
+
pass
|
| 98 |
+
|
| 99 |
+
FirmwarePackageLoadErrorCode.namedValues = namedval.NamedValues(
|
| 100 |
+
('decodeFailure', 1),
|
| 101 |
+
('badContentInfo', 2),
|
| 102 |
+
('badSignedData', 3),
|
| 103 |
+
('badEncapContent', 4),
|
| 104 |
+
('badCertificate', 5),
|
| 105 |
+
('badSignerInfo', 6),
|
| 106 |
+
('badSignedAttrs', 7),
|
| 107 |
+
('badUnsignedAttrs', 8),
|
| 108 |
+
('missingContent', 9),
|
| 109 |
+
('noTrustAnchor', 10),
|
| 110 |
+
('notAuthorized', 11),
|
| 111 |
+
('badDigestAlgorithm', 12),
|
| 112 |
+
('badSignatureAlgorithm', 13),
|
| 113 |
+
('unsupportedKeySize', 14),
|
| 114 |
+
('signatureFailure', 15),
|
| 115 |
+
('contentTypeMismatch', 16),
|
| 116 |
+
('badEncryptedData', 17),
|
| 117 |
+
('unprotectedAttrsPresent', 18),
|
| 118 |
+
('badEncryptContent', 19),
|
| 119 |
+
('badEncryptAlgorithm', 20),
|
| 120 |
+
('missingCiphertext', 21),
|
| 121 |
+
('noDecryptKey', 22),
|
| 122 |
+
('decryptFailure', 23),
|
| 123 |
+
('badCompressAlgorithm', 24),
|
| 124 |
+
('missingCompressedContent', 25),
|
| 125 |
+
('decompressFailure', 26),
|
| 126 |
+
('wrongHardware', 27),
|
| 127 |
+
('stalePackage', 28),
|
| 128 |
+
('notInCommunity', 29),
|
| 129 |
+
('unsupportedPackageType', 30),
|
| 130 |
+
('missingDependency', 31),
|
| 131 |
+
('wrongDependencyVersion', 32),
|
| 132 |
+
('insufficientMemory', 33),
|
| 133 |
+
('badFirmware', 34),
|
| 134 |
+
('unsupportedParameters', 35),
|
| 135 |
+
('breaksDependency', 36),
|
| 136 |
+
('otherError', 99)
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
class VendorLoadErrorCode(univ.Integer):
|
| 141 |
+
pass
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
# Wrapped Firmware Key Unsigned Attribute and Object Identifier
|
| 145 |
+
|
| 146 |
+
id_aa_wrappedFirmwareKey = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.39')
|
| 147 |
+
|
| 148 |
+
class WrappedFirmwareKey(rfc5652.EnvelopedData):
|
| 149 |
+
pass
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
# Firmware Package Information Signed Attribute and Object Identifier
|
| 153 |
+
|
| 154 |
+
id_aa_firmwarePackageInfo = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.42')
|
| 155 |
+
|
| 156 |
+
class FirmwarePackageInfo(univ.Sequence):
|
| 157 |
+
pass
|
| 158 |
+
|
| 159 |
+
FirmwarePackageInfo.componentType = namedtype.NamedTypes(
|
| 160 |
+
namedtype.OptionalNamedType('fwPkgType', univ.Integer()),
|
| 161 |
+
namedtype.OptionalNamedType('dependencies', univ.SequenceOf(componentType=PreferredOrLegacyPackageIdentifier()))
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
FirmwarePackageInfo.sizeSpec = univ.Sequence.sizeSpec + constraint.ValueSizeConstraint(1, 2)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
# Community Identifiers Signed Attribute and Object Identifier
|
| 168 |
+
|
| 169 |
+
id_aa_communityIdentifiers = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.40')
|
| 170 |
+
|
| 171 |
+
class CommunityIdentifiers(univ.SequenceOf):
|
| 172 |
+
pass
|
| 173 |
+
|
| 174 |
+
CommunityIdentifiers.componentType = CommunityIdentifier()
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
# Implemented Compression Algorithms Signed Attribute and Object Identifier
|
| 178 |
+
|
| 179 |
+
id_aa_implCompressAlgs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.43')
|
| 180 |
+
|
| 181 |
+
class ImplementedCompressAlgorithms(univ.SequenceOf):
|
| 182 |
+
pass
|
| 183 |
+
|
| 184 |
+
ImplementedCompressAlgorithms.componentType = univ.ObjectIdentifier()
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
# Implemented Cryptographic Algorithms Signed Attribute and Object Identifier
|
| 188 |
+
|
| 189 |
+
id_aa_implCryptoAlgs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.38')
|
| 190 |
+
|
| 191 |
+
class ImplementedCryptoAlgorithms(univ.SequenceOf):
|
| 192 |
+
pass
|
| 193 |
+
|
| 194 |
+
ImplementedCryptoAlgorithms.componentType = univ.ObjectIdentifier()
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
# Decrypt Key Identifier Signed Attribute and Object Identifier
|
| 198 |
+
|
| 199 |
+
id_aa_decryptKeyID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.37')
|
| 200 |
+
|
| 201 |
+
class DecryptKeyIdentifier(univ.OctetString):
|
| 202 |
+
pass
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
# Target Hardware Identifier Signed Attribute and Object Identifier
|
| 206 |
+
|
| 207 |
+
id_aa_targetHardwareIDs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.36')
|
| 208 |
+
|
| 209 |
+
class TargetHardwareIdentifiers(univ.SequenceOf):
|
| 210 |
+
pass
|
| 211 |
+
|
| 212 |
+
TargetHardwareIdentifiers.componentType = univ.ObjectIdentifier()
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
# Firmware Package Identifier Signed Attribute and Object Identifier
|
| 216 |
+
|
| 217 |
+
id_aa_firmwarePackageID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.35')
|
| 218 |
+
|
| 219 |
+
class FirmwarePackageIdentifier(univ.Sequence):
|
| 220 |
+
pass
|
| 221 |
+
|
| 222 |
+
FirmwarePackageIdentifier.componentType = namedtype.NamedTypes(
|
| 223 |
+
namedtype.NamedType('name', PreferredOrLegacyPackageIdentifier()),
|
| 224 |
+
namedtype.OptionalNamedType('stale', PreferredOrLegacyStalePackageIdentifier())
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
# Firmware Package Message Digest Signed Attribute and Object Identifier
|
| 229 |
+
|
| 230 |
+
id_aa_fwPkgMessageDigest = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.41')
|
| 231 |
+
|
| 232 |
+
class FirmwarePackageMessageDigest(univ.Sequence):
|
| 233 |
+
pass
|
| 234 |
+
|
| 235 |
+
FirmwarePackageMessageDigest.componentType = namedtype.NamedTypes(
|
| 236 |
+
namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()),
|
| 237 |
+
namedtype.NamedType('msgDigest', univ.OctetString())
|
| 238 |
+
)
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
# Firmware Package Load Error Report Content Type and Object Identifier
|
| 242 |
+
|
| 243 |
+
class FWErrorVersion(univ.Integer):
|
| 244 |
+
pass
|
| 245 |
+
|
| 246 |
+
FWErrorVersion.namedValues = namedval.NamedValues(
|
| 247 |
+
('v1', 1)
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
id_ct_firmwareLoadError = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.18')
|
| 252 |
+
|
| 253 |
+
class FirmwarePackageLoadError(univ.Sequence):
|
| 254 |
+
pass
|
| 255 |
+
|
| 256 |
+
FirmwarePackageLoadError.componentType = namedtype.NamedTypes(
|
| 257 |
+
namedtype.DefaultedNamedType('version', FWErrorVersion().subtype(value='v1')),
|
| 258 |
+
namedtype.NamedType('hwType', univ.ObjectIdentifier()),
|
| 259 |
+
namedtype.NamedType('hwSerialNum', univ.OctetString()),
|
| 260 |
+
namedtype.NamedType('errorCode', FirmwarePackageLoadErrorCode()),
|
| 261 |
+
namedtype.OptionalNamedType('vendorErrorCode', VendorLoadErrorCode()),
|
| 262 |
+
namedtype.OptionalNamedType('fwPkgName', PreferredOrLegacyPackageIdentifier()),
|
| 263 |
+
namedtype.OptionalNamedType('config', univ.SequenceOf(componentType=CurrentFWConfig()).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 264 |
+
)
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# Firmware Package Load Receipt Content Type and Object Identifier
|
| 268 |
+
|
| 269 |
+
class FWReceiptVersion(univ.Integer):
|
| 270 |
+
pass
|
| 271 |
+
|
| 272 |
+
FWReceiptVersion.namedValues = namedval.NamedValues(
|
| 273 |
+
('v1', 1)
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
id_ct_firmwareLoadReceipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.17')
|
| 278 |
+
|
| 279 |
+
class FirmwarePackageLoadReceipt(univ.Sequence):
|
| 280 |
+
pass
|
| 281 |
+
|
| 282 |
+
FirmwarePackageLoadReceipt.componentType = namedtype.NamedTypes(
|
| 283 |
+
namedtype.DefaultedNamedType('version', FWReceiptVersion().subtype(value='v1')),
|
| 284 |
+
namedtype.NamedType('hwType', univ.ObjectIdentifier()),
|
| 285 |
+
namedtype.NamedType('hwSerialNum', univ.OctetString()),
|
| 286 |
+
namedtype.NamedType('fwPkgName', PreferredOrLegacyPackageIdentifier()),
|
| 287 |
+
namedtype.OptionalNamedType('trustAnchorKeyID', univ.OctetString()),
|
| 288 |
+
namedtype.OptionalNamedType('decryptKeyID', univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
# Firmware Package Content Type and Object Identifier
|
| 293 |
+
|
| 294 |
+
id_ct_firmwarePackage = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.16')
|
| 295 |
+
|
| 296 |
+
class FirmwarePkgData(univ.OctetString):
|
| 297 |
+
pass
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
# Other Name syntax for Hardware Module Name
|
| 301 |
+
|
| 302 |
+
id_on_hardwareModuleName = univ.ObjectIdentifier('1.3.6.1.5.5.7.8.4')
|
| 303 |
+
|
| 304 |
+
class HardwareModuleName(univ.Sequence):
|
| 305 |
+
pass
|
| 306 |
+
|
| 307 |
+
HardwareModuleName.componentType = namedtype.NamedTypes(
|
| 308 |
+
namedtype.NamedType('hwType', univ.ObjectIdentifier()),
|
| 309 |
+
namedtype.NamedType('hwSerialNum', univ.OctetString())
|
| 310 |
+
)
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
# Map of Attribute Type OIDs to Attributes is added to the
|
| 314 |
+
# ones that are in rfc5652.py
|
| 315 |
+
|
| 316 |
+
_cmsAttributesMapUpdate = {
|
| 317 |
+
id_aa_wrappedFirmwareKey: WrappedFirmwareKey(),
|
| 318 |
+
id_aa_firmwarePackageInfo: FirmwarePackageInfo(),
|
| 319 |
+
id_aa_communityIdentifiers: CommunityIdentifiers(),
|
| 320 |
+
id_aa_implCompressAlgs: ImplementedCompressAlgorithms(),
|
| 321 |
+
id_aa_implCryptoAlgs: ImplementedCryptoAlgorithms(),
|
| 322 |
+
id_aa_decryptKeyID: DecryptKeyIdentifier(),
|
| 323 |
+
id_aa_targetHardwareIDs: TargetHardwareIdentifiers(),
|
| 324 |
+
id_aa_firmwarePackageID: FirmwarePackageIdentifier(),
|
| 325 |
+
id_aa_fwPkgMessageDigest: FirmwarePackageMessageDigest(),
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
# Map of Content Type OIDs to Content Types is added to the
|
| 332 |
+
# ones that are in rfc5652.py
|
| 333 |
+
|
| 334 |
+
_cmsContentTypesMapUpdate = {
|
| 335 |
+
id_ct_firmwareLoadError: FirmwarePackageLoadError(),
|
| 336 |
+
id_ct_firmwareLoadReceipt: FirmwarePackageLoadReceipt(),
|
| 337 |
+
id_ct_firmwarePackage: FirmwarePkgData(),
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
# Map of Other Name OIDs to Other Name is added to the
|
| 344 |
+
# ones that are in rfc5280.py
|
| 345 |
+
|
| 346 |
+
_anotherNameMapUpdate = {
|
| 347 |
+
id_on_hardwareModuleName: HardwareModuleName(),
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4210.py
ADDED
|
@@ -0,0 +1,803 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Certificate Management Protocol structures as per RFC4210
|
| 8 |
+
#
|
| 9 |
+
# Based on Alex Railean's work
|
| 10 |
+
#
|
| 11 |
+
from pyasn1.type import char
|
| 12 |
+
from pyasn1.type import constraint
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import namedval
|
| 15 |
+
from pyasn1.type import tag
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
from pyasn1.type import useful
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc2314
|
| 20 |
+
from pyasn1_modules import rfc2459
|
| 21 |
+
from pyasn1_modules import rfc2511
|
| 22 |
+
|
| 23 |
+
MAX = float('inf')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class KeyIdentifier(univ.OctetString):
|
| 27 |
+
pass
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class CMPCertificate(rfc2459.Certificate):
|
| 31 |
+
pass
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class OOBCert(CMPCertificate):
|
| 35 |
+
pass
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class CertAnnContent(CMPCertificate):
|
| 39 |
+
pass
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class PKIFreeText(univ.SequenceOf):
|
| 43 |
+
"""
|
| 44 |
+
PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
|
| 45 |
+
"""
|
| 46 |
+
componentType = char.UTF8String()
|
| 47 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class PollRepContent(univ.SequenceOf):
|
| 51 |
+
"""
|
| 52 |
+
PollRepContent ::= SEQUENCE OF SEQUENCE {
|
| 53 |
+
certReqId INTEGER,
|
| 54 |
+
checkAfter INTEGER, -- time in seconds
|
| 55 |
+
reason PKIFreeText OPTIONAL
|
| 56 |
+
}
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
class CertReq(univ.Sequence):
|
| 60 |
+
componentType = namedtype.NamedTypes(
|
| 61 |
+
namedtype.NamedType('certReqId', univ.Integer()),
|
| 62 |
+
namedtype.NamedType('checkAfter', univ.Integer()),
|
| 63 |
+
namedtype.OptionalNamedType('reason', PKIFreeText())
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
componentType = CertReq()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class PollReqContent(univ.SequenceOf):
|
| 70 |
+
"""
|
| 71 |
+
PollReqContent ::= SEQUENCE OF SEQUENCE {
|
| 72 |
+
certReqId INTEGER
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
class CertReq(univ.Sequence):
|
| 78 |
+
componentType = namedtype.NamedTypes(
|
| 79 |
+
namedtype.NamedType('certReqId', univ.Integer())
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
componentType = CertReq()
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class InfoTypeAndValue(univ.Sequence):
|
| 86 |
+
"""
|
| 87 |
+
InfoTypeAndValue ::= SEQUENCE {
|
| 88 |
+
infoType OBJECT IDENTIFIER,
|
| 89 |
+
infoValue ANY DEFINED BY infoType OPTIONAL
|
| 90 |
+
}"""
|
| 91 |
+
componentType = namedtype.NamedTypes(
|
| 92 |
+
namedtype.NamedType('infoType', univ.ObjectIdentifier()),
|
| 93 |
+
namedtype.OptionalNamedType('infoValue', univ.Any())
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class GenRepContent(univ.SequenceOf):
|
| 98 |
+
componentType = InfoTypeAndValue()
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class GenMsgContent(univ.SequenceOf):
|
| 102 |
+
componentType = InfoTypeAndValue()
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class PKIConfirmContent(univ.Null):
|
| 106 |
+
pass
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class CRLAnnContent(univ.SequenceOf):
|
| 110 |
+
componentType = rfc2459.CertificateList()
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class CAKeyUpdAnnContent(univ.Sequence):
|
| 114 |
+
"""
|
| 115 |
+
CAKeyUpdAnnContent ::= SEQUENCE {
|
| 116 |
+
oldWithNew CMPCertificate,
|
| 117 |
+
newWithOld CMPCertificate,
|
| 118 |
+
newWithNew CMPCertificate
|
| 119 |
+
}
|
| 120 |
+
"""
|
| 121 |
+
componentType = namedtype.NamedTypes(
|
| 122 |
+
namedtype.NamedType('oldWithNew', CMPCertificate()),
|
| 123 |
+
namedtype.NamedType('newWithOld', CMPCertificate()),
|
| 124 |
+
namedtype.NamedType('newWithNew', CMPCertificate())
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
class RevDetails(univ.Sequence):
|
| 129 |
+
"""
|
| 130 |
+
RevDetails ::= SEQUENCE {
|
| 131 |
+
certDetails CertTemplate,
|
| 132 |
+
crlEntryDetails Extensions OPTIONAL
|
| 133 |
+
}
|
| 134 |
+
"""
|
| 135 |
+
componentType = namedtype.NamedTypes(
|
| 136 |
+
namedtype.NamedType('certDetails', rfc2511.CertTemplate()),
|
| 137 |
+
namedtype.OptionalNamedType('crlEntryDetails', rfc2459.Extensions())
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class RevReqContent(univ.SequenceOf):
|
| 142 |
+
componentType = RevDetails()
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
class CertOrEncCert(univ.Choice):
|
| 146 |
+
"""
|
| 147 |
+
CertOrEncCert ::= CHOICE {
|
| 148 |
+
certificate [0] CMPCertificate,
|
| 149 |
+
encryptedCert [1] EncryptedValue
|
| 150 |
+
}
|
| 151 |
+
"""
|
| 152 |
+
componentType = namedtype.NamedTypes(
|
| 153 |
+
namedtype.NamedType('certificate', CMPCertificate().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 154 |
+
namedtype.NamedType('encryptedCert', rfc2511.EncryptedValue().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class CertifiedKeyPair(univ.Sequence):
|
| 159 |
+
"""
|
| 160 |
+
CertifiedKeyPair ::= SEQUENCE {
|
| 161 |
+
certOrEncCert CertOrEncCert,
|
| 162 |
+
privateKey [0] EncryptedValue OPTIONAL,
|
| 163 |
+
publicationInfo [1] PKIPublicationInfo OPTIONAL
|
| 164 |
+
}
|
| 165 |
+
"""
|
| 166 |
+
componentType = namedtype.NamedTypes(
|
| 167 |
+
namedtype.NamedType('certOrEncCert', CertOrEncCert()),
|
| 168 |
+
namedtype.OptionalNamedType('privateKey', rfc2511.EncryptedValue().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 169 |
+
namedtype.OptionalNamedType('publicationInfo', rfc2511.PKIPublicationInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class POPODecKeyRespContent(univ.SequenceOf):
|
| 174 |
+
componentType = univ.Integer()
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
class Challenge(univ.Sequence):
|
| 178 |
+
"""
|
| 179 |
+
Challenge ::= SEQUENCE {
|
| 180 |
+
owf AlgorithmIdentifier OPTIONAL,
|
| 181 |
+
witness OCTET STRING,
|
| 182 |
+
challenge OCTET STRING
|
| 183 |
+
}
|
| 184 |
+
"""
|
| 185 |
+
componentType = namedtype.NamedTypes(
|
| 186 |
+
namedtype.OptionalNamedType('owf', rfc2459.AlgorithmIdentifier()),
|
| 187 |
+
namedtype.NamedType('witness', univ.OctetString()),
|
| 188 |
+
namedtype.NamedType('challenge', univ.OctetString())
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class PKIStatus(univ.Integer):
|
| 193 |
+
"""
|
| 194 |
+
PKIStatus ::= INTEGER {
|
| 195 |
+
accepted (0),
|
| 196 |
+
grantedWithMods (1),
|
| 197 |
+
rejection (2),
|
| 198 |
+
waiting (3),
|
| 199 |
+
revocationWarning (4),
|
| 200 |
+
revocationNotification (5),
|
| 201 |
+
keyUpdateWarning (6)
|
| 202 |
+
}
|
| 203 |
+
"""
|
| 204 |
+
namedValues = namedval.NamedValues(
|
| 205 |
+
('accepted', 0),
|
| 206 |
+
('grantedWithMods', 1),
|
| 207 |
+
('rejection', 2),
|
| 208 |
+
('waiting', 3),
|
| 209 |
+
('revocationWarning', 4),
|
| 210 |
+
('revocationNotification', 5),
|
| 211 |
+
('keyUpdateWarning', 6)
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class PKIFailureInfo(univ.BitString):
|
| 216 |
+
"""
|
| 217 |
+
PKIFailureInfo ::= BIT STRING {
|
| 218 |
+
badAlg (0),
|
| 219 |
+
badMessageCheck (1),
|
| 220 |
+
badRequest (2),
|
| 221 |
+
badTime (3),
|
| 222 |
+
badCertId (4),
|
| 223 |
+
badDataFormat (5),
|
| 224 |
+
wrongAuthority (6),
|
| 225 |
+
incorrectData (7),
|
| 226 |
+
missingTimeStamp (8),
|
| 227 |
+
badPOP (9),
|
| 228 |
+
certRevoked (10),
|
| 229 |
+
certConfirmed (11),
|
| 230 |
+
wrongIntegrity (12),
|
| 231 |
+
badRecipientNonce (13),
|
| 232 |
+
timeNotAvailable (14),
|
| 233 |
+
unacceptedPolicy (15),
|
| 234 |
+
unacceptedExtension (16),
|
| 235 |
+
addInfoNotAvailable (17),
|
| 236 |
+
badSenderNonce (18),
|
| 237 |
+
badCertTemplate (19),
|
| 238 |
+
signerNotTrusted (20),
|
| 239 |
+
transactionIdInUse (21),
|
| 240 |
+
unsupportedVersion (22),
|
| 241 |
+
notAuthorized (23),
|
| 242 |
+
systemUnavail (24),
|
| 243 |
+
systemFailure (25),
|
| 244 |
+
duplicateCertReq (26)
|
| 245 |
+
"""
|
| 246 |
+
namedValues = namedval.NamedValues(
|
| 247 |
+
('badAlg', 0),
|
| 248 |
+
('badMessageCheck', 1),
|
| 249 |
+
('badRequest', 2),
|
| 250 |
+
('badTime', 3),
|
| 251 |
+
('badCertId', 4),
|
| 252 |
+
('badDataFormat', 5),
|
| 253 |
+
('wrongAuthority', 6),
|
| 254 |
+
('incorrectData', 7),
|
| 255 |
+
('missingTimeStamp', 8),
|
| 256 |
+
('badPOP', 9),
|
| 257 |
+
('certRevoked', 10),
|
| 258 |
+
('certConfirmed', 11),
|
| 259 |
+
('wrongIntegrity', 12),
|
| 260 |
+
('badRecipientNonce', 13),
|
| 261 |
+
('timeNotAvailable', 14),
|
| 262 |
+
('unacceptedPolicy', 15),
|
| 263 |
+
('unacceptedExtension', 16),
|
| 264 |
+
('addInfoNotAvailable', 17),
|
| 265 |
+
('badSenderNonce', 18),
|
| 266 |
+
('badCertTemplate', 19),
|
| 267 |
+
('signerNotTrusted', 20),
|
| 268 |
+
('transactionIdInUse', 21),
|
| 269 |
+
('unsupportedVersion', 22),
|
| 270 |
+
('notAuthorized', 23),
|
| 271 |
+
('systemUnavail', 24),
|
| 272 |
+
('systemFailure', 25),
|
| 273 |
+
('duplicateCertReq', 26)
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class PKIStatusInfo(univ.Sequence):
|
| 278 |
+
"""
|
| 279 |
+
PKIStatusInfo ::= SEQUENCE {
|
| 280 |
+
status PKIStatus,
|
| 281 |
+
statusString PKIFreeText OPTIONAL,
|
| 282 |
+
failInfo PKIFailureInfo OPTIONAL
|
| 283 |
+
}
|
| 284 |
+
"""
|
| 285 |
+
componentType = namedtype.NamedTypes(
|
| 286 |
+
namedtype.NamedType('status', PKIStatus()),
|
| 287 |
+
namedtype.OptionalNamedType('statusString', PKIFreeText()),
|
| 288 |
+
namedtype.OptionalNamedType('failInfo', PKIFailureInfo())
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
class ErrorMsgContent(univ.Sequence):
|
| 293 |
+
"""
|
| 294 |
+
ErrorMsgContent ::= SEQUENCE {
|
| 295 |
+
pKIStatusInfo PKIStatusInfo,
|
| 296 |
+
errorCode INTEGER OPTIONAL,
|
| 297 |
+
-- implementation-specific error codes
|
| 298 |
+
errorDetails PKIFreeText OPTIONAL
|
| 299 |
+
-- implementation-specific error details
|
| 300 |
+
}
|
| 301 |
+
"""
|
| 302 |
+
componentType = namedtype.NamedTypes(
|
| 303 |
+
namedtype.NamedType('pKIStatusInfo', PKIStatusInfo()),
|
| 304 |
+
namedtype.OptionalNamedType('errorCode', univ.Integer()),
|
| 305 |
+
namedtype.OptionalNamedType('errorDetails', PKIFreeText())
|
| 306 |
+
)
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
class CertStatus(univ.Sequence):
|
| 310 |
+
"""
|
| 311 |
+
CertStatus ::= SEQUENCE {
|
| 312 |
+
certHash OCTET STRING,
|
| 313 |
+
certReqId INTEGER,
|
| 314 |
+
statusInfo PKIStatusInfo OPTIONAL
|
| 315 |
+
}
|
| 316 |
+
"""
|
| 317 |
+
componentType = namedtype.NamedTypes(
|
| 318 |
+
namedtype.NamedType('certHash', univ.OctetString()),
|
| 319 |
+
namedtype.NamedType('certReqId', univ.Integer()),
|
| 320 |
+
namedtype.OptionalNamedType('statusInfo', PKIStatusInfo())
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
class CertConfirmContent(univ.SequenceOf):
|
| 325 |
+
componentType = CertStatus()
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
class RevAnnContent(univ.Sequence):
|
| 329 |
+
"""
|
| 330 |
+
RevAnnContent ::= SEQUENCE {
|
| 331 |
+
status PKIStatus,
|
| 332 |
+
certId CertId,
|
| 333 |
+
willBeRevokedAt GeneralizedTime,
|
| 334 |
+
badSinceDate GeneralizedTime,
|
| 335 |
+
crlDetails Extensions OPTIONAL
|
| 336 |
+
}
|
| 337 |
+
"""
|
| 338 |
+
componentType = namedtype.NamedTypes(
|
| 339 |
+
namedtype.NamedType('status', PKIStatus()),
|
| 340 |
+
namedtype.NamedType('certId', rfc2511.CertId()),
|
| 341 |
+
namedtype.NamedType('willBeRevokedAt', useful.GeneralizedTime()),
|
| 342 |
+
namedtype.NamedType('badSinceDate', useful.GeneralizedTime()),
|
| 343 |
+
namedtype.OptionalNamedType('crlDetails', rfc2459.Extensions())
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
class RevRepContent(univ.Sequence):
|
| 348 |
+
"""
|
| 349 |
+
RevRepContent ::= SEQUENCE {
|
| 350 |
+
status SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
|
| 351 |
+
revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId
|
| 352 |
+
OPTIONAL,
|
| 353 |
+
crls [1] SEQUENCE SIZE (1..MAX) OF CertificateList
|
| 354 |
+
OPTIONAL
|
| 355 |
+
"""
|
| 356 |
+
componentType = namedtype.NamedTypes(
|
| 357 |
+
namedtype.NamedType(
|
| 358 |
+
'status', univ.SequenceOf(
|
| 359 |
+
componentType=PKIStatusInfo(),
|
| 360 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 361 |
+
)
|
| 362 |
+
),
|
| 363 |
+
namedtype.OptionalNamedType(
|
| 364 |
+
'revCerts', univ.SequenceOf(componentType=rfc2511.CertId()).subtype(
|
| 365 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
| 366 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
| 367 |
+
)
|
| 368 |
+
),
|
| 369 |
+
namedtype.OptionalNamedType(
|
| 370 |
+
'crls', univ.SequenceOf(componentType=rfc2459.CertificateList()).subtype(
|
| 371 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
| 372 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
| 373 |
+
)
|
| 374 |
+
)
|
| 375 |
+
)
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
class KeyRecRepContent(univ.Sequence):
|
| 379 |
+
"""
|
| 380 |
+
KeyRecRepContent ::= SEQUENCE {
|
| 381 |
+
status PKIStatusInfo,
|
| 382 |
+
newSigCert [0] CMPCertificate OPTIONAL,
|
| 383 |
+
caCerts [1] SEQUENCE SIZE (1..MAX) OF
|
| 384 |
+
CMPCertificate OPTIONAL,
|
| 385 |
+
keyPairHist [2] SEQUENCE SIZE (1..MAX) OF
|
| 386 |
+
CertifiedKeyPair OPTIONAL
|
| 387 |
+
}
|
| 388 |
+
"""
|
| 389 |
+
componentType = namedtype.NamedTypes(
|
| 390 |
+
namedtype.NamedType('status', PKIStatusInfo()),
|
| 391 |
+
namedtype.OptionalNamedType(
|
| 392 |
+
'newSigCert', CMPCertificate().subtype(
|
| 393 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
| 394 |
+
)
|
| 395 |
+
),
|
| 396 |
+
namedtype.OptionalNamedType(
|
| 397 |
+
'caCerts', univ.SequenceOf(componentType=CMPCertificate()).subtype(
|
| 398 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1),
|
| 399 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 400 |
+
)
|
| 401 |
+
),
|
| 402 |
+
namedtype.OptionalNamedType('keyPairHist', univ.SequenceOf(componentType=CertifiedKeyPair()).subtype(
|
| 403 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2),
|
| 404 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX))
|
| 405 |
+
)
|
| 406 |
+
)
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
class CertResponse(univ.Sequence):
|
| 410 |
+
"""
|
| 411 |
+
CertResponse ::= SEQUENCE {
|
| 412 |
+
certReqId INTEGER,
|
| 413 |
+
status PKIStatusInfo,
|
| 414 |
+
certifiedKeyPair CertifiedKeyPair OPTIONAL,
|
| 415 |
+
rspInfo OCTET STRING OPTIONAL
|
| 416 |
+
}
|
| 417 |
+
"""
|
| 418 |
+
componentType = namedtype.NamedTypes(
|
| 419 |
+
namedtype.NamedType('certReqId', univ.Integer()),
|
| 420 |
+
namedtype.NamedType('status', PKIStatusInfo()),
|
| 421 |
+
namedtype.OptionalNamedType('certifiedKeyPair', CertifiedKeyPair()),
|
| 422 |
+
namedtype.OptionalNamedType('rspInfo', univ.OctetString())
|
| 423 |
+
)
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
class CertRepMessage(univ.Sequence):
|
| 427 |
+
"""
|
| 428 |
+
CertRepMessage ::= SEQUENCE {
|
| 429 |
+
caPubs [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
|
| 430 |
+
OPTIONAL,
|
| 431 |
+
response SEQUENCE OF CertResponse
|
| 432 |
+
}
|
| 433 |
+
"""
|
| 434 |
+
componentType = namedtype.NamedTypes(
|
| 435 |
+
namedtype.OptionalNamedType(
|
| 436 |
+
'caPubs', univ.SequenceOf(
|
| 437 |
+
componentType=CMPCertificate()
|
| 438 |
+
).subtype(sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
| 439 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))
|
| 440 |
+
),
|
| 441 |
+
namedtype.NamedType('response', univ.SequenceOf(componentType=CertResponse()))
|
| 442 |
+
)
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
class POPODecKeyChallContent(univ.SequenceOf):
|
| 446 |
+
componentType = Challenge()
|
| 447 |
+
|
| 448 |
+
|
| 449 |
+
class OOBCertHash(univ.Sequence):
|
| 450 |
+
"""
|
| 451 |
+
OOBCertHash ::= SEQUENCE {
|
| 452 |
+
hashAlg [0] AlgorithmIdentifier OPTIONAL,
|
| 453 |
+
certId [1] CertId OPTIONAL,
|
| 454 |
+
hashVal BIT STRING
|
| 455 |
+
}
|
| 456 |
+
"""
|
| 457 |
+
componentType = namedtype.NamedTypes(
|
| 458 |
+
namedtype.OptionalNamedType(
|
| 459 |
+
'hashAlg', rfc2459.AlgorithmIdentifier().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))
|
| 460 |
+
),
|
| 461 |
+
namedtype.OptionalNamedType(
|
| 462 |
+
'certId', rfc2511.CertId().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))
|
| 463 |
+
),
|
| 464 |
+
namedtype.NamedType('hashVal', univ.BitString())
|
| 465 |
+
)
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
| 469 |
+
# NestedMessageContent ::= PKIMessages
|
| 470 |
+
class NestedMessageContent(univ.SequenceOf):
|
| 471 |
+
"""
|
| 472 |
+
NestedMessageContent ::= PKIMessages
|
| 473 |
+
"""
|
| 474 |
+
componentType = univ.Any()
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
class DHBMParameter(univ.Sequence):
|
| 478 |
+
"""
|
| 479 |
+
DHBMParameter ::= SEQUENCE {
|
| 480 |
+
owf AlgorithmIdentifier,
|
| 481 |
+
-- AlgId for a One-Way Function (SHA-1 recommended)
|
| 482 |
+
mac AlgorithmIdentifier
|
| 483 |
+
-- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
|
| 484 |
+
} -- or HMAC [RFC2104, RFC2202])
|
| 485 |
+
"""
|
| 486 |
+
componentType = namedtype.NamedTypes(
|
| 487 |
+
namedtype.NamedType('owf', rfc2459.AlgorithmIdentifier()),
|
| 488 |
+
namedtype.NamedType('mac', rfc2459.AlgorithmIdentifier())
|
| 489 |
+
)
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
id_DHBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.30')
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
class PBMParameter(univ.Sequence):
|
| 496 |
+
"""
|
| 497 |
+
PBMParameter ::= SEQUENCE {
|
| 498 |
+
salt OCTET STRING,
|
| 499 |
+
owf AlgorithmIdentifier,
|
| 500 |
+
iterationCount INTEGER,
|
| 501 |
+
mac AlgorithmIdentifier
|
| 502 |
+
}
|
| 503 |
+
"""
|
| 504 |
+
componentType = namedtype.NamedTypes(
|
| 505 |
+
namedtype.NamedType(
|
| 506 |
+
'salt', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(0, 128))
|
| 507 |
+
),
|
| 508 |
+
namedtype.NamedType('owf', rfc2459.AlgorithmIdentifier()),
|
| 509 |
+
namedtype.NamedType('iterationCount', univ.Integer()),
|
| 510 |
+
namedtype.NamedType('mac', rfc2459.AlgorithmIdentifier())
|
| 511 |
+
)
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
id_PasswordBasedMac = univ.ObjectIdentifier('1.2.840.113533.7.66.13')
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
class PKIProtection(univ.BitString):
|
| 518 |
+
pass
|
| 519 |
+
|
| 520 |
+
|
| 521 |
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
| 522 |
+
# NestedMessageContent ::= PKIMessages
|
| 523 |
+
nestedMessageContent = NestedMessageContent().subtype(
|
| 524 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 20))
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
class PKIBody(univ.Choice):
|
| 528 |
+
"""
|
| 529 |
+
PKIBody ::= CHOICE { -- message-specific body elements
|
| 530 |
+
ir [0] CertReqMessages, --Initialization Request
|
| 531 |
+
ip [1] CertRepMessage, --Initialization Response
|
| 532 |
+
cr [2] CertReqMessages, --Certification Request
|
| 533 |
+
cp [3] CertRepMessage, --Certification Response
|
| 534 |
+
p10cr [4] CertificationRequest, --imported from [PKCS10]
|
| 535 |
+
popdecc [5] POPODecKeyChallContent, --pop Challenge
|
| 536 |
+
popdecr [6] POPODecKeyRespContent, --pop Response
|
| 537 |
+
kur [7] CertReqMessages, --Key Update Request
|
| 538 |
+
kup [8] CertRepMessage, --Key Update Response
|
| 539 |
+
krr [9] CertReqMessages, --Key Recovery Request
|
| 540 |
+
krp [10] KeyRecRepContent, --Key Recovery Response
|
| 541 |
+
rr [11] RevReqContent, --Revocation Request
|
| 542 |
+
rp [12] RevRepContent, --Revocation Response
|
| 543 |
+
ccr [13] CertReqMessages, --Cross-Cert. Request
|
| 544 |
+
ccp [14] CertRepMessage, --Cross-Cert. Response
|
| 545 |
+
ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann.
|
| 546 |
+
cann [16] CertAnnContent, --Certificate Ann.
|
| 547 |
+
rann [17] RevAnnContent, --Revocation Ann.
|
| 548 |
+
crlann [18] CRLAnnContent, --CRL Announcement
|
| 549 |
+
pkiconf [19] PKIConfirmContent, --Confirmation
|
| 550 |
+
nested [20] NestedMessageContent, --Nested Message
|
| 551 |
+
genm [21] GenMsgContent, --General Message
|
| 552 |
+
genp [22] GenRepContent, --General Response
|
| 553 |
+
error [23] ErrorMsgContent, --Error Message
|
| 554 |
+
certConf [24] CertConfirmContent, --Certificate confirm
|
| 555 |
+
pollReq [25] PollReqContent, --Polling request
|
| 556 |
+
pollRep [26] PollRepContent --Polling response
|
| 557 |
+
|
| 558 |
+
"""
|
| 559 |
+
componentType = namedtype.NamedTypes(
|
| 560 |
+
namedtype.NamedType(
|
| 561 |
+
'ir', rfc2511.CertReqMessages().subtype(
|
| 562 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
|
| 563 |
+
)
|
| 564 |
+
),
|
| 565 |
+
namedtype.NamedType(
|
| 566 |
+
'ip', CertRepMessage().subtype(
|
| 567 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
| 568 |
+
)
|
| 569 |
+
),
|
| 570 |
+
namedtype.NamedType(
|
| 571 |
+
'cr', rfc2511.CertReqMessages().subtype(
|
| 572 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
|
| 573 |
+
)
|
| 574 |
+
),
|
| 575 |
+
namedtype.NamedType(
|
| 576 |
+
'cp', CertRepMessage().subtype(
|
| 577 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
|
| 578 |
+
)
|
| 579 |
+
),
|
| 580 |
+
namedtype.NamedType(
|
| 581 |
+
'p10cr', rfc2314.CertificationRequest().subtype(
|
| 582 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)
|
| 583 |
+
)
|
| 584 |
+
),
|
| 585 |
+
namedtype.NamedType(
|
| 586 |
+
'popdecc', POPODecKeyChallContent().subtype(
|
| 587 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5)
|
| 588 |
+
)
|
| 589 |
+
),
|
| 590 |
+
namedtype.NamedType(
|
| 591 |
+
'popdecr', POPODecKeyRespContent().subtype(
|
| 592 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)
|
| 593 |
+
)
|
| 594 |
+
),
|
| 595 |
+
namedtype.NamedType(
|
| 596 |
+
'kur', rfc2511.CertReqMessages().subtype(
|
| 597 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)
|
| 598 |
+
)
|
| 599 |
+
),
|
| 600 |
+
namedtype.NamedType(
|
| 601 |
+
'kup', CertRepMessage().subtype(
|
| 602 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)
|
| 603 |
+
)
|
| 604 |
+
),
|
| 605 |
+
namedtype.NamedType(
|
| 606 |
+
'krr', rfc2511.CertReqMessages().subtype(
|
| 607 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)
|
| 608 |
+
)
|
| 609 |
+
),
|
| 610 |
+
namedtype.NamedType(
|
| 611 |
+
'krp', KeyRecRepContent().subtype(
|
| 612 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 10)
|
| 613 |
+
)
|
| 614 |
+
),
|
| 615 |
+
namedtype.NamedType(
|
| 616 |
+
'rr', RevReqContent().subtype(
|
| 617 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 11)
|
| 618 |
+
)
|
| 619 |
+
),
|
| 620 |
+
namedtype.NamedType(
|
| 621 |
+
'rp', RevRepContent().subtype(
|
| 622 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 12)
|
| 623 |
+
)
|
| 624 |
+
),
|
| 625 |
+
namedtype.NamedType(
|
| 626 |
+
'ccr', rfc2511.CertReqMessages().subtype(
|
| 627 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 13)
|
| 628 |
+
)
|
| 629 |
+
),
|
| 630 |
+
namedtype.NamedType(
|
| 631 |
+
'ccp', CertRepMessage().subtype(
|
| 632 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 14)
|
| 633 |
+
)
|
| 634 |
+
),
|
| 635 |
+
namedtype.NamedType(
|
| 636 |
+
'ckuann', CAKeyUpdAnnContent().subtype(
|
| 637 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 15)
|
| 638 |
+
)
|
| 639 |
+
),
|
| 640 |
+
namedtype.NamedType(
|
| 641 |
+
'cann', CertAnnContent().subtype(
|
| 642 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 16)
|
| 643 |
+
)
|
| 644 |
+
),
|
| 645 |
+
namedtype.NamedType(
|
| 646 |
+
'rann', RevAnnContent().subtype(
|
| 647 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 17)
|
| 648 |
+
)
|
| 649 |
+
),
|
| 650 |
+
namedtype.NamedType(
|
| 651 |
+
'crlann', CRLAnnContent().subtype(
|
| 652 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 18)
|
| 653 |
+
)
|
| 654 |
+
),
|
| 655 |
+
namedtype.NamedType(
|
| 656 |
+
'pkiconf', PKIConfirmContent().subtype(
|
| 657 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 19)
|
| 658 |
+
)
|
| 659 |
+
),
|
| 660 |
+
namedtype.NamedType(
|
| 661 |
+
'nested', nestedMessageContent
|
| 662 |
+
),
|
| 663 |
+
# namedtype.NamedType('nested', NestedMessageContent().subtype(
|
| 664 |
+
# explicitTag=tag.Tag(tag.tagClassContext,tag.tagFormatConstructed,20)
|
| 665 |
+
# )
|
| 666 |
+
# ),
|
| 667 |
+
namedtype.NamedType(
|
| 668 |
+
'genm', GenMsgContent().subtype(
|
| 669 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 21)
|
| 670 |
+
)
|
| 671 |
+
),
|
| 672 |
+
namedtype.NamedType(
|
| 673 |
+
'gen', GenRepContent().subtype(
|
| 674 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 22)
|
| 675 |
+
)
|
| 676 |
+
),
|
| 677 |
+
namedtype.NamedType(
|
| 678 |
+
'error', ErrorMsgContent().subtype(
|
| 679 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 23)
|
| 680 |
+
)
|
| 681 |
+
),
|
| 682 |
+
namedtype.NamedType(
|
| 683 |
+
'certConf', CertConfirmContent().subtype(
|
| 684 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 24)
|
| 685 |
+
)
|
| 686 |
+
),
|
| 687 |
+
namedtype.NamedType(
|
| 688 |
+
'pollReq', PollReqContent().subtype(
|
| 689 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 25)
|
| 690 |
+
)
|
| 691 |
+
),
|
| 692 |
+
namedtype.NamedType(
|
| 693 |
+
'pollRep', PollRepContent().subtype(
|
| 694 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 26)
|
| 695 |
+
)
|
| 696 |
+
)
|
| 697 |
+
)
|
| 698 |
+
|
| 699 |
+
|
| 700 |
+
class PKIHeader(univ.Sequence):
|
| 701 |
+
"""
|
| 702 |
+
PKIHeader ::= SEQUENCE {
|
| 703 |
+
pvno INTEGER { cmp1999(1), cmp2000(2) },
|
| 704 |
+
sender GeneralName,
|
| 705 |
+
recipient GeneralName,
|
| 706 |
+
messageTime [0] GeneralizedTime OPTIONAL,
|
| 707 |
+
protectionAlg [1] AlgorithmIdentifier OPTIONAL,
|
| 708 |
+
senderKID [2] KeyIdentifier OPTIONAL,
|
| 709 |
+
recipKID [3] KeyIdentifier OPTIONAL,
|
| 710 |
+
transactionID [4] OCTET STRING OPTIONAL,
|
| 711 |
+
senderNonce [5] OCTET STRING OPTIONAL,
|
| 712 |
+
recipNonce [6] OCTET STRING OPTIONAL,
|
| 713 |
+
freeText [7] PKIFreeText OPTIONAL,
|
| 714 |
+
generalInfo [8] SEQUENCE SIZE (1..MAX) OF
|
| 715 |
+
InfoTypeAndValue OPTIONAL
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
"""
|
| 719 |
+
componentType = namedtype.NamedTypes(
|
| 720 |
+
namedtype.NamedType(
|
| 721 |
+
'pvno', univ.Integer(
|
| 722 |
+
namedValues=namedval.NamedValues(('cmp1999', 1), ('cmp2000', 2))
|
| 723 |
+
)
|
| 724 |
+
),
|
| 725 |
+
namedtype.NamedType('sender', rfc2459.GeneralName()),
|
| 726 |
+
namedtype.NamedType('recipient', rfc2459.GeneralName()),
|
| 727 |
+
namedtype.OptionalNamedType('messageTime', useful.GeneralizedTime().subtype(
|
| 728 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 729 |
+
namedtype.OptionalNamedType('protectionAlg', rfc2459.AlgorithmIdentifier().subtype(
|
| 730 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 731 |
+
namedtype.OptionalNamedType('senderKID', rfc2459.KeyIdentifier().subtype(
|
| 732 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 733 |
+
namedtype.OptionalNamedType('recipKID', rfc2459.KeyIdentifier().subtype(
|
| 734 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 735 |
+
namedtype.OptionalNamedType('transactionID', univ.OctetString().subtype(
|
| 736 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 737 |
+
namedtype.OptionalNamedType('senderNonce', univ.OctetString().subtype(
|
| 738 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
|
| 739 |
+
namedtype.OptionalNamedType('recipNonce', univ.OctetString().subtype(
|
| 740 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
|
| 741 |
+
namedtype.OptionalNamedType('freeText', PKIFreeText().subtype(
|
| 742 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7))),
|
| 743 |
+
namedtype.OptionalNamedType('generalInfo',
|
| 744 |
+
univ.SequenceOf(
|
| 745 |
+
componentType=InfoTypeAndValue().subtype(
|
| 746 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 747 |
+
)
|
| 748 |
+
).subtype(
|
| 749 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))
|
| 750 |
+
)
|
| 751 |
+
)
|
| 752 |
+
|
| 753 |
+
|
| 754 |
+
class ProtectedPart(univ.Sequence):
|
| 755 |
+
"""
|
| 756 |
+
ProtectedPart ::= SEQUENCE {
|
| 757 |
+
header PKIHeader,
|
| 758 |
+
body PKIBody
|
| 759 |
+
}
|
| 760 |
+
"""
|
| 761 |
+
componentType = namedtype.NamedTypes(
|
| 762 |
+
namedtype.NamedType('header', PKIHeader()),
|
| 763 |
+
namedtype.NamedType('infoValue', PKIBody())
|
| 764 |
+
)
|
| 765 |
+
|
| 766 |
+
|
| 767 |
+
class PKIMessage(univ.Sequence):
|
| 768 |
+
"""
|
| 769 |
+
PKIMessage ::= SEQUENCE {
|
| 770 |
+
header PKIHeader,
|
| 771 |
+
body PKIBody,
|
| 772 |
+
protection [0] PKIProtection OPTIONAL,
|
| 773 |
+
extraCerts [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
|
| 774 |
+
OPTIONAL
|
| 775 |
+
}"""
|
| 776 |
+
componentType = namedtype.NamedTypes(
|
| 777 |
+
namedtype.NamedType('header', PKIHeader()),
|
| 778 |
+
namedtype.NamedType('body', PKIBody()),
|
| 779 |
+
namedtype.OptionalNamedType('protection', PKIProtection().subtype(
|
| 780 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 781 |
+
namedtype.OptionalNamedType('extraCerts',
|
| 782 |
+
univ.SequenceOf(
|
| 783 |
+
componentType=CMPCertificate()
|
| 784 |
+
).subtype(
|
| 785 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX),
|
| 786 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
|
| 787 |
+
)
|
| 788 |
+
)
|
| 789 |
+
)
|
| 790 |
+
|
| 791 |
+
|
| 792 |
+
class PKIMessages(univ.SequenceOf):
|
| 793 |
+
"""
|
| 794 |
+
PKIMessages ::= SEQUENCE SIZE (1..MAX) OF PKIMessage
|
| 795 |
+
"""
|
| 796 |
+
componentType = PKIMessage()
|
| 797 |
+
sizeSpec = univ.SequenceOf.sizeSpec + constraint.ValueSizeConstraint(1, MAX)
|
| 798 |
+
|
| 799 |
+
|
| 800 |
+
# pyasn1 does not naturally handle recursive definitions, thus this hack:
|
| 801 |
+
# NestedMessageContent ::= PKIMessages
|
| 802 |
+
NestedMessageContent._componentType = PKIMessages()
|
| 803 |
+
nestedMessageContent._componentType = PKIMessages()
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4476.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Attribute Certificate Policies Extension
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc4476.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import char
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
from pyasn1_modules import rfc5280
|
| 21 |
+
|
| 22 |
+
MAX = float('inf')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Imports from RFC 5280
|
| 26 |
+
|
| 27 |
+
PolicyQualifierId = rfc5280.PolicyQualifierId
|
| 28 |
+
|
| 29 |
+
PolicyQualifierInfo = rfc5280.PolicyQualifierInfo
|
| 30 |
+
|
| 31 |
+
UserNotice = rfc5280.UserNotice
|
| 32 |
+
|
| 33 |
+
id_pkix = rfc5280.id_pkix
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# Object Identifiers
|
| 37 |
+
|
| 38 |
+
id_pe = id_pkix + (1,)
|
| 39 |
+
|
| 40 |
+
id_pe_acPolicies = id_pe + (15,)
|
| 41 |
+
|
| 42 |
+
id_qt = id_pkix + (2,)
|
| 43 |
+
|
| 44 |
+
id_qt_acps = id_qt + (4,)
|
| 45 |
+
|
| 46 |
+
id_qt_acunotice = id_qt + (5,)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# Attribute Certificate Policies Extension
|
| 50 |
+
|
| 51 |
+
class ACUserNotice(UserNotice):
|
| 52 |
+
pass
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class ACPSuri(char.IA5String):
|
| 56 |
+
pass
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class AcPolicyId(univ.ObjectIdentifier):
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class PolicyInformation(univ.Sequence):
|
| 64 |
+
componentType = namedtype.NamedTypes(
|
| 65 |
+
namedtype.NamedType('policyIdentifier', AcPolicyId()),
|
| 66 |
+
namedtype.OptionalNamedType('policyQualifiers',
|
| 67 |
+
univ.SequenceOf(componentType=PolicyQualifierInfo()).subtype(
|
| 68 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class AcPoliciesSyntax(univ.SequenceOf):
|
| 73 |
+
componentType = PolicyInformation()
|
| 74 |
+
subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
# Update the policy qualifier map in rfc5280.py
|
| 78 |
+
|
| 79 |
+
_policyQualifierInfoMapUpdate = {
|
| 80 |
+
id_qt_acps: ACPSuri(),
|
| 81 |
+
id_qt_acunotice: UserNotice(),
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
rfc5280.policyQualifierInfoMap.update(_policyQualifierInfoMapUpdate)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# Update the certificate extension map in rfc5280.py
|
| 88 |
+
|
| 89 |
+
_certificateExtensionsMapUpdate = {
|
| 90 |
+
id_pe_acPolicies: AcPoliciesSyntax(),
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc4985.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Expression of Service Names in X.509 Certificates
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc4985.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import char
|
| 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 |
+
# As specified in Appendix A.2 of RFC 4985
|
| 25 |
+
|
| 26 |
+
id_pkix = rfc5280.id_pkix
|
| 27 |
+
|
| 28 |
+
id_on = id_pkix + (8, )
|
| 29 |
+
|
| 30 |
+
id_on_dnsSRV = id_on + (7, )
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class SRVName(char.IA5String):
|
| 34 |
+
subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
srvName = rfc5280.AnotherName()
|
| 38 |
+
srvName['type-id'] = id_on_dnsSRV
|
| 39 |
+
srvName['value'] = SRVName()
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Map of Other Name OIDs to Other Name is added to the
|
| 43 |
+
# ones that are in rfc5280.py
|
| 44 |
+
|
| 45 |
+
_anotherNameMapUpdate = {
|
| 46 |
+
id_on_dnsSRV: SRVName(),
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5035.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Update to Enhanced Security Services for S/MIME
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc5035.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.codec.der.encoder import encode as der_encode
|
| 17 |
+
|
| 18 |
+
from pyasn1.type import namedtype
|
| 19 |
+
from pyasn1.type import univ
|
| 20 |
+
|
| 21 |
+
from pyasn1_modules import rfc2634
|
| 22 |
+
from pyasn1_modules import rfc4055
|
| 23 |
+
from pyasn1_modules import rfc5652
|
| 24 |
+
from pyasn1_modules import rfc5280
|
| 25 |
+
|
| 26 |
+
ContentType = rfc5652.ContentType
|
| 27 |
+
|
| 28 |
+
IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber
|
| 29 |
+
|
| 30 |
+
SubjectKeyIdentifier = rfc5652.SubjectKeyIdentifier
|
| 31 |
+
|
| 32 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 33 |
+
|
| 34 |
+
PolicyInformation = rfc5280.PolicyInformation
|
| 35 |
+
|
| 36 |
+
GeneralNames = rfc5280.GeneralNames
|
| 37 |
+
|
| 38 |
+
CertificateSerialNumber = rfc5280.CertificateSerialNumber
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# Signing Certificate Attribute V1 and V2
|
| 42 |
+
|
| 43 |
+
id_aa_signingCertificate = rfc2634.id_aa_signingCertificate
|
| 44 |
+
|
| 45 |
+
id_aa_signingCertificateV2 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.47')
|
| 46 |
+
|
| 47 |
+
Hash = rfc2634.Hash
|
| 48 |
+
|
| 49 |
+
IssuerSerial = rfc2634.IssuerSerial
|
| 50 |
+
|
| 51 |
+
ESSCertID = rfc2634.ESSCertID
|
| 52 |
+
|
| 53 |
+
SigningCertificate = rfc2634.SigningCertificate
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
sha256AlgId = AlgorithmIdentifier()
|
| 57 |
+
sha256AlgId['algorithm'] = rfc4055.id_sha256
|
| 58 |
+
# A non-schema object for sha256AlgId['parameters'] as absent
|
| 59 |
+
sha256AlgId['parameters'] = der_encode(univ.OctetString(''))
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class ESSCertIDv2(univ.Sequence):
|
| 63 |
+
pass
|
| 64 |
+
|
| 65 |
+
ESSCertIDv2.componentType = namedtype.NamedTypes(
|
| 66 |
+
namedtype.DefaultedNamedType('hashAlgorithm', sha256AlgId),
|
| 67 |
+
namedtype.NamedType('certHash', Hash()),
|
| 68 |
+
namedtype.OptionalNamedType('issuerSerial', IssuerSerial())
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class SigningCertificateV2(univ.Sequence):
|
| 73 |
+
pass
|
| 74 |
+
|
| 75 |
+
SigningCertificateV2.componentType = namedtype.NamedTypes(
|
| 76 |
+
namedtype.NamedType('certs', univ.SequenceOf(
|
| 77 |
+
componentType=ESSCertIDv2())),
|
| 78 |
+
namedtype.OptionalNamedType('policies', univ.SequenceOf(
|
| 79 |
+
componentType=PolicyInformation()))
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
# Mail List Expansion History Attribute
|
| 84 |
+
|
| 85 |
+
id_aa_mlExpandHistory = rfc2634.id_aa_mlExpandHistory
|
| 86 |
+
|
| 87 |
+
ub_ml_expansion_history = rfc2634.ub_ml_expansion_history
|
| 88 |
+
|
| 89 |
+
EntityIdentifier = rfc2634.EntityIdentifier
|
| 90 |
+
|
| 91 |
+
MLReceiptPolicy = rfc2634.MLReceiptPolicy
|
| 92 |
+
|
| 93 |
+
MLData = rfc2634.MLData
|
| 94 |
+
|
| 95 |
+
MLExpansionHistory = rfc2634.MLExpansionHistory
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
# ESS Security Label Attribute
|
| 99 |
+
|
| 100 |
+
id_aa_securityLabel = rfc2634.id_aa_securityLabel
|
| 101 |
+
|
| 102 |
+
ub_privacy_mark_length = rfc2634.ub_privacy_mark_length
|
| 103 |
+
|
| 104 |
+
ub_security_categories = rfc2634.ub_security_categories
|
| 105 |
+
|
| 106 |
+
ub_integer_options = rfc2634.ub_integer_options
|
| 107 |
+
|
| 108 |
+
ESSPrivacyMark = rfc2634.ESSPrivacyMark
|
| 109 |
+
|
| 110 |
+
SecurityClassification = rfc2634.SecurityClassification
|
| 111 |
+
|
| 112 |
+
SecurityPolicyIdentifier = rfc2634.SecurityPolicyIdentifier
|
| 113 |
+
|
| 114 |
+
SecurityCategory = rfc2634.SecurityCategory
|
| 115 |
+
|
| 116 |
+
SecurityCategories = rfc2634.SecurityCategories
|
| 117 |
+
|
| 118 |
+
ESSSecurityLabel = rfc2634.ESSSecurityLabel
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
# Equivalent Labels Attribute
|
| 122 |
+
|
| 123 |
+
id_aa_equivalentLabels = rfc2634.id_aa_equivalentLabels
|
| 124 |
+
|
| 125 |
+
EquivalentLabels = rfc2634.EquivalentLabels
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
# Content Identifier Attribute
|
| 129 |
+
|
| 130 |
+
id_aa_contentIdentifier = rfc2634.id_aa_contentIdentifier
|
| 131 |
+
|
| 132 |
+
ContentIdentifier = rfc2634.ContentIdentifier
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
# Content Reference Attribute
|
| 136 |
+
|
| 137 |
+
id_aa_contentReference = rfc2634.id_aa_contentReference
|
| 138 |
+
|
| 139 |
+
ContentReference = rfc2634.ContentReference
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
# Message Signature Digest Attribute
|
| 143 |
+
|
| 144 |
+
id_aa_msgSigDigest = rfc2634.id_aa_msgSigDigest
|
| 145 |
+
|
| 146 |
+
MsgSigDigest = rfc2634.MsgSigDigest
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
# Content Hints Attribute
|
| 150 |
+
|
| 151 |
+
id_aa_contentHint = rfc2634.id_aa_contentHint
|
| 152 |
+
|
| 153 |
+
ContentHints = rfc2634.ContentHints
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
# Receipt Request Attribute
|
| 157 |
+
|
| 158 |
+
AllOrFirstTier = rfc2634.AllOrFirstTier
|
| 159 |
+
|
| 160 |
+
ReceiptsFrom = rfc2634.ReceiptsFrom
|
| 161 |
+
|
| 162 |
+
id_aa_receiptRequest = rfc2634.id_aa_receiptRequest
|
| 163 |
+
|
| 164 |
+
ub_receiptsTo = rfc2634.ub_receiptsTo
|
| 165 |
+
|
| 166 |
+
ReceiptRequest = rfc2634.ReceiptRequest
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
# Receipt Content Type
|
| 170 |
+
|
| 171 |
+
ESSVersion = rfc2634.ESSVersion
|
| 172 |
+
|
| 173 |
+
id_ct_receipt = rfc2634.id_ct_receipt
|
| 174 |
+
|
| 175 |
+
Receipt = rfc2634.Receipt
|
| 176 |
+
|
| 177 |
+
ub_receiptsTo = rfc2634.ub_receiptsTo
|
| 178 |
+
|
| 179 |
+
ReceiptRequest = rfc2634.ReceiptRequest
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
# Map of Attribute Type to the Attribute structure is added to the
|
| 183 |
+
# ones that are in rfc5652.py
|
| 184 |
+
|
| 185 |
+
_cmsAttributesMapUpdate = {
|
| 186 |
+
id_aa_signingCertificateV2: SigningCertificateV2(),
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
# Map of Content Type OIDs to Content Types is added to the
|
| 193 |
+
# ones that are in rfc5652.py
|
| 194 |
+
|
| 195 |
+
_cmsContentTypesMapUpdate = {
|
| 196 |
+
id_ct_receipt: Receipt(),
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5126.py
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# CMS Advanced Electronic Signatures (CAdES)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5126.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import char
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import opentype
|
| 19 |
+
from pyasn1.type import tag
|
| 20 |
+
from pyasn1.type import useful
|
| 21 |
+
from pyasn1.type import univ
|
| 22 |
+
|
| 23 |
+
from pyasn1_modules import rfc5280
|
| 24 |
+
from pyasn1_modules import rfc5652
|
| 25 |
+
from pyasn1_modules import rfc5035
|
| 26 |
+
from pyasn1_modules import rfc5755
|
| 27 |
+
from pyasn1_modules import rfc6960
|
| 28 |
+
from pyasn1_modules import rfc3161
|
| 29 |
+
|
| 30 |
+
MAX = float('inf')
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Maps for OpenTypes
|
| 34 |
+
|
| 35 |
+
commitmentQualifierMap = { }
|
| 36 |
+
|
| 37 |
+
sigQualifiersMap = { }
|
| 38 |
+
|
| 39 |
+
otherRevRefMap = { }
|
| 40 |
+
|
| 41 |
+
otherRevValMap = { }
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Imports from RFC 5652
|
| 45 |
+
|
| 46 |
+
ContentInfo = rfc5652.ContentInfo
|
| 47 |
+
|
| 48 |
+
ContentType = rfc5652.ContentType
|
| 49 |
+
|
| 50 |
+
SignedData = rfc5652.SignedData
|
| 51 |
+
|
| 52 |
+
EncapsulatedContentInfo = rfc5652.EncapsulatedContentInfo
|
| 53 |
+
|
| 54 |
+
SignerInfo = rfc5652.SignerInfo
|
| 55 |
+
|
| 56 |
+
MessageDigest = rfc5652.MessageDigest
|
| 57 |
+
|
| 58 |
+
SigningTime = rfc5652.SigningTime
|
| 59 |
+
|
| 60 |
+
Countersignature = rfc5652.Countersignature
|
| 61 |
+
|
| 62 |
+
id_data = rfc5652.id_data
|
| 63 |
+
|
| 64 |
+
id_signedData = rfc5652.id_signedData
|
| 65 |
+
|
| 66 |
+
id_contentType= rfc5652.id_contentType
|
| 67 |
+
|
| 68 |
+
id_messageDigest = rfc5652.id_messageDigest
|
| 69 |
+
|
| 70 |
+
id_signingTime = rfc5652.id_signingTime
|
| 71 |
+
|
| 72 |
+
id_countersignature = rfc5652.id_countersignature
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
# Imports from RFC 5035
|
| 76 |
+
|
| 77 |
+
SigningCertificate = rfc5035.SigningCertificate
|
| 78 |
+
|
| 79 |
+
IssuerSerial = rfc5035.IssuerSerial
|
| 80 |
+
|
| 81 |
+
ContentReference = rfc5035.ContentReference
|
| 82 |
+
|
| 83 |
+
ContentIdentifier = rfc5035.ContentIdentifier
|
| 84 |
+
|
| 85 |
+
id_aa_contentReference = rfc5035.id_aa_contentReference
|
| 86 |
+
|
| 87 |
+
id_aa_contentIdentifier = rfc5035.id_aa_contentIdentifier
|
| 88 |
+
|
| 89 |
+
id_aa_signingCertificate = rfc5035.id_aa_signingCertificate
|
| 90 |
+
|
| 91 |
+
id_aa_signingCertificateV2 = rfc5035.id_aa_signingCertificateV2
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
# Imports from RFC 5280
|
| 95 |
+
|
| 96 |
+
Certificate = rfc5280.Certificate
|
| 97 |
+
|
| 98 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 99 |
+
|
| 100 |
+
CertificateList = rfc5280.CertificateList
|
| 101 |
+
|
| 102 |
+
Name = rfc5280.Name
|
| 103 |
+
|
| 104 |
+
Attribute = rfc5280.Attribute
|
| 105 |
+
|
| 106 |
+
GeneralNames = rfc5280.GeneralNames
|
| 107 |
+
|
| 108 |
+
GeneralName = rfc5280.GeneralName
|
| 109 |
+
|
| 110 |
+
PolicyInformation = rfc5280.PolicyInformation
|
| 111 |
+
|
| 112 |
+
DirectoryString = rfc5280.DirectoryString
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
# Imports from RFC 5755
|
| 116 |
+
|
| 117 |
+
AttributeCertificate = rfc5755.AttributeCertificate
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
# Imports from RFC 6960
|
| 121 |
+
|
| 122 |
+
BasicOCSPResponse = rfc6960.BasicOCSPResponse
|
| 123 |
+
|
| 124 |
+
ResponderID = rfc6960.ResponderID
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
# Imports from RFC 3161
|
| 128 |
+
|
| 129 |
+
TimeStampToken = rfc3161.TimeStampToken
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# OID used referencing electronic signature mechanisms
|
| 133 |
+
|
| 134 |
+
id_etsi_es_IDUP_Mechanism_v1 = univ.ObjectIdentifier('0.4.0.1733.1.4.1')
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
# OtherSigningCertificate - deprecated
|
| 138 |
+
|
| 139 |
+
id_aa_ets_otherSigCert = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.19')
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class OtherHashValue(univ.OctetString):
|
| 143 |
+
pass
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class OtherHashAlgAndValue(univ.Sequence):
|
| 147 |
+
componentType = namedtype.NamedTypes(
|
| 148 |
+
namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
|
| 149 |
+
namedtype.NamedType('hashValue', OtherHashValue())
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
class OtherHash(univ.Choice):
|
| 154 |
+
componentType = namedtype.NamedTypes(
|
| 155 |
+
namedtype.NamedType('sha1Hash', OtherHashValue()),
|
| 156 |
+
namedtype.NamedType('otherHash', OtherHashAlgAndValue())
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
class OtherCertID(univ.Sequence):
|
| 161 |
+
componentType = namedtype.NamedTypes(
|
| 162 |
+
namedtype.NamedType('otherCertHash', OtherHash()),
|
| 163 |
+
namedtype.OptionalNamedType('issuerSerial', IssuerSerial())
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
class OtherSigningCertificate(univ.Sequence):
|
| 168 |
+
componentType = namedtype.NamedTypes(
|
| 169 |
+
namedtype.NamedType('certs',
|
| 170 |
+
univ.SequenceOf(componentType=OtherCertID())),
|
| 171 |
+
namedtype.OptionalNamedType('policies',
|
| 172 |
+
univ.SequenceOf(componentType=PolicyInformation()))
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
# Signature Policy Identifier
|
| 177 |
+
|
| 178 |
+
id_aa_ets_sigPolicyId = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.15')
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
class SigPolicyId(univ.ObjectIdentifier):
|
| 182 |
+
pass
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
class SigPolicyHash(OtherHashAlgAndValue):
|
| 186 |
+
pass
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
class SigPolicyQualifierId(univ.ObjectIdentifier):
|
| 190 |
+
pass
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
class SigPolicyQualifierInfo(univ.Sequence):
|
| 194 |
+
componentType = namedtype.NamedTypes(
|
| 195 |
+
namedtype.NamedType('sigPolicyQualifierId', SigPolicyQualifierId()),
|
| 196 |
+
namedtype.NamedType('sigQualifier', univ.Any(),
|
| 197 |
+
openType=opentype.OpenType('sigPolicyQualifierId', sigQualifiersMap))
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class SignaturePolicyId(univ.Sequence):
|
| 202 |
+
componentType = namedtype.NamedTypes(
|
| 203 |
+
namedtype.NamedType('sigPolicyId', SigPolicyId()),
|
| 204 |
+
namedtype.NamedType('sigPolicyHash', SigPolicyHash()),
|
| 205 |
+
namedtype.OptionalNamedType('sigPolicyQualifiers',
|
| 206 |
+
univ.SequenceOf(componentType=SigPolicyQualifierInfo()).subtype(
|
| 207 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
class SignaturePolicyImplied(univ.Null):
|
| 212 |
+
pass
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class SignaturePolicy(univ.Choice):
|
| 216 |
+
componentType = namedtype.NamedTypes(
|
| 217 |
+
namedtype.NamedType('signaturePolicyId', SignaturePolicyId()),
|
| 218 |
+
namedtype.NamedType('signaturePolicyImplied', SignaturePolicyImplied())
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
id_spq_ets_unotice = univ.ObjectIdentifier('1.2.840.113549.1.9.16.5.2')
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
class DisplayText(univ.Choice):
|
| 226 |
+
componentType = namedtype.NamedTypes(
|
| 227 |
+
namedtype.NamedType('visibleString', char.VisibleString().subtype(
|
| 228 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 229 |
+
namedtype.NamedType('bmpString', char.BMPString().subtype(
|
| 230 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 200))),
|
| 231 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 232 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 200)))
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
class NoticeReference(univ.Sequence):
|
| 237 |
+
componentType = namedtype.NamedTypes(
|
| 238 |
+
namedtype.NamedType('organization', DisplayText()),
|
| 239 |
+
namedtype.NamedType('noticeNumbers',
|
| 240 |
+
univ.SequenceOf(componentType=univ.Integer()))
|
| 241 |
+
)
|
| 242 |
+
|
| 243 |
+
class SPUserNotice(univ.Sequence):
|
| 244 |
+
componentType = namedtype.NamedTypes(
|
| 245 |
+
namedtype.OptionalNamedType('noticeRef', NoticeReference()),
|
| 246 |
+
namedtype.OptionalNamedType('explicitText', DisplayText())
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
noticeToUser = SigPolicyQualifierInfo()
|
| 251 |
+
noticeToUser['sigPolicyQualifierId'] = id_spq_ets_unotice
|
| 252 |
+
noticeToUser['sigQualifier'] = SPUserNotice()
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
id_spq_ets_uri = univ.ObjectIdentifier('1.2.840.113549.1.9.16.5.1')
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
class SPuri(char.IA5String):
|
| 259 |
+
pass
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
pointerToSigPolSpec = SigPolicyQualifierInfo()
|
| 263 |
+
pointerToSigPolSpec['sigPolicyQualifierId'] = id_spq_ets_uri
|
| 264 |
+
pointerToSigPolSpec['sigQualifier'] = SPuri()
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# Commitment Type
|
| 268 |
+
|
| 269 |
+
id_aa_ets_commitmentType = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.16')
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
class CommitmentTypeIdentifier(univ.ObjectIdentifier):
|
| 273 |
+
pass
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
class CommitmentTypeQualifier(univ.Sequence):
|
| 277 |
+
componentType = namedtype.NamedTypes(
|
| 278 |
+
namedtype.NamedType('commitmentTypeIdentifier',
|
| 279 |
+
CommitmentTypeIdentifier()),
|
| 280 |
+
namedtype.NamedType('qualifier', univ.Any(),
|
| 281 |
+
openType=opentype.OpenType('commitmentTypeIdentifier',
|
| 282 |
+
commitmentQualifierMap))
|
| 283 |
+
)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
class CommitmentTypeIndication(univ.Sequence):
|
| 287 |
+
componentType = namedtype.NamedTypes(
|
| 288 |
+
namedtype.NamedType('commitmentTypeId', CommitmentTypeIdentifier()),
|
| 289 |
+
namedtype.OptionalNamedType('commitmentTypeQualifier',
|
| 290 |
+
univ.SequenceOf(componentType=CommitmentTypeQualifier()).subtype(
|
| 291 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 292 |
+
)
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
id_cti_ets_proofOfOrigin = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.1')
|
| 296 |
+
|
| 297 |
+
id_cti_ets_proofOfReceipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.2')
|
| 298 |
+
|
| 299 |
+
id_cti_ets_proofOfDelivery = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.3')
|
| 300 |
+
|
| 301 |
+
id_cti_ets_proofOfSender = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.4')
|
| 302 |
+
|
| 303 |
+
id_cti_ets_proofOfApproval = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.5')
|
| 304 |
+
|
| 305 |
+
id_cti_ets_proofOfCreation = univ.ObjectIdentifier('1.2.840.113549.1.9.16.6.6')
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
# Signer Location
|
| 309 |
+
|
| 310 |
+
id_aa_ets_signerLocation = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.17')
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
class PostalAddress(univ.SequenceOf):
|
| 314 |
+
componentType = DirectoryString()
|
| 315 |
+
subtypeSpec = constraint.ValueSizeConstraint(1, 6)
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
class SignerLocation(univ.Sequence):
|
| 319 |
+
componentType = namedtype.NamedTypes(
|
| 320 |
+
namedtype.OptionalNamedType('countryName',
|
| 321 |
+
DirectoryString().subtype(explicitTag=tag.Tag(
|
| 322 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 323 |
+
namedtype.OptionalNamedType('localityName',
|
| 324 |
+
DirectoryString().subtype(explicitTag=tag.Tag(
|
| 325 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 326 |
+
namedtype.OptionalNamedType('postalAdddress',
|
| 327 |
+
PostalAddress().subtype(explicitTag=tag.Tag(
|
| 328 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 329 |
+
)
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
# Signature Timestamp
|
| 333 |
+
|
| 334 |
+
id_aa_signatureTimeStampToken = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.14')
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
class SignatureTimeStampToken(TimeStampToken):
|
| 338 |
+
pass
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
# Content Timestamp
|
| 342 |
+
|
| 343 |
+
id_aa_ets_contentTimestamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.20')
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
class ContentTimestamp(TimeStampToken):
|
| 347 |
+
pass
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
# Signer Attributes
|
| 351 |
+
|
| 352 |
+
id_aa_ets_signerAttr = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.18')
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class ClaimedAttributes(univ.SequenceOf):
|
| 356 |
+
componentType = Attribute()
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
class CertifiedAttributes(AttributeCertificate):
|
| 360 |
+
pass
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
class SignerAttribute(univ.SequenceOf):
|
| 364 |
+
componentType = univ.Choice(componentType=namedtype.NamedTypes(
|
| 365 |
+
namedtype.NamedType('claimedAttributes',
|
| 366 |
+
ClaimedAttributes().subtype(explicitTag=tag.Tag(
|
| 367 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 368 |
+
namedtype.NamedType('certifiedAttributes',
|
| 369 |
+
CertifiedAttributes().subtype(explicitTag=tag.Tag(
|
| 370 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 371 |
+
))
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
# Complete Certificate Refs
|
| 375 |
+
|
| 376 |
+
id_aa_ets_certificateRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.21')
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
class CompleteCertificateRefs(univ.SequenceOf):
|
| 380 |
+
componentType = OtherCertID()
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
# Complete Revocation Refs
|
| 384 |
+
|
| 385 |
+
id_aa_ets_revocationRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.22')
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
class CrlIdentifier(univ.Sequence):
|
| 389 |
+
componentType = namedtype.NamedTypes(
|
| 390 |
+
namedtype.NamedType('crlissuer', Name()),
|
| 391 |
+
namedtype.NamedType('crlIssuedTime', useful.UTCTime()),
|
| 392 |
+
namedtype.OptionalNamedType('crlNumber', univ.Integer())
|
| 393 |
+
)
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
class CrlValidatedID(univ.Sequence):
|
| 397 |
+
componentType = namedtype.NamedTypes(
|
| 398 |
+
namedtype.NamedType('crlHash', OtherHash()),
|
| 399 |
+
namedtype.OptionalNamedType('crlIdentifier', CrlIdentifier())
|
| 400 |
+
)
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
class CRLListID(univ.Sequence):
|
| 404 |
+
componentType = namedtype.NamedTypes(
|
| 405 |
+
namedtype.NamedType('crls',
|
| 406 |
+
univ.SequenceOf(componentType=CrlValidatedID()))
|
| 407 |
+
)
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
class OcspIdentifier(univ.Sequence):
|
| 411 |
+
componentType = namedtype.NamedTypes(
|
| 412 |
+
namedtype.NamedType('ocspResponderID', ResponderID()),
|
| 413 |
+
namedtype.NamedType('producedAt', useful.GeneralizedTime())
|
| 414 |
+
)
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
class OcspResponsesID(univ.Sequence):
|
| 418 |
+
componentType = namedtype.NamedTypes(
|
| 419 |
+
namedtype.NamedType('ocspIdentifier', OcspIdentifier()),
|
| 420 |
+
namedtype.OptionalNamedType('ocspRepHash', OtherHash())
|
| 421 |
+
)
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
class OcspListID(univ.Sequence):
|
| 425 |
+
componentType = namedtype.NamedTypes(
|
| 426 |
+
namedtype.NamedType('ocspResponses',
|
| 427 |
+
univ.SequenceOf(componentType=OcspResponsesID()))
|
| 428 |
+
)
|
| 429 |
+
|
| 430 |
+
|
| 431 |
+
class OtherRevRefType(univ.ObjectIdentifier):
|
| 432 |
+
pass
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
class OtherRevRefs(univ.Sequence):
|
| 436 |
+
componentType = namedtype.NamedTypes(
|
| 437 |
+
namedtype.NamedType('otherRevRefType', OtherRevRefType()),
|
| 438 |
+
namedtype.NamedType('otherRevRefs', univ.Any(),
|
| 439 |
+
openType=opentype.OpenType('otherRevRefType', otherRevRefMap))
|
| 440 |
+
)
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
class CrlOcspRef(univ.Sequence):
|
| 444 |
+
componentType = namedtype.NamedTypes(
|
| 445 |
+
namedtype.OptionalNamedType('crlids',
|
| 446 |
+
CRLListID().subtype(explicitTag=tag.Tag(
|
| 447 |
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 448 |
+
namedtype.OptionalNamedType('ocspids',
|
| 449 |
+
OcspListID().subtype(explicitTag=tag.Tag(
|
| 450 |
+
tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 451 |
+
namedtype.OptionalNamedType('otherRev',
|
| 452 |
+
OtherRevRefs().subtype(explicitTag=tag.Tag(
|
| 453 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
| 454 |
+
)
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
class CompleteRevocationRefs(univ.SequenceOf):
|
| 458 |
+
componentType = CrlOcspRef()
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
# Certificate Values
|
| 462 |
+
|
| 463 |
+
id_aa_ets_certValues = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.23')
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
class CertificateValues(univ.SequenceOf):
|
| 467 |
+
componentType = Certificate()
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
# Certificate Revocation Values
|
| 471 |
+
|
| 472 |
+
id_aa_ets_revocationValues = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.24')
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
class OtherRevValType(univ.ObjectIdentifier):
|
| 476 |
+
pass
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
class OtherRevVals(univ.Sequence):
|
| 480 |
+
componentType = namedtype.NamedTypes(
|
| 481 |
+
namedtype.NamedType('otherRevValType', OtherRevValType()),
|
| 482 |
+
namedtype.NamedType('otherRevVals', univ.Any(),
|
| 483 |
+
openType=opentype.OpenType('otherRevValType', otherRevValMap))
|
| 484 |
+
)
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
class RevocationValues(univ.Sequence):
|
| 488 |
+
componentType = namedtype.NamedTypes(
|
| 489 |
+
namedtype.OptionalNamedType('crlVals',
|
| 490 |
+
univ.SequenceOf(componentType=CertificateList()).subtype(
|
| 491 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 492 |
+
namedtype.OptionalNamedType('ocspVals',
|
| 493 |
+
univ.SequenceOf(componentType=BasicOCSPResponse()).subtype(
|
| 494 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 495 |
+
namedtype.OptionalNamedType('otherRevVals',
|
| 496 |
+
OtherRevVals().subtype(explicitTag=tag.Tag(
|
| 497 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
| 498 |
+
)
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
# CAdES-C Timestamp
|
| 502 |
+
|
| 503 |
+
id_aa_ets_escTimeStamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.25')
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
class ESCTimeStampToken(TimeStampToken):
|
| 507 |
+
pass
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
# Time-Stamped Certificates and CRLs
|
| 511 |
+
|
| 512 |
+
id_aa_ets_certCRLTimestamp = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.26')
|
| 513 |
+
|
| 514 |
+
|
| 515 |
+
class TimestampedCertsCRLs(TimeStampToken):
|
| 516 |
+
pass
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
# Archive Timestamp
|
| 520 |
+
|
| 521 |
+
id_aa_ets_archiveTimestampV2 = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.48')
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
class ArchiveTimeStampToken(TimeStampToken):
|
| 525 |
+
pass
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
# Attribute certificate references
|
| 529 |
+
|
| 530 |
+
id_aa_ets_attrCertificateRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.44')
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
class AttributeCertificateRefs(univ.SequenceOf):
|
| 534 |
+
componentType = OtherCertID()
|
| 535 |
+
|
| 536 |
+
|
| 537 |
+
# Attribute revocation references
|
| 538 |
+
|
| 539 |
+
id_aa_ets_attrRevocationRefs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.45')
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
class AttributeRevocationRefs(univ.SequenceOf):
|
| 543 |
+
componentType = CrlOcspRef()
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
# Update the sigQualifiersMap
|
| 547 |
+
|
| 548 |
+
_sigQualifiersMapUpdate = {
|
| 549 |
+
id_spq_ets_unotice: SPUserNotice(),
|
| 550 |
+
id_spq_ets_uri: SPuri(),
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
sigQualifiersMap.update(_sigQualifiersMapUpdate)
|
| 554 |
+
|
| 555 |
+
|
| 556 |
+
# Update the CMS Attribute Map in rfc5652.py
|
| 557 |
+
|
| 558 |
+
_cmsAttributesMapUpdate = {
|
| 559 |
+
id_aa_ets_otherSigCert: OtherSigningCertificate(),
|
| 560 |
+
id_aa_ets_sigPolicyId: SignaturePolicy(),
|
| 561 |
+
id_aa_ets_commitmentType: CommitmentTypeIndication(),
|
| 562 |
+
id_aa_ets_signerLocation: SignerLocation(),
|
| 563 |
+
id_aa_signatureTimeStampToken: SignatureTimeStampToken(),
|
| 564 |
+
id_aa_ets_contentTimestamp: ContentTimestamp(),
|
| 565 |
+
id_aa_ets_signerAttr: SignerAttribute(),
|
| 566 |
+
id_aa_ets_certificateRefs: CompleteCertificateRefs(),
|
| 567 |
+
id_aa_ets_revocationRefs: CompleteRevocationRefs(),
|
| 568 |
+
id_aa_ets_certValues: CertificateValues(),
|
| 569 |
+
id_aa_ets_revocationValues: RevocationValues(),
|
| 570 |
+
id_aa_ets_escTimeStamp: ESCTimeStampToken(),
|
| 571 |
+
id_aa_ets_certCRLTimestamp: TimestampedCertsCRLs(),
|
| 572 |
+
id_aa_ets_archiveTimestampV2: ArchiveTimeStampToken(),
|
| 573 |
+
id_aa_ets_attrCertificateRefs: AttributeCertificateRefs(),
|
| 574 |
+
id_aa_ets_attrRevocationRefs: AttributeRevocationRefs(),
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5208.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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#8 syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://tools.ietf.org/html/rfc5208
|
| 11 |
+
#
|
| 12 |
+
# Sample captures could be obtained with "openssl pkcs8 -topk8" command
|
| 13 |
+
#
|
| 14 |
+
from pyasn1_modules import rfc2251
|
| 15 |
+
from pyasn1_modules.rfc2459 import *
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class KeyEncryptionAlgorithms(AlgorithmIdentifier):
|
| 19 |
+
pass
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class PrivateKeyAlgorithms(AlgorithmIdentifier):
|
| 23 |
+
pass
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class EncryptedData(univ.OctetString):
|
| 27 |
+
pass
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class EncryptedPrivateKeyInfo(univ.Sequence):
|
| 31 |
+
componentType = namedtype.NamedTypes(
|
| 32 |
+
namedtype.NamedType('encryptionAlgorithm', AlgorithmIdentifier()),
|
| 33 |
+
namedtype.NamedType('encryptedData', EncryptedData())
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class PrivateKey(univ.OctetString):
|
| 38 |
+
pass
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class Attributes(univ.SetOf):
|
| 42 |
+
componentType = rfc2251.Attribute()
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Version(univ.Integer):
|
| 46 |
+
namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class PrivateKeyInfo(univ.Sequence):
|
| 50 |
+
componentType = namedtype.NamedTypes(
|
| 51 |
+
namedtype.NamedType('version', Version()),
|
| 52 |
+
namedtype.NamedType('privateKeyAlgorithm', AlgorithmIdentifier()),
|
| 53 |
+
namedtype.NamedType('privateKey', PrivateKey()),
|
| 54 |
+
namedtype.OptionalNamedType('attributes', Attributes().subtype(
|
| 55 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 56 |
+
)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5636.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Traceable Anonymous Certificate
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5480.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import univ
|
| 15 |
+
from pyasn1.type import useful
|
| 16 |
+
|
| 17 |
+
from pyasn1_modules import rfc5652
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Imports from RFC 5652
|
| 21 |
+
|
| 22 |
+
ContentInfo = rfc5652.ContentInfo
|
| 23 |
+
|
| 24 |
+
EncapsulatedContentInfo = rfc5652.EncapsulatedContentInfo
|
| 25 |
+
|
| 26 |
+
id_data = rfc5652.id_data
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Object Identifiers
|
| 30 |
+
|
| 31 |
+
id_KISA = univ.ObjectIdentifier((1, 2, 410, 200004,))
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
id_npki = id_KISA + (10,)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
id_attribute = id_npki + (1,)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
id_kisa_tac = id_attribute + (1,)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
id_kisa_tac_token = id_kisa_tac + (1,)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
id_kisa_tac_tokenandblindbash = id_kisa_tac + (2,)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
id_kisa_tac_tokenandpartially = id_kisa_tac + (3,)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
# Structures for Traceable Anonymous Certificate (TAC)
|
| 53 |
+
|
| 54 |
+
class UserKey(univ.OctetString):
|
| 55 |
+
pass
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class Timeout(useful.GeneralizedTime):
|
| 59 |
+
pass
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class BlinedCertificateHash(univ.OctetString):
|
| 63 |
+
pass
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class PartiallySignedCertificateHash(univ.OctetString):
|
| 67 |
+
pass
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class Token(ContentInfo):
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class TokenandBlindHash(ContentInfo):
|
| 75 |
+
pass
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class TokenandPartiallySignedCertificateHash(ContentInfo):
|
| 79 |
+
pass
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
# Added to the module in RFC 5636 for the CMS Content Type Map
|
| 83 |
+
|
| 84 |
+
class TACToken(univ.Sequence):
|
| 85 |
+
componentType = namedtype.NamedTypes(
|
| 86 |
+
namedtype.NamedType('userKey', UserKey()),
|
| 87 |
+
namedtype.NamedType('timeout', Timeout())
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
class TACTokenandBlindHash(univ.Sequence):
|
| 92 |
+
componentType = namedtype.NamedTypes(
|
| 93 |
+
namedtype.NamedType('token', Token()),
|
| 94 |
+
namedtype.NamedType('blinded', BlinedCertificateHash())
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class TACTokenandPartiallySignedCertificateHash(univ.Sequence):
|
| 99 |
+
componentType = namedtype.NamedTypes(
|
| 100 |
+
namedtype.NamedType('token', Token()),
|
| 101 |
+
namedtype.NamedType('partially', PartiallySignedCertificateHash())
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# Add to the CMS Content Type Map in rfc5752.py
|
| 106 |
+
|
| 107 |
+
_cmsContentTypesMapUpdate = {
|
| 108 |
+
id_kisa_tac_token: TACToken(),
|
| 109 |
+
id_kisa_tac_tokenandblindbash: TACTokenandBlindHash(),
|
| 110 |
+
id_kisa_tac_tokenandpartially: TACTokenandPartiallySignedCertificateHash(),
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5639.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Elliptic Curve Cryptography Brainpool Standard Curves
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5639.txt
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
from pyasn1.type import univ
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
ecStdCurvesAndGeneration = univ.ObjectIdentifier((1, 3, 36, 3, 3, 2, 8,))
|
| 18 |
+
|
| 19 |
+
ellipticCurve = ecStdCurvesAndGeneration + (1,)
|
| 20 |
+
|
| 21 |
+
versionOne = ellipticCurve + (1,)
|
| 22 |
+
|
| 23 |
+
brainpoolP160r1 = versionOne + (1,)
|
| 24 |
+
|
| 25 |
+
brainpoolP160t1 = versionOne + (2,)
|
| 26 |
+
|
| 27 |
+
brainpoolP192r1 = versionOne + (3,)
|
| 28 |
+
|
| 29 |
+
brainpoolP192t1 = versionOne + (4,)
|
| 30 |
+
|
| 31 |
+
brainpoolP224r1 = versionOne + (5,)
|
| 32 |
+
|
| 33 |
+
brainpoolP224t1 = versionOne + (6,)
|
| 34 |
+
|
| 35 |
+
brainpoolP256r1 = versionOne + (7,)
|
| 36 |
+
|
| 37 |
+
brainpoolP256t1 = versionOne + (8,)
|
| 38 |
+
|
| 39 |
+
brainpoolP320r1 = versionOne + (9,)
|
| 40 |
+
|
| 41 |
+
brainpoolP320t1 = versionOne + (10,)
|
| 42 |
+
|
| 43 |
+
brainpoolP384r1 = versionOne + (11,)
|
| 44 |
+
|
| 45 |
+
brainpoolP384t1 = versionOne + (12,)
|
| 46 |
+
|
| 47 |
+
brainpoolP512r1 = versionOne + (13,)
|
| 48 |
+
|
| 49 |
+
brainpoolP512t1 = versionOne + (14,)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5649.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# AES Key Wrap with Padding
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5649.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import univ
|
| 14 |
+
|
| 15 |
+
from pyasn1_modules import rfc5280
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class AlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 19 |
+
pass
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
|
| 23 |
+
|
| 24 |
+
id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
|
| 25 |
+
|
| 26 |
+
id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
id_aes128_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.8')
|
| 30 |
+
|
| 31 |
+
id_aes192_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.28')
|
| 32 |
+
|
| 33 |
+
id_aes256_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.48')
|
.venv/lib/python3.11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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Modified by Russ Housley to add support for opentypes.
|
| 7 |
+
#
|
| 8 |
+
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
|
| 9 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 10 |
+
#
|
| 11 |
+
# Cryptographic Message Syntax (CMS)
|
| 12 |
+
#
|
| 13 |
+
# ASN.1 source from:
|
| 14 |
+
# http://www.ietf.org/rfc/rfc5652.txt
|
| 15 |
+
#
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import namedval
|
| 19 |
+
from pyasn1.type import opentype
|
| 20 |
+
from pyasn1.type import tag
|
| 21 |
+
from pyasn1.type import univ
|
| 22 |
+
from pyasn1.type import useful
|
| 23 |
+
|
| 24 |
+
from pyasn1_modules import rfc3281
|
| 25 |
+
from pyasn1_modules import rfc5280
|
| 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 |
+
cmsContentTypesMap = { }
|
| 42 |
+
|
| 43 |
+
cmsAttributesMap = { }
|
| 44 |
+
|
| 45 |
+
otherKeyAttributesMap = { }
|
| 46 |
+
|
| 47 |
+
otherCertFormatMap = { }
|
| 48 |
+
|
| 49 |
+
otherRevInfoFormatMap = { }
|
| 50 |
+
|
| 51 |
+
otherRecipientInfoMap = { }
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class AttCertVersionV1(univ.Integer):
|
| 55 |
+
pass
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
AttCertVersionV1.namedValues = namedval.NamedValues(
|
| 59 |
+
('v1', 0)
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class AttributeCertificateInfoV1(univ.Sequence):
|
| 64 |
+
pass
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
AttributeCertificateInfoV1.componentType = namedtype.NamedTypes(
|
| 68 |
+
namedtype.DefaultedNamedType('version', AttCertVersionV1().subtype(value="v1")),
|
| 69 |
+
namedtype.NamedType(
|
| 70 |
+
'subject', univ.Choice(
|
| 71 |
+
componentType=namedtype.NamedTypes(
|
| 72 |
+
namedtype.NamedType('baseCertificateID', rfc3281.IssuerSerial().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 73 |
+
namedtype.NamedType('subjectName', rfc5280.GeneralNames().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 74 |
+
)
|
| 75 |
+
)
|
| 76 |
+
),
|
| 77 |
+
namedtype.NamedType('issuer', rfc5280.GeneralNames()),
|
| 78 |
+
namedtype.NamedType('signature', rfc5280.AlgorithmIdentifier()),
|
| 79 |
+
namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber()),
|
| 80 |
+
namedtype.NamedType('attCertValidityPeriod', rfc3281.AttCertValidityPeriod()),
|
| 81 |
+
namedtype.NamedType('attributes', univ.SequenceOf(componentType=rfc5280.Attribute())),
|
| 82 |
+
namedtype.OptionalNamedType('issuerUniqueID', rfc5280.UniqueIdentifier()),
|
| 83 |
+
namedtype.OptionalNamedType('extensions', rfc5280.Extensions())
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class AttributeCertificateV1(univ.Sequence):
|
| 88 |
+
pass
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
AttributeCertificateV1.componentType = namedtype.NamedTypes(
|
| 92 |
+
namedtype.NamedType('acInfo', AttributeCertificateInfoV1()),
|
| 93 |
+
namedtype.NamedType('signatureAlgorithm', rfc5280.AlgorithmIdentifier()),
|
| 94 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class AttributeValue(univ.Any):
|
| 99 |
+
pass
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class Attribute(univ.Sequence):
|
| 103 |
+
pass
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
Attribute.componentType = namedtype.NamedTypes(
|
| 107 |
+
namedtype.NamedType('attrType', univ.ObjectIdentifier()),
|
| 108 |
+
namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()),
|
| 109 |
+
openType=opentype.OpenType('attrType', cmsAttributesMap)
|
| 110 |
+
)
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class SignedAttributes(univ.SetOf):
|
| 115 |
+
pass
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
SignedAttributes.componentType = Attribute()
|
| 119 |
+
SignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
class AttributeCertificateV2(rfc3281.AttributeCertificate):
|
| 123 |
+
pass
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class OtherKeyAttribute(univ.Sequence):
|
| 127 |
+
pass
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
OtherKeyAttribute.componentType = namedtype.NamedTypes(
|
| 131 |
+
namedtype.NamedType('keyAttrId', univ.ObjectIdentifier()),
|
| 132 |
+
namedtype.OptionalNamedType('keyAttr', univ.Any(),
|
| 133 |
+
openType=opentype.OpenType('keyAttrId', otherKeyAttributesMap)
|
| 134 |
+
)
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class UnauthAttributes(univ.SetOf):
|
| 139 |
+
pass
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
UnauthAttributes.componentType = Attribute()
|
| 143 |
+
UnauthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 144 |
+
|
| 145 |
+
id_encryptedData = _buildOid(1, 2, 840, 113549, 1, 7, 6)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
class SignatureValue(univ.OctetString):
|
| 149 |
+
pass
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class IssuerAndSerialNumber(univ.Sequence):
|
| 153 |
+
pass
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
IssuerAndSerialNumber.componentType = namedtype.NamedTypes(
|
| 157 |
+
namedtype.NamedType('issuer', rfc5280.Name()),
|
| 158 |
+
namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber())
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class SubjectKeyIdentifier(univ.OctetString):
|
| 163 |
+
pass
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
class RecipientKeyIdentifier(univ.Sequence):
|
| 167 |
+
pass
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
RecipientKeyIdentifier.componentType = namedtype.NamedTypes(
|
| 171 |
+
namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier()),
|
| 172 |
+
namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
|
| 173 |
+
namedtype.OptionalNamedType('other', OtherKeyAttribute())
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
class KeyAgreeRecipientIdentifier(univ.Choice):
|
| 178 |
+
pass
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
KeyAgreeRecipientIdentifier.componentType = namedtype.NamedTypes(
|
| 182 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 183 |
+
namedtype.NamedType('rKeyId', RecipientKeyIdentifier().subtype(
|
| 184 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
class EncryptedKey(univ.OctetString):
|
| 189 |
+
pass
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class RecipientEncryptedKey(univ.Sequence):
|
| 193 |
+
pass
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
RecipientEncryptedKey.componentType = namedtype.NamedTypes(
|
| 197 |
+
namedtype.NamedType('rid', KeyAgreeRecipientIdentifier()),
|
| 198 |
+
namedtype.NamedType('encryptedKey', EncryptedKey())
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
class RecipientEncryptedKeys(univ.SequenceOf):
|
| 203 |
+
pass
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
RecipientEncryptedKeys.componentType = RecipientEncryptedKey()
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
class MessageAuthenticationCode(univ.OctetString):
|
| 210 |
+
pass
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
class CMSVersion(univ.Integer):
|
| 214 |
+
pass
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
CMSVersion.namedValues = namedval.NamedValues(
|
| 218 |
+
('v0', 0),
|
| 219 |
+
('v1', 1),
|
| 220 |
+
('v2', 2),
|
| 221 |
+
('v3', 3),
|
| 222 |
+
('v4', 4),
|
| 223 |
+
('v5', 5)
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
class OtherCertificateFormat(univ.Sequence):
|
| 228 |
+
pass
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
OtherCertificateFormat.componentType = namedtype.NamedTypes(
|
| 232 |
+
namedtype.NamedType('otherCertFormat', univ.ObjectIdentifier()),
|
| 233 |
+
namedtype.NamedType('otherCert', univ.Any(),
|
| 234 |
+
openType=opentype.OpenType('otherCertFormat', otherCertFormatMap)
|
| 235 |
+
)
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
class ExtendedCertificateInfo(univ.Sequence):
|
| 240 |
+
pass
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
ExtendedCertificateInfo.componentType = namedtype.NamedTypes(
|
| 244 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 245 |
+
namedtype.NamedType('certificate', rfc5280.Certificate()),
|
| 246 |
+
namedtype.NamedType('attributes', UnauthAttributes())
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
class Signature(univ.BitString):
|
| 251 |
+
pass
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
class SignatureAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 255 |
+
pass
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
class ExtendedCertificate(univ.Sequence):
|
| 259 |
+
pass
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
ExtendedCertificate.componentType = namedtype.NamedTypes(
|
| 263 |
+
namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
|
| 264 |
+
namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
|
| 265 |
+
namedtype.NamedType('signature', Signature())
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class CertificateChoices(univ.Choice):
|
| 270 |
+
pass
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
CertificateChoices.componentType = namedtype.NamedTypes(
|
| 274 |
+
namedtype.NamedType('certificate', rfc5280.Certificate()),
|
| 275 |
+
namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
|
| 276 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 277 |
+
namedtype.NamedType('v1AttrCert', AttributeCertificateV1().subtype(
|
| 278 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 279 |
+
namedtype.NamedType('v2AttrCert', AttributeCertificateV2().subtype(
|
| 280 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 281 |
+
namedtype.NamedType('other', OtherCertificateFormat().subtype(
|
| 282 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 283 |
+
)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
class CertificateSet(univ.SetOf):
|
| 287 |
+
pass
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
CertificateSet.componentType = CertificateChoices()
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
class OtherRevocationInfoFormat(univ.Sequence):
|
| 294 |
+
pass
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
OtherRevocationInfoFormat.componentType = namedtype.NamedTypes(
|
| 298 |
+
namedtype.NamedType('otherRevInfoFormat', univ.ObjectIdentifier()),
|
| 299 |
+
namedtype.NamedType('otherRevInfo', univ.Any(),
|
| 300 |
+
openType=opentype.OpenType('otherRevInfoFormat', otherRevInfoFormatMap)
|
| 301 |
+
)
|
| 302 |
+
)
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
class RevocationInfoChoice(univ.Choice):
|
| 306 |
+
pass
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
RevocationInfoChoice.componentType = namedtype.NamedTypes(
|
| 310 |
+
namedtype.NamedType('crl', rfc5280.CertificateList()),
|
| 311 |
+
namedtype.NamedType('other', OtherRevocationInfoFormat().subtype(
|
| 312 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 313 |
+
)
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
class RevocationInfoChoices(univ.SetOf):
|
| 317 |
+
pass
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
RevocationInfoChoices.componentType = RevocationInfoChoice()
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
class OriginatorInfo(univ.Sequence):
|
| 324 |
+
pass
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
OriginatorInfo.componentType = namedtype.NamedTypes(
|
| 328 |
+
namedtype.OptionalNamedType('certs', CertificateSet().subtype(
|
| 329 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 330 |
+
namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
|
| 331 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
class ContentType(univ.ObjectIdentifier):
|
| 336 |
+
pass
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
class EncryptedContent(univ.OctetString):
|
| 340 |
+
pass
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
class ContentEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 344 |
+
pass
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
class EncryptedContentInfo(univ.Sequence):
|
| 348 |
+
pass
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
EncryptedContentInfo.componentType = namedtype.NamedTypes(
|
| 352 |
+
namedtype.NamedType('contentType', ContentType()),
|
| 353 |
+
namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
|
| 354 |
+
namedtype.OptionalNamedType('encryptedContent', EncryptedContent().subtype(
|
| 355 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 356 |
+
)
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
class UnprotectedAttributes(univ.SetOf):
|
| 360 |
+
pass
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
UnprotectedAttributes.componentType = Attribute()
|
| 364 |
+
UnprotectedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
class KeyEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 368 |
+
pass
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
class KEKIdentifier(univ.Sequence):
|
| 372 |
+
pass
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
KEKIdentifier.componentType = namedtype.NamedTypes(
|
| 376 |
+
namedtype.NamedType('keyIdentifier', univ.OctetString()),
|
| 377 |
+
namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
|
| 378 |
+
namedtype.OptionalNamedType('other', OtherKeyAttribute())
|
| 379 |
+
)
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
class KEKRecipientInfo(univ.Sequence):
|
| 383 |
+
pass
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
KEKRecipientInfo.componentType = namedtype.NamedTypes(
|
| 387 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 388 |
+
namedtype.NamedType('kekid', KEKIdentifier()),
|
| 389 |
+
namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 390 |
+
namedtype.NamedType('encryptedKey', EncryptedKey())
|
| 391 |
+
)
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
class KeyDerivationAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 395 |
+
pass
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
class PasswordRecipientInfo(univ.Sequence):
|
| 399 |
+
pass
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
PasswordRecipientInfo.componentType = namedtype.NamedTypes(
|
| 403 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 404 |
+
namedtype.OptionalNamedType('keyDerivationAlgorithm', KeyDerivationAlgorithmIdentifier().subtype(
|
| 405 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 406 |
+
namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 407 |
+
namedtype.NamedType('encryptedKey', EncryptedKey())
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
class RecipientIdentifier(univ.Choice):
|
| 412 |
+
pass
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
RecipientIdentifier.componentType = namedtype.NamedTypes(
|
| 416 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 417 |
+
namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
|
| 418 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 419 |
+
)
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
class KeyTransRecipientInfo(univ.Sequence):
|
| 423 |
+
pass
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
KeyTransRecipientInfo.componentType = namedtype.NamedTypes(
|
| 427 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 428 |
+
namedtype.NamedType('rid', RecipientIdentifier()),
|
| 429 |
+
namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 430 |
+
namedtype.NamedType('encryptedKey', EncryptedKey())
|
| 431 |
+
)
|
| 432 |
+
|
| 433 |
+
|
| 434 |
+
class UserKeyingMaterial(univ.OctetString):
|
| 435 |
+
pass
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
class OriginatorPublicKey(univ.Sequence):
|
| 439 |
+
pass
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
OriginatorPublicKey.componentType = namedtype.NamedTypes(
|
| 443 |
+
namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()),
|
| 444 |
+
namedtype.NamedType('publicKey', univ.BitString())
|
| 445 |
+
)
|
| 446 |
+
|
| 447 |
+
|
| 448 |
+
class OriginatorIdentifierOrKey(univ.Choice):
|
| 449 |
+
pass
|
| 450 |
+
|
| 451 |
+
|
| 452 |
+
OriginatorIdentifierOrKey.componentType = namedtype.NamedTypes(
|
| 453 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 454 |
+
namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
|
| 455 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 456 |
+
namedtype.NamedType('originatorKey', OriginatorPublicKey().subtype(
|
| 457 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 458 |
+
)
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
class KeyAgreeRecipientInfo(univ.Sequence):
|
| 462 |
+
pass
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
KeyAgreeRecipientInfo.componentType = namedtype.NamedTypes(
|
| 466 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 467 |
+
namedtype.NamedType('originator', OriginatorIdentifierOrKey().subtype(
|
| 468 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 469 |
+
namedtype.OptionalNamedType('ukm', UserKeyingMaterial().subtype(
|
| 470 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 471 |
+
namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 472 |
+
namedtype.NamedType('recipientEncryptedKeys', RecipientEncryptedKeys())
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
class OtherRecipientInfo(univ.Sequence):
|
| 477 |
+
pass
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
OtherRecipientInfo.componentType = namedtype.NamedTypes(
|
| 481 |
+
namedtype.NamedType('oriType', univ.ObjectIdentifier()),
|
| 482 |
+
namedtype.NamedType('oriValue', univ.Any(),
|
| 483 |
+
openType=opentype.OpenType('oriType', otherRecipientInfoMap)
|
| 484 |
+
)
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
class RecipientInfo(univ.Choice):
|
| 489 |
+
pass
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
RecipientInfo.componentType = namedtype.NamedTypes(
|
| 493 |
+
namedtype.NamedType('ktri', KeyTransRecipientInfo()),
|
| 494 |
+
namedtype.NamedType('kari', KeyAgreeRecipientInfo().subtype(
|
| 495 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 496 |
+
namedtype.NamedType('kekri', KEKRecipientInfo().subtype(
|
| 497 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 498 |
+
namedtype.NamedType('pwri', PasswordRecipientInfo().subtype(
|
| 499 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 500 |
+
namedtype.NamedType('ori', OtherRecipientInfo().subtype(
|
| 501 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
|
| 502 |
+
)
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
class RecipientInfos(univ.SetOf):
|
| 506 |
+
pass
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
RecipientInfos.componentType = RecipientInfo()
|
| 510 |
+
RecipientInfos.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
class EnvelopedData(univ.Sequence):
|
| 514 |
+
pass
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
EnvelopedData.componentType = namedtype.NamedTypes(
|
| 518 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 519 |
+
namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
|
| 520 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 521 |
+
namedtype.NamedType('recipientInfos', RecipientInfos()),
|
| 522 |
+
namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
|
| 523 |
+
namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
|
| 524 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
class DigestAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 529 |
+
pass
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
id_ct_contentInfo = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 6)
|
| 533 |
+
|
| 534 |
+
id_digestedData = _buildOid(1, 2, 840, 113549, 1, 7, 5)
|
| 535 |
+
|
| 536 |
+
|
| 537 |
+
class EncryptedData(univ.Sequence):
|
| 538 |
+
pass
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
EncryptedData.componentType = namedtype.NamedTypes(
|
| 542 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 543 |
+
namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
|
| 544 |
+
namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
|
| 545 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 546 |
+
)
|
| 547 |
+
|
| 548 |
+
id_messageDigest = _buildOid(1, 2, 840, 113549, 1, 9, 4)
|
| 549 |
+
|
| 550 |
+
id_signedData = _buildOid(1, 2, 840, 113549, 1, 7, 2)
|
| 551 |
+
|
| 552 |
+
|
| 553 |
+
class MessageAuthenticationCodeAlgorithm(rfc5280.AlgorithmIdentifier):
|
| 554 |
+
pass
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
class UnsignedAttributes(univ.SetOf):
|
| 558 |
+
pass
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
UnsignedAttributes.componentType = Attribute()
|
| 562 |
+
UnsignedAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
class SignerIdentifier(univ.Choice):
|
| 566 |
+
pass
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
SignerIdentifier.componentType = namedtype.NamedTypes(
|
| 570 |
+
namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
|
| 571 |
+
namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
|
| 572 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 573 |
+
)
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
class SignerInfo(univ.Sequence):
|
| 577 |
+
pass
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
SignerInfo.componentType = namedtype.NamedTypes(
|
| 581 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 582 |
+
namedtype.NamedType('sid', SignerIdentifier()),
|
| 583 |
+
namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
|
| 584 |
+
namedtype.OptionalNamedType('signedAttrs', SignedAttributes().subtype(
|
| 585 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 586 |
+
namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
|
| 587 |
+
namedtype.NamedType('signature', SignatureValue()),
|
| 588 |
+
namedtype.OptionalNamedType('unsignedAttrs', UnsignedAttributes().subtype(
|
| 589 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 590 |
+
)
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
class SignerInfos(univ.SetOf):
|
| 594 |
+
pass
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
SignerInfos.componentType = SignerInfo()
|
| 598 |
+
|
| 599 |
+
|
| 600 |
+
class Countersignature(SignerInfo):
|
| 601 |
+
pass
|
| 602 |
+
|
| 603 |
+
|
| 604 |
+
class ContentInfo(univ.Sequence):
|
| 605 |
+
pass
|
| 606 |
+
|
| 607 |
+
|
| 608 |
+
ContentInfo.componentType = namedtype.NamedTypes(
|
| 609 |
+
namedtype.NamedType('contentType', ContentType()),
|
| 610 |
+
namedtype.NamedType('content', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)),
|
| 611 |
+
openType=opentype.OpenType('contentType', cmsContentTypesMap)
|
| 612 |
+
)
|
| 613 |
+
)
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
class EncapsulatedContentInfo(univ.Sequence):
|
| 617 |
+
pass
|
| 618 |
+
|
| 619 |
+
|
| 620 |
+
EncapsulatedContentInfo.componentType = namedtype.NamedTypes(
|
| 621 |
+
namedtype.NamedType('eContentType', ContentType()),
|
| 622 |
+
namedtype.OptionalNamedType('eContent', univ.OctetString().subtype(
|
| 623 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 624 |
+
)
|
| 625 |
+
|
| 626 |
+
id_countersignature = _buildOid(1, 2, 840, 113549, 1, 9, 6)
|
| 627 |
+
|
| 628 |
+
id_data = _buildOid(1, 2, 840, 113549, 1, 7, 1)
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
class MessageDigest(univ.OctetString):
|
| 632 |
+
pass
|
| 633 |
+
|
| 634 |
+
|
| 635 |
+
class AuthAttributes(univ.SetOf):
|
| 636 |
+
pass
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
AuthAttributes.componentType = Attribute()
|
| 640 |
+
AuthAttributes.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
class Time(univ.Choice):
|
| 644 |
+
pass
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
Time.componentType = namedtype.NamedTypes(
|
| 648 |
+
namedtype.NamedType('utcTime', useful.UTCTime()),
|
| 649 |
+
namedtype.NamedType('generalTime', useful.GeneralizedTime())
|
| 650 |
+
)
|
| 651 |
+
|
| 652 |
+
|
| 653 |
+
class AuthenticatedData(univ.Sequence):
|
| 654 |
+
pass
|
| 655 |
+
|
| 656 |
+
|
| 657 |
+
AuthenticatedData.componentType = namedtype.NamedTypes(
|
| 658 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 659 |
+
namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
|
| 660 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 661 |
+
namedtype.NamedType('recipientInfos', RecipientInfos()),
|
| 662 |
+
namedtype.NamedType('macAlgorithm', MessageAuthenticationCodeAlgorithm()),
|
| 663 |
+
namedtype.OptionalNamedType('digestAlgorithm', DigestAlgorithmIdentifier().subtype(
|
| 664 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 665 |
+
namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
|
| 666 |
+
namedtype.OptionalNamedType('authAttrs', AuthAttributes().subtype(
|
| 667 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 668 |
+
namedtype.NamedType('mac', MessageAuthenticationCode()),
|
| 669 |
+
namedtype.OptionalNamedType('unauthAttrs', UnauthAttributes().subtype(
|
| 670 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 671 |
+
)
|
| 672 |
+
|
| 673 |
+
id_contentType = _buildOid(1, 2, 840, 113549, 1, 9, 3)
|
| 674 |
+
|
| 675 |
+
|
| 676 |
+
class ExtendedCertificateOrCertificate(univ.Choice):
|
| 677 |
+
pass
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
ExtendedCertificateOrCertificate.componentType = namedtype.NamedTypes(
|
| 681 |
+
namedtype.NamedType('certificate', rfc5280.Certificate()),
|
| 682 |
+
namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
|
| 683 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 684 |
+
)
|
| 685 |
+
|
| 686 |
+
|
| 687 |
+
class Digest(univ.OctetString):
|
| 688 |
+
pass
|
| 689 |
+
|
| 690 |
+
|
| 691 |
+
class DigestedData(univ.Sequence):
|
| 692 |
+
pass
|
| 693 |
+
|
| 694 |
+
|
| 695 |
+
DigestedData.componentType = namedtype.NamedTypes(
|
| 696 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 697 |
+
namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
|
| 698 |
+
namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
|
| 699 |
+
namedtype.NamedType('digest', Digest())
|
| 700 |
+
)
|
| 701 |
+
|
| 702 |
+
id_envelopedData = _buildOid(1, 2, 840, 113549, 1, 7, 3)
|
| 703 |
+
|
| 704 |
+
|
| 705 |
+
class DigestAlgorithmIdentifiers(univ.SetOf):
|
| 706 |
+
pass
|
| 707 |
+
|
| 708 |
+
|
| 709 |
+
DigestAlgorithmIdentifiers.componentType = DigestAlgorithmIdentifier()
|
| 710 |
+
|
| 711 |
+
|
| 712 |
+
class SignedData(univ.Sequence):
|
| 713 |
+
pass
|
| 714 |
+
|
| 715 |
+
|
| 716 |
+
SignedData.componentType = namedtype.NamedTypes(
|
| 717 |
+
namedtype.NamedType('version', CMSVersion()),
|
| 718 |
+
namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
|
| 719 |
+
namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
|
| 720 |
+
namedtype.OptionalNamedType('certificates', CertificateSet().subtype(
|
| 721 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 722 |
+
namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
|
| 723 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 724 |
+
namedtype.NamedType('signerInfos', SignerInfos())
|
| 725 |
+
)
|
| 726 |
+
|
| 727 |
+
id_signingTime = _buildOid(1, 2, 840, 113549, 1, 9, 5)
|
| 728 |
+
|
| 729 |
+
|
| 730 |
+
class SigningTime(Time):
|
| 731 |
+
pass
|
| 732 |
+
|
| 733 |
+
|
| 734 |
+
id_ct_authData = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 2)
|
| 735 |
+
|
| 736 |
+
|
| 737 |
+
# CMS Content Type Map
|
| 738 |
+
|
| 739 |
+
_cmsContentTypesMapUpdate = {
|
| 740 |
+
id_ct_contentInfo: ContentInfo(),
|
| 741 |
+
id_data: univ.OctetString(),
|
| 742 |
+
id_signedData: SignedData(),
|
| 743 |
+
id_envelopedData: EnvelopedData(),
|
| 744 |
+
id_digestedData: DigestedData(),
|
| 745 |
+
id_encryptedData: EncryptedData(),
|
| 746 |
+
id_ct_authData: AuthenticatedData(),
|
| 747 |
+
}
|
| 748 |
+
|
| 749 |
+
cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
| 750 |
+
|
| 751 |
+
|
| 752 |
+
# CMS Attribute Map
|
| 753 |
+
|
| 754 |
+
_cmsAttributesMapUpdate = {
|
| 755 |
+
id_contentType: ContentType(),
|
| 756 |
+
id_messageDigest: MessageDigest(),
|
| 757 |
+
id_signingTime: SigningTime(),
|
| 758 |
+
id_countersignature: Countersignature(),
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5753.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Elliptic Curve Cryptography (ECC) Algorithms in the CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5753.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
|
| 16 |
+
|
| 17 |
+
from pyasn1_modules import rfc5280
|
| 18 |
+
from pyasn1_modules import rfc5480
|
| 19 |
+
from pyasn1_modules import rfc5652
|
| 20 |
+
from pyasn1_modules import rfc5751
|
| 21 |
+
from pyasn1_modules import rfc8018
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Imports from RFC 5280
|
| 25 |
+
|
| 26 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Imports from RFC 5652
|
| 30 |
+
|
| 31 |
+
OriginatorPublicKey = rfc5652.OriginatorPublicKey
|
| 32 |
+
|
| 33 |
+
UserKeyingMaterial = rfc5652.UserKeyingMaterial
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# Imports from RFC 5480
|
| 37 |
+
|
| 38 |
+
ECDSA_Sig_Value = rfc5480.ECDSA_Sig_Value
|
| 39 |
+
|
| 40 |
+
ECParameters = rfc5480.ECParameters
|
| 41 |
+
|
| 42 |
+
ECPoint = rfc5480.ECPoint
|
| 43 |
+
|
| 44 |
+
id_ecPublicKey = rfc5480.id_ecPublicKey
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# Imports from RFC 8018
|
| 48 |
+
|
| 49 |
+
id_hmacWithSHA224 = rfc8018.id_hmacWithSHA224
|
| 50 |
+
|
| 51 |
+
id_hmacWithSHA256 = rfc8018.id_hmacWithSHA256
|
| 52 |
+
|
| 53 |
+
id_hmacWithSHA384 = rfc8018.id_hmacWithSHA384
|
| 54 |
+
|
| 55 |
+
id_hmacWithSHA512 = rfc8018.id_hmacWithSHA512
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# Object Identifier arcs
|
| 59 |
+
|
| 60 |
+
x9_63_scheme = univ.ObjectIdentifier('1.3.133.16.840.63.0')
|
| 61 |
+
|
| 62 |
+
secg_scheme = univ.ObjectIdentifier('1.3.132.1')
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# Object Identifiers for the algorithms
|
| 66 |
+
|
| 67 |
+
dhSinglePass_cofactorDH_sha1kdf_scheme = x9_63_scheme + (3, )
|
| 68 |
+
|
| 69 |
+
dhSinglePass_cofactorDH_sha224kdf_scheme = secg_scheme + (14, 0, )
|
| 70 |
+
|
| 71 |
+
dhSinglePass_cofactorDH_sha256kdf_scheme = secg_scheme + (14, 1, )
|
| 72 |
+
|
| 73 |
+
dhSinglePass_cofactorDH_sha384kdf_scheme = secg_scheme + (14, 2, )
|
| 74 |
+
|
| 75 |
+
dhSinglePass_cofactorDH_sha512kdf_scheme = secg_scheme + (14, 3, )
|
| 76 |
+
|
| 77 |
+
dhSinglePass_stdDH_sha1kdf_scheme = x9_63_scheme + (2, )
|
| 78 |
+
|
| 79 |
+
dhSinglePass_stdDH_sha224kdf_scheme = secg_scheme + (11, 0, )
|
| 80 |
+
|
| 81 |
+
dhSinglePass_stdDH_sha256kdf_scheme = secg_scheme + (11, 1, )
|
| 82 |
+
|
| 83 |
+
dhSinglePass_stdDH_sha384kdf_scheme = secg_scheme + (11, 2, )
|
| 84 |
+
|
| 85 |
+
dhSinglePass_stdDH_sha512kdf_scheme = secg_scheme + (11, 3, )
|
| 86 |
+
|
| 87 |
+
mqvSinglePass_sha1kdf_scheme = x9_63_scheme + (16, )
|
| 88 |
+
|
| 89 |
+
mqvSinglePass_sha224kdf_scheme = secg_scheme + (15, 0, )
|
| 90 |
+
|
| 91 |
+
mqvSinglePass_sha256kdf_scheme = secg_scheme + (15, 1, )
|
| 92 |
+
|
| 93 |
+
mqvSinglePass_sha384kdf_scheme = secg_scheme + (15, 2, )
|
| 94 |
+
|
| 95 |
+
mqvSinglePass_sha512kdf_scheme = secg_scheme + (15, 3, )
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
# Structures for parameters and key derivation
|
| 99 |
+
|
| 100 |
+
class IV(univ.OctetString):
|
| 101 |
+
# Exactly 8 octets
|
| 102 |
+
pass
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class CBCParameter(IV):
|
| 106 |
+
pass
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class KeyWrapAlgorithm(AlgorithmIdentifier):
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class ECC_CMS_SharedInfo(univ.Sequence):
|
| 114 |
+
componentType = namedtype.NamedTypes(
|
| 115 |
+
namedtype.NamedType('keyInfo', KeyWrapAlgorithm()),
|
| 116 |
+
namedtype.OptionalNamedType('entityUInfo',
|
| 117 |
+
univ.OctetString().subtype(explicitTag=tag.Tag(
|
| 118 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 119 |
+
namedtype.NamedType('suppPubInfo',
|
| 120 |
+
univ.OctetString().subtype(explicitTag=tag.Tag(
|
| 121 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class MQVuserKeyingMaterial(univ.Sequence):
|
| 126 |
+
componentType = namedtype.NamedTypes(
|
| 127 |
+
namedtype.NamedType('ephemeralPublicKey', OriginatorPublicKey()),
|
| 128 |
+
namedtype.OptionalNamedType('addedukm',
|
| 129 |
+
UserKeyingMaterial().subtype(explicitTag=tag.Tag(
|
| 130 |
+
tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
# Update the Algorithm Identifier map in rfc5280.py and
|
| 135 |
+
# Update the SMIMECapabilities Attribute Map in rfc5751.py
|
| 136 |
+
|
| 137 |
+
_algorithmIdentifierMapUpdate = {
|
| 138 |
+
dhSinglePass_stdDH_sha1kdf_scheme: KeyWrapAlgorithm(),
|
| 139 |
+
dhSinglePass_stdDH_sha224kdf_scheme: KeyWrapAlgorithm(),
|
| 140 |
+
dhSinglePass_stdDH_sha256kdf_scheme: KeyWrapAlgorithm(),
|
| 141 |
+
dhSinglePass_stdDH_sha384kdf_scheme: KeyWrapAlgorithm(),
|
| 142 |
+
dhSinglePass_stdDH_sha512kdf_scheme: KeyWrapAlgorithm(),
|
| 143 |
+
dhSinglePass_cofactorDH_sha1kdf_scheme: KeyWrapAlgorithm(),
|
| 144 |
+
dhSinglePass_cofactorDH_sha224kdf_scheme: KeyWrapAlgorithm(),
|
| 145 |
+
dhSinglePass_cofactorDH_sha256kdf_scheme: KeyWrapAlgorithm(),
|
| 146 |
+
dhSinglePass_cofactorDH_sha384kdf_scheme: KeyWrapAlgorithm(),
|
| 147 |
+
dhSinglePass_cofactorDH_sha512kdf_scheme: KeyWrapAlgorithm(),
|
| 148 |
+
mqvSinglePass_sha1kdf_scheme: KeyWrapAlgorithm(),
|
| 149 |
+
mqvSinglePass_sha224kdf_scheme: KeyWrapAlgorithm(),
|
| 150 |
+
mqvSinglePass_sha256kdf_scheme: KeyWrapAlgorithm(),
|
| 151 |
+
mqvSinglePass_sha384kdf_scheme: KeyWrapAlgorithm(),
|
| 152 |
+
mqvSinglePass_sha512kdf_scheme: KeyWrapAlgorithm(),
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
| 156 |
+
|
| 157 |
+
rfc5751.smimeCapabilityMap.update(_algorithmIdentifierMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5913.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Authority Clearance Constraints Certificate Extension
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5913.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid5890
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
from pyasn1_modules import rfc5755
|
| 21 |
+
|
| 22 |
+
MAX = float('inf')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Authority Clearance Constraints Certificate Extension
|
| 26 |
+
|
| 27 |
+
id_pe_clearanceConstraints = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.21')
|
| 28 |
+
|
| 29 |
+
id_pe_authorityClearanceConstraints = id_pe_clearanceConstraints
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class AuthorityClearanceConstraints(univ.SequenceOf):
|
| 33 |
+
componentType = rfc5755.Clearance()
|
| 34 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Map of Certificate Extension OIDs to Extensions added to the
|
| 38 |
+
# ones that are in rfc5280.py
|
| 39 |
+
|
| 40 |
+
_certificateExtensionsMapUpdate = {
|
| 41 |
+
id_pe_clearanceConstraints: AuthorityClearanceConstraints(),
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5916.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Device Owner Attribute
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5916.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
from pyasn1_modules import rfc5280
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Device Owner Attribute
|
| 21 |
+
|
| 22 |
+
id_deviceOwner = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 69))
|
| 23 |
+
|
| 24 |
+
at_deviceOwner = rfc5280.Attribute()
|
| 25 |
+
at_deviceOwner['type'] = id_deviceOwner
|
| 26 |
+
at_deviceOwner['values'][0] = univ.ObjectIdentifier()
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Add to the map of Attribute Type OIDs to Attributes in rfc5280.py.
|
| 30 |
+
|
| 31 |
+
_certificateAttributesMapUpdate = {
|
| 32 |
+
id_deviceOwner: univ.ObjectIdentifier(),
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5917.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Clearance Sponsor Attribute
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5917.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid4558
|
| 14 |
+
# https://www.rfc-editor.org/errata/eid5883
|
| 15 |
+
#
|
| 16 |
+
|
| 17 |
+
from pyasn1.type import char
|
| 18 |
+
from pyasn1.type import constraint
|
| 19 |
+
from pyasn1.type import namedtype
|
| 20 |
+
from pyasn1.type import univ
|
| 21 |
+
|
| 22 |
+
from pyasn1_modules import rfc5280
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# DirectoryString is the same as RFC 5280, except for two things:
|
| 26 |
+
# 1. the length is limited to 64;
|
| 27 |
+
# 2. only the 'utf8String' choice remains because the ASN.1
|
| 28 |
+
# specification says: ( WITH COMPONENTS { utf8String PRESENT } )
|
| 29 |
+
|
| 30 |
+
class DirectoryString(univ.Choice):
|
| 31 |
+
componentType = namedtype.NamedTypes(
|
| 32 |
+
namedtype.NamedType('utf8String', char.UTF8String().subtype(
|
| 33 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, 64))),
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Clearance Sponsor Attribute
|
| 38 |
+
|
| 39 |
+
id_clearanceSponsor = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 68))
|
| 40 |
+
|
| 41 |
+
ub_clearance_sponsor = univ.Integer(64)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
at_clearanceSponsor = rfc5280.Attribute()
|
| 45 |
+
at_clearanceSponsor['type'] = id_clearanceSponsor
|
| 46 |
+
at_clearanceSponsor['values'][0] = DirectoryString()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# Add to the map of Attribute Type OIDs to Attributes in rfc5280.py.
|
| 50 |
+
|
| 51 |
+
_certificateAttributesMapUpdate = {
|
| 52 |
+
id_clearanceSponsor: DirectoryString(),
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5924.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Extended Key Usage (EKU) for Session Initiation Protocol (SIP)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5924.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
|
| 18 |
+
|
| 19 |
+
id_kp_sipDomain = id_kp + (20, )
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5934.py
ADDED
|
@@ -0,0 +1,786 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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yasn1-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 |
+
# Trust Anchor Format
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5934.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
|
| 14 |
+
|
| 15 |
+
from pyasn1_modules import rfc2985
|
| 16 |
+
from pyasn1_modules import rfc5280
|
| 17 |
+
from pyasn1_modules import rfc5652
|
| 18 |
+
from pyasn1_modules import rfc5914
|
| 19 |
+
|
| 20 |
+
MAX = float('inf')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def _OID(*components):
|
| 24 |
+
output = []
|
| 25 |
+
for x in tuple(components):
|
| 26 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 27 |
+
output.extend(list(x))
|
| 28 |
+
else:
|
| 29 |
+
output.append(int(x))
|
| 30 |
+
return univ.ObjectIdentifier(output)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Imports from RFC 2985
|
| 34 |
+
|
| 35 |
+
SingleAttribute = rfc2985.SingleAttribute
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# Imports from RFC5914
|
| 39 |
+
|
| 40 |
+
CertPathControls = rfc5914.CertPathControls
|
| 41 |
+
|
| 42 |
+
TrustAnchorChoice = rfc5914.TrustAnchorChoice
|
| 43 |
+
|
| 44 |
+
TrustAnchorTitle = rfc5914.TrustAnchorTitle
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# Imports from RFC 5280
|
| 48 |
+
|
| 49 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 50 |
+
|
| 51 |
+
AnotherName = rfc5280.AnotherName
|
| 52 |
+
|
| 53 |
+
Attribute = rfc5280.Attribute
|
| 54 |
+
|
| 55 |
+
Certificate = rfc5280.Certificate
|
| 56 |
+
|
| 57 |
+
CertificateSerialNumber = rfc5280.CertificateSerialNumber
|
| 58 |
+
|
| 59 |
+
Extension = rfc5280.Extension
|
| 60 |
+
|
| 61 |
+
Extensions = rfc5280.Extensions
|
| 62 |
+
|
| 63 |
+
KeyIdentifier = rfc5280.KeyIdentifier
|
| 64 |
+
|
| 65 |
+
Name = rfc5280.Name
|
| 66 |
+
|
| 67 |
+
SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
|
| 68 |
+
|
| 69 |
+
TBSCertificate = rfc5280.TBSCertificate
|
| 70 |
+
|
| 71 |
+
Validity = rfc5280.Validity
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
# Object Identifier Arc for TAMP Message Content Types
|
| 75 |
+
|
| 76 |
+
id_tamp = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.77')
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
# TAMP Status Query Message
|
| 80 |
+
|
| 81 |
+
id_ct_TAMP_statusQuery = _OID(id_tamp, 1)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class TAMPVersion(univ.Integer):
|
| 85 |
+
pass
|
| 86 |
+
|
| 87 |
+
TAMPVersion.namedValues = namedval.NamedValues(
|
| 88 |
+
('v1', 1),
|
| 89 |
+
('v2', 2)
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class TerseOrVerbose(univ.Enumerated):
|
| 94 |
+
pass
|
| 95 |
+
|
| 96 |
+
TerseOrVerbose.namedValues = namedval.NamedValues(
|
| 97 |
+
('terse', 1),
|
| 98 |
+
('verbose', 2)
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class HardwareSerialEntry(univ.Choice):
|
| 103 |
+
pass
|
| 104 |
+
|
| 105 |
+
HardwareSerialEntry.componentType = namedtype.NamedTypes(
|
| 106 |
+
namedtype.NamedType('all', univ.Null()),
|
| 107 |
+
namedtype.NamedType('single', univ.OctetString()),
|
| 108 |
+
namedtype.NamedType('block', univ.Sequence(componentType=namedtype.NamedTypes(
|
| 109 |
+
namedtype.NamedType('low', univ.OctetString()),
|
| 110 |
+
namedtype.NamedType('high', univ.OctetString())
|
| 111 |
+
))
|
| 112 |
+
)
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class HardwareModules(univ.Sequence):
|
| 117 |
+
pass
|
| 118 |
+
|
| 119 |
+
HardwareModules.componentType = namedtype.NamedTypes(
|
| 120 |
+
namedtype.NamedType('hwType', univ.ObjectIdentifier()),
|
| 121 |
+
namedtype.NamedType('hwSerialEntries', univ.SequenceOf(
|
| 122 |
+
componentType=HardwareSerialEntry()).subtype(
|
| 123 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
class HardwareModuleIdentifierList(univ.SequenceOf):
|
| 128 |
+
pass
|
| 129 |
+
|
| 130 |
+
HardwareModuleIdentifierList.componentType = HardwareModules()
|
| 131 |
+
HardwareModuleIdentifierList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
class Community(univ.ObjectIdentifier):
|
| 135 |
+
pass
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class CommunityIdentifierList(univ.SequenceOf):
|
| 139 |
+
pass
|
| 140 |
+
|
| 141 |
+
CommunityIdentifierList.componentType = Community()
|
| 142 |
+
CommunityIdentifierList.subtypeSpec=constraint.ValueSizeConstraint(0, MAX)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
class TargetIdentifier(univ.Choice):
|
| 146 |
+
pass
|
| 147 |
+
|
| 148 |
+
TargetIdentifier.componentType = namedtype.NamedTypes(
|
| 149 |
+
namedtype.NamedType('hwModules', HardwareModuleIdentifierList().subtype(
|
| 150 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 151 |
+
namedtype.NamedType('communities', CommunityIdentifierList().subtype(
|
| 152 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 153 |
+
namedtype.NamedType('allModules', univ.Null().subtype(
|
| 154 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 155 |
+
namedtype.NamedType('uri', char.IA5String().subtype(
|
| 156 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 157 |
+
namedtype.NamedType('otherName', AnotherName().subtype(
|
| 158 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)))
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class SeqNumber(univ.Integer):
|
| 163 |
+
pass
|
| 164 |
+
|
| 165 |
+
SeqNumber.subtypeSpec = constraint.ValueRangeConstraint(0, 9223372036854775807)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
class TAMPMsgRef(univ.Sequence):
|
| 169 |
+
pass
|
| 170 |
+
|
| 171 |
+
TAMPMsgRef.componentType = namedtype.NamedTypes(
|
| 172 |
+
namedtype.NamedType('target', TargetIdentifier()),
|
| 173 |
+
namedtype.NamedType('seqNum', SeqNumber())
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
class TAMPStatusQuery(univ.Sequence):
|
| 178 |
+
pass
|
| 179 |
+
|
| 180 |
+
TAMPStatusQuery.componentType = namedtype.NamedTypes(
|
| 181 |
+
namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
|
| 182 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 183 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 184 |
+
namedtype.DefaultedNamedType('terse', TerseOrVerbose().subtype(
|
| 185 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 186 |
+
tag.tagFormatSimple, 1)).subtype(value='verbose')),
|
| 187 |
+
namedtype.NamedType('query', TAMPMsgRef())
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
tamp_status_query = rfc5652.ContentInfo()
|
| 192 |
+
tamp_status_query['contentType'] = id_ct_TAMP_statusQuery
|
| 193 |
+
tamp_status_query['content'] = TAMPStatusQuery()
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
# TAMP Status Response Message
|
| 197 |
+
|
| 198 |
+
id_ct_TAMP_statusResponse = _OID(id_tamp, 2)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class KeyIdentifiers(univ.SequenceOf):
|
| 202 |
+
pass
|
| 203 |
+
|
| 204 |
+
KeyIdentifiers.componentType = KeyIdentifier()
|
| 205 |
+
KeyIdentifiers.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
class TrustAnchorChoiceList(univ.SequenceOf):
|
| 209 |
+
pass
|
| 210 |
+
|
| 211 |
+
TrustAnchorChoiceList.componentType = TrustAnchorChoice()
|
| 212 |
+
TrustAnchorChoiceList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class TAMPSequenceNumber(univ.Sequence):
|
| 216 |
+
pass
|
| 217 |
+
|
| 218 |
+
TAMPSequenceNumber.componentType = namedtype.NamedTypes(
|
| 219 |
+
namedtype.NamedType('keyId', KeyIdentifier()),
|
| 220 |
+
namedtype.NamedType('seqNumber', SeqNumber())
|
| 221 |
+
)
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class TAMPSequenceNumbers(univ.SequenceOf):
|
| 225 |
+
pass
|
| 226 |
+
|
| 227 |
+
TAMPSequenceNumbers.componentType = TAMPSequenceNumber()
|
| 228 |
+
TAMPSequenceNumbers.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
class TerseStatusResponse(univ.Sequence):
|
| 232 |
+
pass
|
| 233 |
+
|
| 234 |
+
TerseStatusResponse.componentType = namedtype.NamedTypes(
|
| 235 |
+
namedtype.NamedType('taKeyIds', KeyIdentifiers()),
|
| 236 |
+
namedtype.OptionalNamedType('communities', CommunityIdentifierList())
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class VerboseStatusResponse(univ.Sequence):
|
| 241 |
+
pass
|
| 242 |
+
|
| 243 |
+
VerboseStatusResponse.componentType = namedtype.NamedTypes(
|
| 244 |
+
namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
|
| 245 |
+
namedtype.OptionalNamedType('continPubKeyDecryptAlg',
|
| 246 |
+
AlgorithmIdentifier().subtype(implicitTag=tag.Tag(
|
| 247 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 248 |
+
namedtype.OptionalNamedType('communities',
|
| 249 |
+
CommunityIdentifierList().subtype(implicitTag=tag.Tag(
|
| 250 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 251 |
+
namedtype.OptionalNamedType('tampSeqNumbers',
|
| 252 |
+
TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(
|
| 253 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 254 |
+
)
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
class StatusResponse(univ.Choice):
|
| 258 |
+
pass
|
| 259 |
+
|
| 260 |
+
StatusResponse.componentType = namedtype.NamedTypes(
|
| 261 |
+
namedtype.NamedType('terseResponse', TerseStatusResponse().subtype(
|
| 262 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 263 |
+
namedtype.NamedType('verboseResponse', VerboseStatusResponse().subtype(
|
| 264 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
class TAMPStatusResponse(univ.Sequence):
|
| 269 |
+
pass
|
| 270 |
+
|
| 271 |
+
TAMPStatusResponse.componentType = namedtype.NamedTypes(
|
| 272 |
+
namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
|
| 273 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 274 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 275 |
+
namedtype.NamedType('query', TAMPMsgRef()),
|
| 276 |
+
namedtype.NamedType('response', StatusResponse()),
|
| 277 |
+
namedtype.DefaultedNamedType('usesApex', univ.Boolean().subtype(value=1))
|
| 278 |
+
)
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
tamp_status_response = rfc5652.ContentInfo()
|
| 282 |
+
tamp_status_response['contentType'] = id_ct_TAMP_statusResponse
|
| 283 |
+
tamp_status_response['content'] = TAMPStatusResponse()
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
# Trust Anchor Update Message
|
| 287 |
+
|
| 288 |
+
id_ct_TAMP_update = _OID(id_tamp, 3)
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
class TBSCertificateChangeInfo(univ.Sequence):
|
| 292 |
+
pass
|
| 293 |
+
|
| 294 |
+
TBSCertificateChangeInfo.componentType = namedtype.NamedTypes(
|
| 295 |
+
namedtype.OptionalNamedType('serialNumber', CertificateSerialNumber()),
|
| 296 |
+
namedtype.OptionalNamedType('signature', AlgorithmIdentifier().subtype(
|
| 297 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 298 |
+
namedtype.OptionalNamedType('issuer', Name().subtype(implicitTag=tag.Tag(
|
| 299 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 300 |
+
namedtype.OptionalNamedType('validity', Validity().subtype(
|
| 301 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 302 |
+
namedtype.OptionalNamedType('subject', Name().subtype(implicitTag=tag.Tag(
|
| 303 |
+
tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 304 |
+
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo().subtype(
|
| 305 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 306 |
+
namedtype.OptionalNamedType('exts', Extensions().subtype(explicitTag=tag.Tag(
|
| 307 |
+
tag.tagClassContext, tag.tagFormatSimple, 5)))
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
class TrustAnchorChangeInfo(univ.Sequence):
|
| 312 |
+
pass
|
| 313 |
+
|
| 314 |
+
TrustAnchorChangeInfo.componentType = namedtype.NamedTypes(
|
| 315 |
+
namedtype.NamedType('pubKey', SubjectPublicKeyInfo()),
|
| 316 |
+
namedtype.OptionalNamedType('keyId', KeyIdentifier()),
|
| 317 |
+
namedtype.OptionalNamedType('taTitle', TrustAnchorTitle()),
|
| 318 |
+
namedtype.OptionalNamedType('certPath', CertPathControls()),
|
| 319 |
+
namedtype.OptionalNamedType('exts', Extensions().subtype(
|
| 320 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
class TrustAnchorChangeInfoChoice(univ.Choice):
|
| 325 |
+
pass
|
| 326 |
+
|
| 327 |
+
TrustAnchorChangeInfoChoice.componentType = namedtype.NamedTypes(
|
| 328 |
+
namedtype.NamedType('tbsCertChange', TBSCertificateChangeInfo().subtype(
|
| 329 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 330 |
+
namedtype.NamedType('taChange', TrustAnchorChangeInfo().subtype(
|
| 331 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
class TrustAnchorUpdate(univ.Choice):
|
| 336 |
+
pass
|
| 337 |
+
|
| 338 |
+
TrustAnchorUpdate.componentType = namedtype.NamedTypes(
|
| 339 |
+
namedtype.NamedType('add', TrustAnchorChoice().subtype(
|
| 340 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 341 |
+
namedtype.NamedType('remove', SubjectPublicKeyInfo().subtype(
|
| 342 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 343 |
+
namedtype.NamedType('change', TrustAnchorChangeInfoChoice().subtype(
|
| 344 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 345 |
+
)
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
class TAMPUpdate(univ.Sequence):
|
| 349 |
+
pass
|
| 350 |
+
|
| 351 |
+
TAMPUpdate.componentType = namedtype.NamedTypes(
|
| 352 |
+
namedtype.DefaultedNamedType('version',
|
| 353 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 354 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 355 |
+
namedtype.DefaultedNamedType('terse',
|
| 356 |
+
TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 357 |
+
tag.tagFormatSimple, 1)).subtype(value='verbose')),
|
| 358 |
+
namedtype.NamedType('msgRef', TAMPMsgRef()),
|
| 359 |
+
namedtype.NamedType('updates',
|
| 360 |
+
univ.SequenceOf(componentType=TrustAnchorUpdate()).subtype(
|
| 361 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 362 |
+
namedtype.OptionalNamedType('tampSeqNumbers',
|
| 363 |
+
TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(
|
| 364 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 365 |
+
)
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
tamp_update = rfc5652.ContentInfo()
|
| 369 |
+
tamp_update['contentType'] = id_ct_TAMP_update
|
| 370 |
+
tamp_update['content'] = TAMPUpdate()
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
# Trust Anchor Update Confirm Message
|
| 374 |
+
|
| 375 |
+
id_ct_TAMP_updateConfirm = _OID(id_tamp, 4)
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
class StatusCode(univ.Enumerated):
|
| 379 |
+
pass
|
| 380 |
+
|
| 381 |
+
StatusCode.namedValues = namedval.NamedValues(
|
| 382 |
+
('success', 0),
|
| 383 |
+
('decodeFailure', 1),
|
| 384 |
+
('badContentInfo', 2),
|
| 385 |
+
('badSignedData', 3),
|
| 386 |
+
('badEncapContent', 4),
|
| 387 |
+
('badCertificate', 5),
|
| 388 |
+
('badSignerInfo', 6),
|
| 389 |
+
('badSignedAttrs', 7),
|
| 390 |
+
('badUnsignedAttrs', 8),
|
| 391 |
+
('missingContent', 9),
|
| 392 |
+
('noTrustAnchor', 10),
|
| 393 |
+
('notAuthorized', 11),
|
| 394 |
+
('badDigestAlgorithm', 12),
|
| 395 |
+
('badSignatureAlgorithm', 13),
|
| 396 |
+
('unsupportedKeySize', 14),
|
| 397 |
+
('unsupportedParameters', 15),
|
| 398 |
+
('signatureFailure', 16),
|
| 399 |
+
('insufficientMemory', 17),
|
| 400 |
+
('unsupportedTAMPMsgType', 18),
|
| 401 |
+
('apexTAMPAnchor', 19),
|
| 402 |
+
('improperTAAddition', 20),
|
| 403 |
+
('seqNumFailure', 21),
|
| 404 |
+
('contingencyPublicKeyDecrypt', 22),
|
| 405 |
+
('incorrectTarget', 23),
|
| 406 |
+
('communityUpdateFailed', 24),
|
| 407 |
+
('trustAnchorNotFound', 25),
|
| 408 |
+
('unsupportedTAAlgorithm', 26),
|
| 409 |
+
('unsupportedTAKeySize', 27),
|
| 410 |
+
('unsupportedContinPubKeyDecryptAlg', 28),
|
| 411 |
+
('missingSignature', 29),
|
| 412 |
+
('resourcesBusy', 30),
|
| 413 |
+
('versionNumberMismatch', 31),
|
| 414 |
+
('missingPolicySet', 32),
|
| 415 |
+
('revokedCertificate', 33),
|
| 416 |
+
('unsupportedTrustAnchorFormat', 34),
|
| 417 |
+
('improperTAChange', 35),
|
| 418 |
+
('malformed', 36),
|
| 419 |
+
('cmsError', 37),
|
| 420 |
+
('unsupportedTargetIdentifier', 38),
|
| 421 |
+
('other', 127)
|
| 422 |
+
)
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
class StatusCodeList(univ.SequenceOf):
|
| 426 |
+
pass
|
| 427 |
+
|
| 428 |
+
StatusCodeList.componentType = StatusCode()
|
| 429 |
+
StatusCodeList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
class TerseUpdateConfirm(StatusCodeList):
|
| 433 |
+
pass
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
class VerboseUpdateConfirm(univ.Sequence):
|
| 437 |
+
pass
|
| 438 |
+
|
| 439 |
+
VerboseUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 440 |
+
namedtype.NamedType('status', StatusCodeList()),
|
| 441 |
+
namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
|
| 442 |
+
namedtype.OptionalNamedType('tampSeqNumbers', TAMPSequenceNumbers()),
|
| 443 |
+
namedtype.DefaultedNamedType('usesApex', univ.Boolean().subtype(value=1))
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
class UpdateConfirm(univ.Choice):
|
| 448 |
+
pass
|
| 449 |
+
|
| 450 |
+
UpdateConfirm.componentType = namedtype.NamedTypes(
|
| 451 |
+
namedtype.NamedType('terseConfirm', TerseUpdateConfirm().subtype(
|
| 452 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 453 |
+
namedtype.NamedType('verboseConfirm', VerboseUpdateConfirm().subtype(
|
| 454 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 455 |
+
)
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
class TAMPUpdateConfirm(univ.Sequence):
|
| 459 |
+
pass
|
| 460 |
+
|
| 461 |
+
TAMPUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 462 |
+
namedtype.DefaultedNamedType('version', TAMPVersion().subtype(
|
| 463 |
+
implicitTag=tag.Tag(tag.tagClassContext,
|
| 464 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 465 |
+
namedtype.NamedType('update', TAMPMsgRef()),
|
| 466 |
+
namedtype.NamedType('confirm', UpdateConfirm())
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
tamp_update_confirm = rfc5652.ContentInfo()
|
| 471 |
+
tamp_update_confirm['contentType'] = id_ct_TAMP_updateConfirm
|
| 472 |
+
tamp_update_confirm['content'] = TAMPUpdateConfirm()
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
# Apex Trust Anchor Update Message
|
| 476 |
+
|
| 477 |
+
id_ct_TAMP_apexUpdate = _OID(id_tamp, 5)
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
class TAMPApexUpdate(univ.Sequence):
|
| 481 |
+
pass
|
| 482 |
+
|
| 483 |
+
TAMPApexUpdate.componentType = namedtype.NamedTypes(
|
| 484 |
+
namedtype.DefaultedNamedType('version',
|
| 485 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 486 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 487 |
+
namedtype.DefaultedNamedType('terse',
|
| 488 |
+
TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 489 |
+
tag.tagFormatSimple, 1)).subtype(value='verbose')),
|
| 490 |
+
namedtype.NamedType('msgRef', TAMPMsgRef()),
|
| 491 |
+
namedtype.NamedType('clearTrustAnchors', univ.Boolean()),
|
| 492 |
+
namedtype.NamedType('clearCommunities', univ.Boolean()),
|
| 493 |
+
namedtype.OptionalNamedType('seqNumber', SeqNumber()),
|
| 494 |
+
namedtype.NamedType('apexTA', TrustAnchorChoice())
|
| 495 |
+
)
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
tamp_apex_update = rfc5652.ContentInfo()
|
| 499 |
+
tamp_apex_update['contentType'] = id_ct_TAMP_apexUpdate
|
| 500 |
+
tamp_apex_update['content'] = TAMPApexUpdate()
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
# Apex Trust Anchor Update Confirm Message
|
| 504 |
+
|
| 505 |
+
id_ct_TAMP_apexUpdateConfirm = _OID(id_tamp, 6)
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
class TerseApexUpdateConfirm(StatusCode):
|
| 509 |
+
pass
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
class VerboseApexUpdateConfirm(univ.Sequence):
|
| 513 |
+
pass
|
| 514 |
+
|
| 515 |
+
VerboseApexUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 516 |
+
namedtype.NamedType('status', StatusCode()),
|
| 517 |
+
namedtype.NamedType('taInfo', TrustAnchorChoiceList()),
|
| 518 |
+
namedtype.OptionalNamedType('communities',
|
| 519 |
+
CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 520 |
+
tag.tagFormatSimple, 0))),
|
| 521 |
+
namedtype.OptionalNamedType('tampSeqNumbers',
|
| 522 |
+
TAMPSequenceNumbers().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 523 |
+
tag.tagFormatSimple, 1)))
|
| 524 |
+
)
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
class ApexUpdateConfirm(univ.Choice):
|
| 528 |
+
pass
|
| 529 |
+
|
| 530 |
+
ApexUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 531 |
+
namedtype.NamedType('terseApexConfirm',
|
| 532 |
+
TerseApexUpdateConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 533 |
+
tag.tagFormatSimple, 0))),
|
| 534 |
+
namedtype.NamedType('verboseApexConfirm',
|
| 535 |
+
VerboseApexUpdateConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 536 |
+
tag.tagFormatConstructed, 1)))
|
| 537 |
+
)
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
class TAMPApexUpdateConfirm(univ.Sequence):
|
| 541 |
+
pass
|
| 542 |
+
|
| 543 |
+
TAMPApexUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 544 |
+
namedtype.DefaultedNamedType('version',
|
| 545 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 546 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 547 |
+
namedtype.NamedType('apexReplace', TAMPMsgRef()),
|
| 548 |
+
namedtype.NamedType('apexConfirm', ApexUpdateConfirm())
|
| 549 |
+
)
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
tamp_apex_update_confirm = rfc5652.ContentInfo()
|
| 553 |
+
tamp_apex_update_confirm['contentType'] = id_ct_TAMP_apexUpdateConfirm
|
| 554 |
+
tamp_apex_update_confirm['content'] = TAMPApexUpdateConfirm()
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
# Community Update Message
|
| 558 |
+
|
| 559 |
+
id_ct_TAMP_communityUpdate = _OID(id_tamp, 7)
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
class CommunityUpdates(univ.Sequence):
|
| 563 |
+
pass
|
| 564 |
+
|
| 565 |
+
CommunityUpdates.componentType = namedtype.NamedTypes(
|
| 566 |
+
namedtype.OptionalNamedType('remove',
|
| 567 |
+
CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 568 |
+
tag.tagFormatSimple, 1))),
|
| 569 |
+
namedtype.OptionalNamedType('add',
|
| 570 |
+
CommunityIdentifierList().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 571 |
+
tag.tagFormatSimple, 2)))
|
| 572 |
+
)
|
| 573 |
+
|
| 574 |
+
|
| 575 |
+
class TAMPCommunityUpdate(univ.Sequence):
|
| 576 |
+
pass
|
| 577 |
+
|
| 578 |
+
TAMPCommunityUpdate.componentType = namedtype.NamedTypes(
|
| 579 |
+
namedtype.DefaultedNamedType('version',
|
| 580 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 581 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 582 |
+
namedtype.DefaultedNamedType('terse',
|
| 583 |
+
TerseOrVerbose().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 584 |
+
tag.tagFormatSimple, 1)).subtype(value='verbose')),
|
| 585 |
+
namedtype.NamedType('msgRef', TAMPMsgRef()),
|
| 586 |
+
namedtype.NamedType('updates', CommunityUpdates())
|
| 587 |
+
)
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
tamp_community_update = rfc5652.ContentInfo()
|
| 591 |
+
tamp_community_update['contentType'] = id_ct_TAMP_communityUpdate
|
| 592 |
+
tamp_community_update['content'] = TAMPCommunityUpdate()
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
# Community Update Confirm Message
|
| 596 |
+
|
| 597 |
+
id_ct_TAMP_communityUpdateConfirm = _OID(id_tamp, 8)
|
| 598 |
+
|
| 599 |
+
|
| 600 |
+
class TerseCommunityConfirm(StatusCode):
|
| 601 |
+
pass
|
| 602 |
+
|
| 603 |
+
|
| 604 |
+
class VerboseCommunityConfirm(univ.Sequence):
|
| 605 |
+
pass
|
| 606 |
+
|
| 607 |
+
VerboseCommunityConfirm.componentType = namedtype.NamedTypes(
|
| 608 |
+
namedtype.NamedType('status', StatusCode()),
|
| 609 |
+
namedtype.OptionalNamedType('communities', CommunityIdentifierList())
|
| 610 |
+
)
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
class CommunityConfirm(univ.Choice):
|
| 614 |
+
pass
|
| 615 |
+
|
| 616 |
+
CommunityConfirm.componentType = namedtype.NamedTypes(
|
| 617 |
+
namedtype.NamedType('terseCommConfirm',
|
| 618 |
+
TerseCommunityConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 619 |
+
tag.tagFormatSimple, 0))),
|
| 620 |
+
namedtype.NamedType('verboseCommConfirm',
|
| 621 |
+
VerboseCommunityConfirm().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 622 |
+
tag.tagFormatConstructed, 1)))
|
| 623 |
+
)
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
class TAMPCommunityUpdateConfirm(univ.Sequence):
|
| 627 |
+
pass
|
| 628 |
+
|
| 629 |
+
TAMPCommunityUpdateConfirm.componentType = namedtype.NamedTypes(
|
| 630 |
+
namedtype.DefaultedNamedType('version',
|
| 631 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 632 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 633 |
+
namedtype.NamedType('update', TAMPMsgRef()),
|
| 634 |
+
namedtype.NamedType('commConfirm', CommunityConfirm())
|
| 635 |
+
)
|
| 636 |
+
|
| 637 |
+
|
| 638 |
+
tamp_community_update_confirm = rfc5652.ContentInfo()
|
| 639 |
+
tamp_community_update_confirm['contentType'] = id_ct_TAMP_communityUpdateConfirm
|
| 640 |
+
tamp_community_update_confirm['content'] = TAMPCommunityUpdateConfirm()
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
# Sequence Number Adjust Message
|
| 644 |
+
|
| 645 |
+
id_ct_TAMP_seqNumAdjust = _OID(id_tamp, 10)
|
| 646 |
+
|
| 647 |
+
|
| 648 |
+
|
| 649 |
+
class SequenceNumberAdjust(univ.Sequence):
|
| 650 |
+
pass
|
| 651 |
+
|
| 652 |
+
SequenceNumberAdjust.componentType = namedtype.NamedTypes(
|
| 653 |
+
namedtype.DefaultedNamedType('version',
|
| 654 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 655 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 656 |
+
namedtype.NamedType('msgRef', TAMPMsgRef())
|
| 657 |
+
)
|
| 658 |
+
|
| 659 |
+
|
| 660 |
+
tamp_sequence_number_adjust = rfc5652.ContentInfo()
|
| 661 |
+
tamp_sequence_number_adjust['contentType'] = id_ct_TAMP_seqNumAdjust
|
| 662 |
+
tamp_sequence_number_adjust['content'] = SequenceNumberAdjust()
|
| 663 |
+
|
| 664 |
+
|
| 665 |
+
# Sequence Number Adjust Confirm Message
|
| 666 |
+
|
| 667 |
+
id_ct_TAMP_seqNumAdjustConfirm = _OID(id_tamp, 11)
|
| 668 |
+
|
| 669 |
+
|
| 670 |
+
class SequenceNumberAdjustConfirm(univ.Sequence):
|
| 671 |
+
pass
|
| 672 |
+
|
| 673 |
+
SequenceNumberAdjustConfirm.componentType = namedtype.NamedTypes(
|
| 674 |
+
namedtype.DefaultedNamedType('version',
|
| 675 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 676 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 677 |
+
namedtype.NamedType('adjust', TAMPMsgRef()),
|
| 678 |
+
namedtype.NamedType('status', StatusCode())
|
| 679 |
+
)
|
| 680 |
+
|
| 681 |
+
|
| 682 |
+
tamp_sequence_number_adjust_confirm = rfc5652.ContentInfo()
|
| 683 |
+
tamp_sequence_number_adjust_confirm['contentType'] = id_ct_TAMP_seqNumAdjustConfirm
|
| 684 |
+
tamp_sequence_number_adjust_confirm['content'] = SequenceNumberAdjustConfirm()
|
| 685 |
+
|
| 686 |
+
|
| 687 |
+
# TAMP Error Message
|
| 688 |
+
|
| 689 |
+
id_ct_TAMP_error = _OID(id_tamp, 9)
|
| 690 |
+
|
| 691 |
+
|
| 692 |
+
class TAMPError(univ.Sequence):
|
| 693 |
+
pass
|
| 694 |
+
|
| 695 |
+
TAMPError.componentType = namedtype.NamedTypes(
|
| 696 |
+
namedtype.DefaultedNamedType('version',
|
| 697 |
+
TAMPVersion().subtype(implicitTag=tag.Tag(tag.tagClassContext,
|
| 698 |
+
tag.tagFormatSimple, 0)).subtype(value='v2')),
|
| 699 |
+
namedtype.NamedType('msgType', univ.ObjectIdentifier()),
|
| 700 |
+
namedtype.NamedType('status', StatusCode()),
|
| 701 |
+
namedtype.OptionalNamedType('msgRef', TAMPMsgRef())
|
| 702 |
+
)
|
| 703 |
+
|
| 704 |
+
|
| 705 |
+
tamp_error = rfc5652.ContentInfo()
|
| 706 |
+
tamp_error['contentType'] = id_ct_TAMP_error
|
| 707 |
+
tamp_error['content'] = TAMPError()
|
| 708 |
+
|
| 709 |
+
|
| 710 |
+
# Object Identifier Arc for Attributes
|
| 711 |
+
|
| 712 |
+
id_attributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.5')
|
| 713 |
+
|
| 714 |
+
|
| 715 |
+
# contingency-public-key-decrypt-key unsigned attribute
|
| 716 |
+
|
| 717 |
+
id_aa_TAMP_contingencyPublicKeyDecryptKey = _OID(id_attributes, 63)
|
| 718 |
+
|
| 719 |
+
|
| 720 |
+
class PlaintextSymmetricKey(univ.OctetString):
|
| 721 |
+
pass
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
contingency_public_key_decrypt_key = Attribute()
|
| 725 |
+
contingency_public_key_decrypt_key['type'] = id_aa_TAMP_contingencyPublicKeyDecryptKey
|
| 726 |
+
contingency_public_key_decrypt_key['values'][0] = PlaintextSymmetricKey()
|
| 727 |
+
|
| 728 |
+
|
| 729 |
+
# id-pe-wrappedApexContinKey extension
|
| 730 |
+
|
| 731 |
+
id_pe_wrappedApexContinKey =univ.ObjectIdentifier('1.3.6.1.5.5.7.1.20')
|
| 732 |
+
|
| 733 |
+
|
| 734 |
+
class ApexContingencyKey(univ.Sequence):
|
| 735 |
+
pass
|
| 736 |
+
|
| 737 |
+
ApexContingencyKey.componentType = namedtype.NamedTypes(
|
| 738 |
+
namedtype.NamedType('wrapAlgorithm', AlgorithmIdentifier()),
|
| 739 |
+
namedtype.NamedType('wrappedContinPubKey', univ.OctetString())
|
| 740 |
+
)
|
| 741 |
+
|
| 742 |
+
|
| 743 |
+
wrappedApexContinKey = Extension()
|
| 744 |
+
wrappedApexContinKey['extnID'] = id_pe_wrappedApexContinKey
|
| 745 |
+
wrappedApexContinKey['critical'] = 0
|
| 746 |
+
wrappedApexContinKey['extnValue'] = univ.OctetString()
|
| 747 |
+
|
| 748 |
+
|
| 749 |
+
# Add to the map of CMS Content Type OIDs to Content Types in
|
| 750 |
+
# rfc5652.py
|
| 751 |
+
|
| 752 |
+
_cmsContentTypesMapUpdate = {
|
| 753 |
+
id_ct_TAMP_statusQuery: TAMPStatusQuery(),
|
| 754 |
+
id_ct_TAMP_statusResponse: TAMPStatusResponse(),
|
| 755 |
+
id_ct_TAMP_update: TAMPUpdate(),
|
| 756 |
+
id_ct_TAMP_updateConfirm: TAMPUpdateConfirm(),
|
| 757 |
+
id_ct_TAMP_apexUpdate: TAMPApexUpdate(),
|
| 758 |
+
id_ct_TAMP_apexUpdateConfirm: TAMPApexUpdateConfirm(),
|
| 759 |
+
id_ct_TAMP_communityUpdate: TAMPCommunityUpdate(),
|
| 760 |
+
id_ct_TAMP_communityUpdateConfirm: TAMPCommunityUpdateConfirm(),
|
| 761 |
+
id_ct_TAMP_seqNumAdjust: SequenceNumberAdjust(),
|
| 762 |
+
id_ct_TAMP_seqNumAdjustConfirm: SequenceNumberAdjustConfirm(),
|
| 763 |
+
id_ct_TAMP_error: TAMPError(),
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
| 767 |
+
|
| 768 |
+
|
| 769 |
+
# Add to the map of CMS Attribute OIDs to Attribute Values in
|
| 770 |
+
# rfc5652.py
|
| 771 |
+
|
| 772 |
+
_cmsAttributesMapUpdate = {
|
| 773 |
+
id_aa_TAMP_contingencyPublicKeyDecryptKey: PlaintextSymmetricKey(),
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
| 777 |
+
|
| 778 |
+
|
| 779 |
+
# Add to the map of Certificate Extension OIDs to Extensions in
|
| 780 |
+
# rfc5280.py
|
| 781 |
+
|
| 782 |
+
_certificateExtensionsMap = {
|
| 783 |
+
id_pe_wrappedApexContinKey: ApexContingencyKey(),
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc5940.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 map for use with opentypes.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 8 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 9 |
+
#
|
| 10 |
+
# Additional CMS Revocation Information Choices
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc5940.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import tag
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
from pyasn1_modules import rfc2560
|
| 21 |
+
from pyasn1_modules import rfc5652
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# RevocationInfoChoice for OCSP response:
|
| 25 |
+
# The OID is included in otherRevInfoFormat, and
|
| 26 |
+
# signed OCSPResponse is included in otherRevInfo
|
| 27 |
+
|
| 28 |
+
id_ri_ocsp_response = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.2')
|
| 29 |
+
|
| 30 |
+
OCSPResponse = rfc2560.OCSPResponse
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# RevocationInfoChoice for SCVP request/response:
|
| 34 |
+
# The OID is included in otherRevInfoFormat, and
|
| 35 |
+
# SCVPReqRes is included in otherRevInfo
|
| 36 |
+
|
| 37 |
+
id_ri_scvp = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.4')
|
| 38 |
+
|
| 39 |
+
ContentInfo = rfc5652.ContentInfo
|
| 40 |
+
|
| 41 |
+
class SCVPReqRes(univ.Sequence):
|
| 42 |
+
pass
|
| 43 |
+
|
| 44 |
+
SCVPReqRes.componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.OptionalNamedType('request',
|
| 46 |
+
ContentInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 47 |
+
namedtype.NamedType('response', ContentInfo())
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Map of Revocation Info Format OIDs to Revocation Info Format
|
| 52 |
+
# is added to the ones that are in rfc5652.py
|
| 53 |
+
|
| 54 |
+
_otherRevInfoFormatMapUpdate = {
|
| 55 |
+
id_ri_ocsp_response: OCSPResponse(),
|
| 56 |
+
id_ri_scvp: SCVPReqRes(),
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
rfc5652.otherRevInfoFormatMap.update(_otherRevInfoFormatMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc6019.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley.
|
| 4 |
+
# Modified by Russ Housley to add a map for use with opentypes.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# BinaryTime: An Alternate Format for Representing Date and Time
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc6019.txt
|
| 13 |
+
|
| 14 |
+
from pyasn1.type import constraint
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
from pyasn1_modules import rfc5652
|
| 18 |
+
|
| 19 |
+
MAX = float('inf')
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# BinaryTime: Represent date and time as an integer
|
| 23 |
+
|
| 24 |
+
class BinaryTime(univ.Integer):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# CMS Attribute for representing signing time in BinaryTime
|
| 31 |
+
|
| 32 |
+
id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46')
|
| 33 |
+
|
| 34 |
+
class BinarySigningTime(BinaryTime):
|
| 35 |
+
pass
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# Map of Attribute Type OIDs to Attributes ia added to the
|
| 39 |
+
# ones that are in rfc5652.py
|
| 40 |
+
|
| 41 |
+
_cmsAttributesMapUpdate = {
|
| 42 |
+
id_aa_binarySigningTime: Bin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c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# CMS Symmetric Key Package Content Type
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc6031.txt
|
| 13 |
+
#
|
| 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 opentype
|
| 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 rfc6019
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _OID(*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 |
+
return univ.ObjectIdentifier(output)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
MAX = float('inf')
|
| 39 |
+
|
| 40 |
+
id_pskc = univ.ObjectIdentifier('1.2.840.113549.1.9.16.12')
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# Symmetric Key Package Attributes
|
| 44 |
+
|
| 45 |
+
id_pskc_manufacturer = _OID(id_pskc, 1)
|
| 46 |
+
|
| 47 |
+
class at_pskc_manufacturer(char.UTF8String):
|
| 48 |
+
pass
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
id_pskc_serialNo = _OID(id_pskc, 2)
|
| 52 |
+
|
| 53 |
+
class at_pskc_serialNo(char.UTF8String):
|
| 54 |
+
pass
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
id_pskc_model = _OID(id_pskc, 3)
|
| 58 |
+
|
| 59 |
+
class at_pskc_model(char.UTF8String):
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
id_pskc_issueNo = _OID(id_pskc, 4)
|
| 64 |
+
|
| 65 |
+
class at_pskc_issueNo(char.UTF8String):
|
| 66 |
+
pass
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
id_pskc_deviceBinding = _OID(id_pskc, 5)
|
| 70 |
+
|
| 71 |
+
class at_pskc_deviceBinding(char.UTF8String):
|
| 72 |
+
pass
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
id_pskc_deviceStartDate = _OID(id_pskc, 6)
|
| 76 |
+
|
| 77 |
+
class at_pskc_deviceStartDate(useful.GeneralizedTime):
|
| 78 |
+
pass
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
id_pskc_deviceExpiryDate = _OID(id_pskc, 7)
|
| 82 |
+
|
| 83 |
+
class at_pskc_deviceExpiryDate(useful.GeneralizedTime):
|
| 84 |
+
pass
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
id_pskc_moduleId = _OID(id_pskc, 8)
|
| 88 |
+
|
| 89 |
+
class at_pskc_moduleId(char.UTF8String):
|
| 90 |
+
pass
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
id_pskc_deviceUserId = _OID(id_pskc, 26)
|
| 94 |
+
|
| 95 |
+
class at_pskc_deviceUserId(char.UTF8String):
|
| 96 |
+
pass
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
# Symmetric Key Attributes
|
| 100 |
+
|
| 101 |
+
id_pskc_keyId = _OID(id_pskc, 9)
|
| 102 |
+
|
| 103 |
+
class at_pskc_keyUserId(char.UTF8String):
|
| 104 |
+
pass
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
id_pskc_algorithm = _OID(id_pskc, 10)
|
| 108 |
+
|
| 109 |
+
class at_pskc_algorithm(char.UTF8String):
|
| 110 |
+
pass
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
id_pskc_issuer = _OID(id_pskc, 11)
|
| 114 |
+
|
| 115 |
+
class at_pskc_issuer(char.UTF8String):
|
| 116 |
+
pass
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
id_pskc_keyProfileId = _OID(id_pskc, 12)
|
| 120 |
+
|
| 121 |
+
class at_pskc_keyProfileId(char.UTF8String):
|
| 122 |
+
pass
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
id_pskc_keyReference = _OID(id_pskc, 13)
|
| 126 |
+
|
| 127 |
+
class at_pskc_keyReference(char.UTF8String):
|
| 128 |
+
pass
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
id_pskc_friendlyName = _OID(id_pskc, 14)
|
| 132 |
+
|
| 133 |
+
class FriendlyName(univ.Sequence):
|
| 134 |
+
pass
|
| 135 |
+
|
| 136 |
+
FriendlyName.componentType = namedtype.NamedTypes(
|
| 137 |
+
namedtype.NamedType('friendlyName', char.UTF8String()),
|
| 138 |
+
namedtype.OptionalNamedType('friendlyNameLangTag', char.UTF8String())
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
class at_pskc_friendlyName(FriendlyName):
|
| 142 |
+
pass
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
id_pskc_algorithmParameters = _OID(id_pskc, 15)
|
| 146 |
+
|
| 147 |
+
class Encoding(char.UTF8String):
|
| 148 |
+
pass
|
| 149 |
+
|
| 150 |
+
Encoding.namedValues = namedval.NamedValues(
|
| 151 |
+
('dec', "DECIMAL"),
|
| 152 |
+
('hex', "HEXADECIMAL"),
|
| 153 |
+
('alpha', "ALPHANUMERIC"),
|
| 154 |
+
('b64', "BASE64"),
|
| 155 |
+
('bin', "BINARY")
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
Encoding.subtypeSpec = constraint.SingleValueConstraint(
|
| 159 |
+
"DECIMAL", "HEXADECIMAL", "ALPHANUMERIC", "BASE64", "BINARY" )
|
| 160 |
+
|
| 161 |
+
class ChallengeFormat(univ.Sequence):
|
| 162 |
+
pass
|
| 163 |
+
|
| 164 |
+
ChallengeFormat.componentType = namedtype.NamedTypes(
|
| 165 |
+
namedtype.NamedType('encoding', Encoding()),
|
| 166 |
+
namedtype.DefaultedNamedType('checkDigit',
|
| 167 |
+
univ.Boolean().subtype(value=0)),
|
| 168 |
+
namedtype.NamedType('min', univ.Integer().subtype(
|
| 169 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
|
| 170 |
+
namedtype.NamedType('max', univ.Integer().subtype(
|
| 171 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
class ResponseFormat(univ.Sequence):
|
| 175 |
+
pass
|
| 176 |
+
|
| 177 |
+
ResponseFormat.componentType = namedtype.NamedTypes(
|
| 178 |
+
namedtype.NamedType('encoding', Encoding()),
|
| 179 |
+
namedtype.NamedType('length', univ.Integer().subtype(
|
| 180 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
|
| 181 |
+
namedtype.DefaultedNamedType('checkDigit',
|
| 182 |
+
univ.Boolean().subtype(value=0))
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
class PSKCAlgorithmParameters(univ.Choice):
|
| 186 |
+
pass
|
| 187 |
+
|
| 188 |
+
PSKCAlgorithmParameters.componentType = namedtype.NamedTypes(
|
| 189 |
+
namedtype.NamedType('suite', char.UTF8String()),
|
| 190 |
+
namedtype.NamedType('challengeFormat', ChallengeFormat().subtype(
|
| 191 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 192 |
+
namedtype.NamedType('responseFormat', ResponseFormat().subtype(
|
| 193 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
class at_pskc_algorithmParameters(PSKCAlgorithmParameters):
|
| 197 |
+
pass
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
id_pskc_counter = _OID(id_pskc, 16)
|
| 201 |
+
|
| 202 |
+
class at_pskc_counter(univ.Integer):
|
| 203 |
+
pass
|
| 204 |
+
|
| 205 |
+
at_pskc_counter.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
id_pskc_time = _OID(id_pskc, 17)
|
| 209 |
+
|
| 210 |
+
class at_pskc_time(rfc6019.BinaryTime):
|
| 211 |
+
pass
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
id_pskc_timeInterval = _OID(id_pskc, 18)
|
| 215 |
+
|
| 216 |
+
class at_pskc_timeInterval(univ.Integer):
|
| 217 |
+
pass
|
| 218 |
+
|
| 219 |
+
at_pskc_timeInterval.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
id_pskc_timeDrift = _OID(id_pskc, 19)
|
| 223 |
+
|
| 224 |
+
class at_pskc_timeDrift(univ.Integer):
|
| 225 |
+
pass
|
| 226 |
+
|
| 227 |
+
at_pskc_timeDrift.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
id_pskc_valueMAC = _OID(id_pskc, 20)
|
| 231 |
+
|
| 232 |
+
class ValueMac(univ.Sequence):
|
| 233 |
+
pass
|
| 234 |
+
|
| 235 |
+
ValueMac.componentType = namedtype.NamedTypes(
|
| 236 |
+
namedtype.NamedType('macAlgorithm', char.UTF8String()),
|
| 237 |
+
namedtype.NamedType('mac', char.UTF8String())
|
| 238 |
+
)
|
| 239 |
+
|
| 240 |
+
class at_pskc_valueMAC(ValueMac):
|
| 241 |
+
pass
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
id_pskc_keyUserId = _OID(id_pskc, 27)
|
| 245 |
+
|
| 246 |
+
class at_pskc_keyId(char.UTF8String):
|
| 247 |
+
pass
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
id_pskc_keyStartDate = _OID(id_pskc, 21)
|
| 251 |
+
|
| 252 |
+
class at_pskc_keyStartDate(useful.GeneralizedTime):
|
| 253 |
+
pass
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
id_pskc_keyExpiryDate = _OID(id_pskc, 22)
|
| 257 |
+
|
| 258 |
+
class at_pskc_keyExpiryDate(useful.GeneralizedTime):
|
| 259 |
+
pass
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
id_pskc_numberOfTransactions = _OID(id_pskc, 23)
|
| 263 |
+
|
| 264 |
+
class at_pskc_numberOfTransactions(univ.Integer):
|
| 265 |
+
pass
|
| 266 |
+
|
| 267 |
+
at_pskc_numberOfTransactions.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
id_pskc_keyUsages = _OID(id_pskc, 24)
|
| 271 |
+
|
| 272 |
+
class PSKCKeyUsage(char.UTF8String):
|
| 273 |
+
pass
|
| 274 |
+
|
| 275 |
+
PSKCKeyUsage.namedValues = namedval.NamedValues(
|
| 276 |
+
('otp', "OTP"),
|
| 277 |
+
('cr', "CR"),
|
| 278 |
+
('encrypt', "Encrypt"),
|
| 279 |
+
('integrity', "Integrity"),
|
| 280 |
+
('verify', "Verify"),
|
| 281 |
+
('unlock', "Unlock"),
|
| 282 |
+
('decrypt', "Decrypt"),
|
| 283 |
+
('keywrap', "KeyWrap"),
|
| 284 |
+
('unwrap', "Unwrap"),
|
| 285 |
+
('derive', "Derive"),
|
| 286 |
+
('generate', "Generate")
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
PSKCKeyUsage.subtypeSpec = constraint.SingleValueConstraint(
|
| 290 |
+
"OTP", "CR", "Encrypt", "Integrity", "Verify", "Unlock",
|
| 291 |
+
"Decrypt", "KeyWrap", "Unwrap", "Derive", "Generate" )
|
| 292 |
+
|
| 293 |
+
class PSKCKeyUsages(univ.SequenceOf):
|
| 294 |
+
pass
|
| 295 |
+
|
| 296 |
+
PSKCKeyUsages.componentType = PSKCKeyUsage()
|
| 297 |
+
|
| 298 |
+
class at_pskc_keyUsage(PSKCKeyUsages):
|
| 299 |
+
pass
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
id_pskc_pinPolicy = _OID(id_pskc, 25)
|
| 303 |
+
|
| 304 |
+
class PINUsageMode(char.UTF8String):
|
| 305 |
+
pass
|
| 306 |
+
|
| 307 |
+
PINUsageMode.namedValues = namedval.NamedValues(
|
| 308 |
+
("local", "Local"),
|
| 309 |
+
("prepend", "Prepend"),
|
| 310 |
+
("append", "Append"),
|
| 311 |
+
("algorithmic", "Algorithmic")
|
| 312 |
+
)
|
| 313 |
+
|
| 314 |
+
PINUsageMode.subtypeSpec = constraint.SingleValueConstraint(
|
| 315 |
+
"Local", "Prepend", "Append", "Algorithmic" )
|
| 316 |
+
|
| 317 |
+
class PINPolicy(univ.Sequence):
|
| 318 |
+
pass
|
| 319 |
+
|
| 320 |
+
PINPolicy.componentType = namedtype.NamedTypes(
|
| 321 |
+
namedtype.OptionalNamedType('pinKeyId', char.UTF8String().subtype(
|
| 322 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 323 |
+
namedtype.NamedType('pinUsageMode', PINUsageMode().subtype(
|
| 324 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 325 |
+
namedtype.OptionalNamedType('maxFailedAttempts', univ.Integer().subtype(
|
| 326 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX)).subtype(
|
| 327 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 328 |
+
namedtype.OptionalNamedType('minLength', univ.Integer().subtype(
|
| 329 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX)).subtype(
|
| 330 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 331 |
+
namedtype.OptionalNamedType('maxLength', univ.Integer().subtype(
|
| 332 |
+
subtypeSpec=constraint.ValueRangeConstraint(0, MAX)).subtype(
|
| 333 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 334 |
+
namedtype.OptionalNamedType('pinEncoding', Encoding().subtype(
|
| 335 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5)))
|
| 336 |
+
)
|
| 337 |
+
|
| 338 |
+
class at_pskc_pinPolicy(PINPolicy):
|
| 339 |
+
pass
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
# Map of Symmetric Key Package Attribute OIDs to Attributes
|
| 343 |
+
|
| 344 |
+
sKeyPkgAttributesMap = {
|
| 345 |
+
id_pskc_manufacturer: at_pskc_manufacturer(),
|
| 346 |
+
id_pskc_serialNo: at_pskc_serialNo(),
|
| 347 |
+
id_pskc_model: at_pskc_model(),
|
| 348 |
+
id_pskc_issueNo: at_pskc_issueNo(),
|
| 349 |
+
id_pskc_deviceBinding: at_pskc_deviceBinding(),
|
| 350 |
+
id_pskc_deviceStartDate: at_pskc_deviceStartDate(),
|
| 351 |
+
id_pskc_deviceExpiryDate: at_pskc_deviceExpiryDate(),
|
| 352 |
+
id_pskc_moduleId: at_pskc_moduleId(),
|
| 353 |
+
id_pskc_deviceUserId: at_pskc_deviceUserId(),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
# Map of Symmetric Key Attribute OIDs to Attributes
|
| 358 |
+
|
| 359 |
+
sKeyAttributesMap = {
|
| 360 |
+
id_pskc_keyId: at_pskc_keyId(),
|
| 361 |
+
id_pskc_algorithm: at_pskc_algorithm(),
|
| 362 |
+
id_pskc_issuer: at_pskc_issuer(),
|
| 363 |
+
id_pskc_keyProfileId: at_pskc_keyProfileId(),
|
| 364 |
+
id_pskc_keyReference: at_pskc_keyReference(),
|
| 365 |
+
id_pskc_friendlyName: at_pskc_friendlyName(),
|
| 366 |
+
id_pskc_algorithmParameters: at_pskc_algorithmParameters(),
|
| 367 |
+
id_pskc_counter: at_pskc_counter(),
|
| 368 |
+
id_pskc_time: at_pskc_time(),
|
| 369 |
+
id_pskc_timeInterval: at_pskc_timeInterval(),
|
| 370 |
+
id_pskc_timeDrift: at_pskc_timeDrift(),
|
| 371 |
+
id_pskc_valueMAC: at_pskc_valueMAC(),
|
| 372 |
+
id_pskc_keyUserId: at_pskc_keyUserId(),
|
| 373 |
+
id_pskc_keyStartDate: at_pskc_keyStartDate(),
|
| 374 |
+
id_pskc_keyExpiryDate: at_pskc_keyExpiryDate(),
|
| 375 |
+
id_pskc_numberOfTransactions: at_pskc_numberOfTransactions(),
|
| 376 |
+
id_pskc_keyUsages: at_pskc_keyUsage(),
|
| 377 |
+
id_pskc_pinPolicy: at_pskc_pinPolicy(),
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
# This definition replaces Attribute() from rfc5652.py; it is the same except
|
| 382 |
+
# that opentype is added with sKeyPkgAttributesMap and sKeyAttributesMap
|
| 383 |
+
|
| 384 |
+
class AttributeType(univ.ObjectIdentifier):
|
| 385 |
+
pass
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
class AttributeValue(univ.Any):
|
| 389 |
+
pass
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
class SKeyAttribute(univ.Sequence):
|
| 393 |
+
pass
|
| 394 |
+
|
| 395 |
+
SKeyAttribute.componentType = namedtype.NamedTypes(
|
| 396 |
+
namedtype.NamedType('attrType', AttributeType()),
|
| 397 |
+
namedtype.NamedType('attrValues',
|
| 398 |
+
univ.SetOf(componentType=AttributeValue()),
|
| 399 |
+
openType=opentype.OpenType('attrType', sKeyAttributesMap)
|
| 400 |
+
)
|
| 401 |
+
)
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
class SKeyPkgAttribute(univ.Sequence):
|
| 405 |
+
pass
|
| 406 |
+
|
| 407 |
+
SKeyPkgAttribute.componentType = namedtype.NamedTypes(
|
| 408 |
+
namedtype.NamedType('attrType', AttributeType()),
|
| 409 |
+
namedtype.NamedType('attrValues',
|
| 410 |
+
univ.SetOf(componentType=AttributeValue()),
|
| 411 |
+
openType=opentype.OpenType('attrType', sKeyPkgAttributesMap)
|
| 412 |
+
)
|
| 413 |
+
)
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
# Symmetric Key Package Content Type
|
| 417 |
+
|
| 418 |
+
id_ct_KP_sKeyPackage = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.25')
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
class KeyPkgVersion(univ.Integer):
|
| 422 |
+
pass
|
| 423 |
+
|
| 424 |
+
KeyPkgVersion.namedValues = namedval.NamedValues(
|
| 425 |
+
('v1', 1)
|
| 426 |
+
)
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
class OneSymmetricKey(univ.Sequence):
|
| 430 |
+
pass
|
| 431 |
+
|
| 432 |
+
OneSymmetricKey.componentType = namedtype.NamedTypes(
|
| 433 |
+
namedtype.OptionalNamedType('sKeyAttrs',
|
| 434 |
+
univ.SequenceOf(componentType=SKeyAttribute()).subtype(
|
| 435 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 436 |
+
namedtype.OptionalNamedType('sKey', univ.OctetString())
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
OneSymmetricKey.sizeSpec = univ.Sequence.sizeSpec + constraint.ValueSizeConstraint(1, 2)
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
class SymmetricKeys(univ.SequenceOf):
|
| 443 |
+
pass
|
| 444 |
+
|
| 445 |
+
SymmetricKeys.componentType = OneSymmetricKey()
|
| 446 |
+
SymmetricKeys.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 447 |
+
|
| 448 |
+
|
| 449 |
+
class SymmetricKeyPackage(univ.Sequence):
|
| 450 |
+
pass
|
| 451 |
+
|
| 452 |
+
SymmetricKeyPackage.componentType = namedtype.NamedTypes(
|
| 453 |
+
namedtype.DefaultedNamedType('version', KeyPkgVersion().subtype(value='v1')),
|
| 454 |
+
namedtype.OptionalNamedType('sKeyPkgAttrs',
|
| 455 |
+
univ.SequenceOf(componentType=SKeyPkgAttribute()).subtype(
|
| 456 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX),
|
| 457 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 458 |
+
namedtype.NamedType('sKeys', SymmetricKeys())
|
| 459 |
+
)
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
# Map of Content Type OIDs to Content Types are
|
| 463 |
+
# added to the ones that are in rfc5652.py
|
| 464 |
+
|
| 465 |
+
_cmsContentTypesMapUpdate = {
|
| 466 |
+
id_ct_KP_sKeyPackage: SymmetricKeyPackage(),
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
.venv/lib/python3.11/site-packages/pyasn1_modules/rfc6120.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Extensible Messaging and Presence Protocol (XMPP)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc6120.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import char
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
|
| 20 |
+
MAX = float('inf')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# XmppAddr Identifier Type as specified in Section 13.7.1.4. of RFC 6120
|
| 24 |
+
|
| 25 |
+
id_pkix = rfc5280.id_pkix
|
| 26 |
+
|
| 27 |
+
id_on = id_pkix + (8, )
|
| 28 |
+
|
| 29 |
+
id_on_xmppAddr = id_on + (5, )
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class XmppAddr(char.UTF8String):
|
| 33 |
+
pass
|
| 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_xmppAddr: XmppAddr(),
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
|