Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/pem.py +58 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc1155.py +96 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc1902.py +129 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2251.py +563 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2314.py +48 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2315.py +294 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2459.py +1339 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2560.py +225 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2876.py +56 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2985.py +588 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3114.py +77 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3125.py +469 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3274.py +59 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3412.py +53 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3447.py +45 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3560.py +74 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3709.py +207 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3739.py +203 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3770.py +75 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3820.py +65 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4010.py +58 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4055.py +258 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4073.py +59 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4210.py +803 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4211.py +396 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4334.py +75 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4357.py +477 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4476.py +93 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4491.py +44 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4683.py +72 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5084.py +97 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5126.py +577 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5208.py +56 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5275.py +404 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5636.py +113 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5649.py +33 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5652.py +761 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5697.py +70 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5751.py +124 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5752.py +49 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5753.py +157 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5913.py +44 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5915.py +32 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5917.py +55 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5958.py +98 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5990.py +237 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6019.py +45 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6170.py +17 -0
- evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6187.py +22 -0
.gitattributes
CHANGED
|
@@ -528,3 +528,4 @@ janus/lib/ossl-modules/legacy.so filter=lfs diff=lfs merge=lfs -text
|
|
| 528 |
janus/lib/python3.10/lib-dynload/_decimal.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 529 |
janus/lib/sqlite3.44.2/libsqlite3.44.2.so filter=lfs diff=lfs merge=lfs -text
|
| 530 |
janus/lib/itcl4.2.4/libitcl4.2.4.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 528 |
janus/lib/python3.10/lib-dynload/_decimal.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 529 |
janus/lib/sqlite3.44.2/libsqlite3.44.2.so filter=lfs diff=lfs merge=lfs -text
|
| 530 |
janus/lib/itcl4.2.4/libitcl4.2.4.so filter=lfs diff=lfs merge=lfs -text
|
| 531 |
+
janus/x86_64-conda-linux-gnu/bin/ld filter=lfs diff=lfs merge=lfs -text
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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())
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2251.py
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Copyright (c) 2005-2020, Ilya Etingof <[email protected]>
|
| 5 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 6 |
+
#
|
| 7 |
+
# LDAP message syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/ldap.asn
|
| 11 |
+
#
|
| 12 |
+
# Sample captures from:
|
| 13 |
+
# http://wiki.wireshark.org/SampleCaptures/
|
| 14 |
+
#
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import namedval
|
| 18 |
+
from pyasn1.type import tag
|
| 19 |
+
from pyasn1.type import univ
|
| 20 |
+
|
| 21 |
+
maxInt = univ.Integer(2147483647)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class LDAPString(univ.OctetString):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class LDAPOID(univ.OctetString):
|
| 29 |
+
pass
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class LDAPDN(LDAPString):
|
| 33 |
+
pass
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class RelativeLDAPDN(LDAPString):
|
| 37 |
+
pass
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class AttributeType(LDAPString):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class AttributeDescription(LDAPString):
|
| 45 |
+
pass
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class AttributeDescriptionList(univ.SequenceOf):
|
| 49 |
+
componentType = AttributeDescription()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class AttributeValue(univ.OctetString):
|
| 53 |
+
pass
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class AssertionValue(univ.OctetString):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class AttributeValueAssertion(univ.Sequence):
|
| 61 |
+
componentType = namedtype.NamedTypes(
|
| 62 |
+
namedtype.NamedType('attributeDesc', AttributeDescription()),
|
| 63 |
+
namedtype.NamedType('assertionValue', AssertionValue())
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class Attribute(univ.Sequence):
|
| 68 |
+
componentType = namedtype.NamedTypes(
|
| 69 |
+
namedtype.NamedType('type', AttributeDescription()),
|
| 70 |
+
namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class MatchingRuleId(LDAPString):
|
| 75 |
+
pass
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class Control(univ.Sequence):
|
| 79 |
+
componentType = namedtype.NamedTypes(
|
| 80 |
+
namedtype.NamedType('controlType', LDAPOID()),
|
| 81 |
+
namedtype.DefaultedNamedType('criticality', univ.Boolean('False')),
|
| 82 |
+
namedtype.OptionalNamedType('controlValue', univ.OctetString())
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class Controls(univ.SequenceOf):
|
| 87 |
+
componentType = Control()
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class LDAPURL(LDAPString):
|
| 91 |
+
pass
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
class Referral(univ.SequenceOf):
|
| 95 |
+
componentType = LDAPURL()
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class SaslCredentials(univ.Sequence):
|
| 99 |
+
componentType = namedtype.NamedTypes(
|
| 100 |
+
namedtype.NamedType('mechanism', LDAPString()),
|
| 101 |
+
namedtype.OptionalNamedType('credentials', univ.OctetString())
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class AuthenticationChoice(univ.Choice):
|
| 106 |
+
componentType = namedtype.NamedTypes(
|
| 107 |
+
namedtype.NamedType('simple', univ.OctetString().subtype(
|
| 108 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 109 |
+
namedtype.NamedType('reserved-1', univ.OctetString().subtype(
|
| 110 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 111 |
+
namedtype.NamedType('reserved-2', univ.OctetString().subtype(
|
| 112 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 113 |
+
namedtype.NamedType('sasl',
|
| 114 |
+
SaslCredentials().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
class BindRequest(univ.Sequence):
|
| 119 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 120 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 0)
|
| 121 |
+
)
|
| 122 |
+
componentType = namedtype.NamedTypes(
|
| 123 |
+
namedtype.NamedType('version', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, 127))),
|
| 124 |
+
namedtype.NamedType('name', LDAPDN()),
|
| 125 |
+
namedtype.NamedType('authentication', AuthenticationChoice())
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class PartialAttributeList(univ.SequenceOf):
|
| 130 |
+
componentType = univ.Sequence(
|
| 131 |
+
componentType=namedtype.NamedTypes(
|
| 132 |
+
namedtype.NamedType('type', AttributeDescription()),
|
| 133 |
+
namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
|
| 134 |
+
)
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class SearchResultEntry(univ.Sequence):
|
| 139 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 140 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 4)
|
| 141 |
+
)
|
| 142 |
+
componentType = namedtype.NamedTypes(
|
| 143 |
+
namedtype.NamedType('objectName', LDAPDN()),
|
| 144 |
+
namedtype.NamedType('attributes', PartialAttributeList())
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
class MatchingRuleAssertion(univ.Sequence):
|
| 149 |
+
componentType = namedtype.NamedTypes(
|
| 150 |
+
namedtype.OptionalNamedType('matchingRule', MatchingRuleId().subtype(
|
| 151 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 152 |
+
namedtype.OptionalNamedType('type', AttributeDescription().subtype(
|
| 153 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 154 |
+
namedtype.NamedType('matchValue',
|
| 155 |
+
AssertionValue().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 156 |
+
namedtype.DefaultedNamedType('dnAttributes', univ.Boolean('False').subtype(
|
| 157 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 158 |
+
)
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
class SubstringFilter(univ.Sequence):
|
| 162 |
+
componentType = namedtype.NamedTypes(
|
| 163 |
+
namedtype.NamedType('type', AttributeDescription()),
|
| 164 |
+
namedtype.NamedType('substrings',
|
| 165 |
+
univ.SequenceOf(
|
| 166 |
+
componentType=univ.Choice(
|
| 167 |
+
componentType=namedtype.NamedTypes(
|
| 168 |
+
namedtype.NamedType(
|
| 169 |
+
'initial', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))
|
| 170 |
+
),
|
| 171 |
+
namedtype.NamedType(
|
| 172 |
+
'any', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))
|
| 173 |
+
),
|
| 174 |
+
namedtype.NamedType(
|
| 175 |
+
'final', LDAPString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))
|
| 176 |
+
)
|
| 177 |
+
)
|
| 178 |
+
)
|
| 179 |
+
)
|
| 180 |
+
)
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
# Ugly hack to handle recursive Filter reference (up to 3-levels deep).
|
| 185 |
+
|
| 186 |
+
class Filter3(univ.Choice):
|
| 187 |
+
componentType = namedtype.NamedTypes(
|
| 188 |
+
namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
|
| 189 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 190 |
+
namedtype.NamedType('substrings', SubstringFilter().subtype(
|
| 191 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 192 |
+
namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
|
| 193 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 194 |
+
namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
|
| 195 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
|
| 196 |
+
namedtype.NamedType('present', AttributeDescription().subtype(
|
| 197 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 198 |
+
namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
|
| 199 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
|
| 200 |
+
namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
|
| 201 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
class Filter2(univ.Choice):
|
| 206 |
+
componentType = namedtype.NamedTypes(
|
| 207 |
+
namedtype.NamedType('and', univ.SetOf(componentType=Filter3()).subtype(
|
| 208 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 209 |
+
namedtype.NamedType('or', univ.SetOf(componentType=Filter3()).subtype(
|
| 210 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 211 |
+
namedtype.NamedType('not',
|
| 212 |
+
Filter3().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 213 |
+
namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
|
| 214 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 215 |
+
namedtype.NamedType('substrings', SubstringFilter().subtype(
|
| 216 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 217 |
+
namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
|
| 218 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 219 |
+
namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
|
| 220 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
|
| 221 |
+
namedtype.NamedType('present', AttributeDescription().subtype(
|
| 222 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 223 |
+
namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
|
| 224 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
|
| 225 |
+
namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
|
| 226 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
class Filter(univ.Choice):
|
| 231 |
+
componentType = namedtype.NamedTypes(
|
| 232 |
+
namedtype.NamedType('and', univ.SetOf(componentType=Filter2()).subtype(
|
| 233 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 234 |
+
namedtype.NamedType('or', univ.SetOf(componentType=Filter2()).subtype(
|
| 235 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 236 |
+
namedtype.NamedType('not',
|
| 237 |
+
Filter2().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 238 |
+
namedtype.NamedType('equalityMatch', AttributeValueAssertion().subtype(
|
| 239 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 240 |
+
namedtype.NamedType('substrings', SubstringFilter().subtype(
|
| 241 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 242 |
+
namedtype.NamedType('greaterOrEqual', AttributeValueAssertion().subtype(
|
| 243 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 244 |
+
namedtype.NamedType('lessOrEqual', AttributeValueAssertion().subtype(
|
| 245 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6))),
|
| 246 |
+
namedtype.NamedType('present', AttributeDescription().subtype(
|
| 247 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 248 |
+
namedtype.NamedType('approxMatch', AttributeValueAssertion().subtype(
|
| 249 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8))),
|
| 250 |
+
namedtype.NamedType('extensibleMatch', MatchingRuleAssertion().subtype(
|
| 251 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 9)))
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
# End of Filter hack
|
| 256 |
+
|
| 257 |
+
class SearchRequest(univ.Sequence):
|
| 258 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 259 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 3)
|
| 260 |
+
)
|
| 261 |
+
componentType = namedtype.NamedTypes(
|
| 262 |
+
namedtype.NamedType('baseObject', LDAPDN()),
|
| 263 |
+
namedtype.NamedType('scope', univ.Enumerated(
|
| 264 |
+
namedValues=namedval.NamedValues(('baseObject', 0), ('singleLevel', 1), ('wholeSubtree', 2)))),
|
| 265 |
+
namedtype.NamedType('derefAliases', univ.Enumerated(
|
| 266 |
+
namedValues=namedval.NamedValues(('neverDerefAliases', 0), ('derefInSearching', 1),
|
| 267 |
+
('derefFindingBaseObj', 2), ('derefAlways', 3)))),
|
| 268 |
+
namedtype.NamedType('sizeLimit',
|
| 269 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, maxInt))),
|
| 270 |
+
namedtype.NamedType('timeLimit',
|
| 271 |
+
univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, maxInt))),
|
| 272 |
+
namedtype.NamedType('typesOnly', univ.Boolean()),
|
| 273 |
+
namedtype.NamedType('filter', Filter()),
|
| 274 |
+
namedtype.NamedType('attributes', AttributeDescriptionList())
|
| 275 |
+
)
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
class UnbindRequest(univ.Null):
|
| 279 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 280 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class BindResponse(univ.Sequence):
|
| 285 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 286 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 1)
|
| 287 |
+
)
|
| 288 |
+
componentType = namedtype.NamedTypes(
|
| 289 |
+
namedtype.NamedType('resultCode', univ.Enumerated(
|
| 290 |
+
namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
|
| 291 |
+
('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
|
| 292 |
+
('compareTrue', 6), ('authMethodNotSupported', 7),
|
| 293 |
+
('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
|
| 294 |
+
('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
|
| 295 |
+
('confidentialityRequired', 13), ('saslBindInProgress', 14),
|
| 296 |
+
('noSuchAttribute', 16), ('undefinedAttributeType', 17),
|
| 297 |
+
('inappropriateMatching', 18), ('constraintViolation', 19),
|
| 298 |
+
('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
|
| 299 |
+
('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
|
| 300 |
+
('reserved-35', 35), ('aliasDereferencingProblem', 36),
|
| 301 |
+
('inappropriateAuthentication', 48), ('invalidCredentials', 49),
|
| 302 |
+
('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
|
| 303 |
+
('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
|
| 304 |
+
('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
|
| 305 |
+
('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
|
| 306 |
+
('objectClassModsProhibited', 69), ('reserved-70', 70),
|
| 307 |
+
('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
|
| 308 |
+
('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
|
| 309 |
+
('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
|
| 310 |
+
('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
|
| 311 |
+
namedtype.NamedType('matchedDN', LDAPDN()),
|
| 312 |
+
namedtype.NamedType('errorMessage', LDAPString()),
|
| 313 |
+
namedtype.OptionalNamedType('referral', Referral().subtype(
|
| 314 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 315 |
+
namedtype.OptionalNamedType('serverSaslCreds', univ.OctetString().subtype(
|
| 316 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)))
|
| 317 |
+
)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class LDAPResult(univ.Sequence):
|
| 321 |
+
componentType = namedtype.NamedTypes(
|
| 322 |
+
namedtype.NamedType('resultCode', univ.Enumerated(
|
| 323 |
+
namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
|
| 324 |
+
('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
|
| 325 |
+
('compareTrue', 6), ('authMethodNotSupported', 7),
|
| 326 |
+
('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
|
| 327 |
+
('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
|
| 328 |
+
('confidentialityRequired', 13), ('saslBindInProgress', 14),
|
| 329 |
+
('noSuchAttribute', 16), ('undefinedAttributeType', 17),
|
| 330 |
+
('inappropriateMatching', 18), ('constraintViolation', 19),
|
| 331 |
+
('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
|
| 332 |
+
('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
|
| 333 |
+
('reserved-35', 35), ('aliasDereferencingProblem', 36),
|
| 334 |
+
('inappropriateAuthentication', 48), ('invalidCredentials', 49),
|
| 335 |
+
('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
|
| 336 |
+
('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
|
| 337 |
+
('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
|
| 338 |
+
('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
|
| 339 |
+
('objectClassModsProhibited', 69), ('reserved-70', 70),
|
| 340 |
+
('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
|
| 341 |
+
('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
|
| 342 |
+
('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
|
| 343 |
+
('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
|
| 344 |
+
namedtype.NamedType('matchedDN', LDAPDN()),
|
| 345 |
+
namedtype.NamedType('errorMessage', LDAPString()),
|
| 346 |
+
namedtype.OptionalNamedType('referral', Referral().subtype(
|
| 347 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
class SearchResultReference(univ.SequenceOf):
|
| 352 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 353 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 19)
|
| 354 |
+
)
|
| 355 |
+
componentType = LDAPURL()
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
class SearchResultDone(LDAPResult):
|
| 359 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 360 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 5)
|
| 361 |
+
)
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
class AttributeTypeAndValues(univ.Sequence):
|
| 365 |
+
componentType = namedtype.NamedTypes(
|
| 366 |
+
namedtype.NamedType('type', AttributeDescription()),
|
| 367 |
+
namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
|
| 368 |
+
)
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
class ModifyRequest(univ.Sequence):
|
| 372 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 373 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 6)
|
| 374 |
+
)
|
| 375 |
+
componentType = namedtype.NamedTypes(
|
| 376 |
+
namedtype.NamedType('object', LDAPDN()),
|
| 377 |
+
namedtype.NamedType('modification',
|
| 378 |
+
univ.SequenceOf(
|
| 379 |
+
componentType=univ.Sequence(
|
| 380 |
+
componentType=namedtype.NamedTypes(
|
| 381 |
+
namedtype.NamedType(
|
| 382 |
+
'operation', univ.Enumerated(namedValues=namedval.NamedValues(('add', 0), ('delete', 1), ('replace', 2)))
|
| 383 |
+
),
|
| 384 |
+
namedtype.NamedType('modification', AttributeTypeAndValues())))
|
| 385 |
+
)
|
| 386 |
+
)
|
| 387 |
+
)
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
class ModifyResponse(LDAPResult):
|
| 391 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 392 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 7)
|
| 393 |
+
)
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
class AttributeList(univ.SequenceOf):
|
| 397 |
+
componentType = univ.Sequence(
|
| 398 |
+
componentType=namedtype.NamedTypes(
|
| 399 |
+
namedtype.NamedType('type', AttributeDescription()),
|
| 400 |
+
namedtype.NamedType('vals', univ.SetOf(componentType=AttributeValue()))
|
| 401 |
+
)
|
| 402 |
+
)
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
class AddRequest(univ.Sequence):
|
| 406 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 407 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 8)
|
| 408 |
+
)
|
| 409 |
+
componentType = namedtype.NamedTypes(
|
| 410 |
+
namedtype.NamedType('entry', LDAPDN()),
|
| 411 |
+
namedtype.NamedType('attributes', AttributeList())
|
| 412 |
+
)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
class AddResponse(LDAPResult):
|
| 416 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 417 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 9)
|
| 418 |
+
)
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
class DelRequest(LDAPResult):
|
| 422 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 423 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 10)
|
| 424 |
+
)
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
class DelResponse(LDAPResult):
|
| 428 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 429 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 11)
|
| 430 |
+
)
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
class ModifyDNRequest(univ.Sequence):
|
| 434 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 435 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 12)
|
| 436 |
+
)
|
| 437 |
+
componentType = namedtype.NamedTypes(
|
| 438 |
+
namedtype.NamedType('entry', LDAPDN()),
|
| 439 |
+
namedtype.NamedType('newrdn', RelativeLDAPDN()),
|
| 440 |
+
namedtype.NamedType('deleteoldrdn', univ.Boolean()),
|
| 441 |
+
namedtype.OptionalNamedType('newSuperior',
|
| 442 |
+
LDAPDN().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 443 |
+
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
class ModifyDNResponse(LDAPResult):
|
| 448 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 449 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 13)
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
class CompareRequest(univ.Sequence):
|
| 454 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 455 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 14)
|
| 456 |
+
)
|
| 457 |
+
componentType = namedtype.NamedTypes(
|
| 458 |
+
namedtype.NamedType('entry', LDAPDN()),
|
| 459 |
+
namedtype.NamedType('ava', AttributeValueAssertion())
|
| 460 |
+
)
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
class CompareResponse(LDAPResult):
|
| 464 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 465 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 15)
|
| 466 |
+
)
|
| 467 |
+
|
| 468 |
+
|
| 469 |
+
class AbandonRequest(LDAPResult):
|
| 470 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 471 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 16)
|
| 472 |
+
)
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
class ExtendedRequest(univ.Sequence):
|
| 476 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 477 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 23)
|
| 478 |
+
)
|
| 479 |
+
componentType = namedtype.NamedTypes(
|
| 480 |
+
namedtype.NamedType('requestName',
|
| 481 |
+
LDAPOID().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 482 |
+
namedtype.OptionalNamedType('requestValue', univ.OctetString().subtype(
|
| 483 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 484 |
+
)
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
class ExtendedResponse(univ.Sequence):
|
| 488 |
+
tagSet = univ.Sequence.tagSet.tagImplicitly(
|
| 489 |
+
tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 24)
|
| 490 |
+
)
|
| 491 |
+
componentType = namedtype.NamedTypes(
|
| 492 |
+
namedtype.NamedType('resultCode', univ.Enumerated(
|
| 493 |
+
namedValues=namedval.NamedValues(('success', 0), ('operationsError', 1), ('protocolError', 2),
|
| 494 |
+
('timeLimitExceeded', 3), ('sizeLimitExceeded', 4), ('compareFalse', 5),
|
| 495 |
+
('compareTrue', 6), ('authMethodNotSupported', 7),
|
| 496 |
+
('strongAuthRequired', 8), ('reserved-9', 9), ('referral', 10),
|
| 497 |
+
('adminLimitExceeded', 11), ('unavailableCriticalExtension', 12),
|
| 498 |
+
('confidentialityRequired', 13), ('saslBindInProgress', 14),
|
| 499 |
+
('noSuchAttribute', 16), ('undefinedAttributeType', 17),
|
| 500 |
+
('inappropriateMatching', 18), ('constraintViolation', 19),
|
| 501 |
+
('attributeOrValueExists', 20), ('invalidAttributeSyntax', 21),
|
| 502 |
+
('noSuchObject', 32), ('aliasProblem', 33), ('invalidDNSyntax', 34),
|
| 503 |
+
('reserved-35', 35), ('aliasDereferencingProblem', 36),
|
| 504 |
+
('inappropriateAuthentication', 48), ('invalidCredentials', 49),
|
| 505 |
+
('insufficientAccessRights', 50), ('busy', 51), ('unavailable', 52),
|
| 506 |
+
('unwillingToPerform', 53), ('loopDetect', 54), ('namingViolation', 64),
|
| 507 |
+
('objectClassViolation', 65), ('notAllowedOnNonLeaf', 66),
|
| 508 |
+
('notAllowedOnRDN', 67), ('entryAlreadyExists', 68),
|
| 509 |
+
('objectClassModsProhibited', 69), ('reserved-70', 70),
|
| 510 |
+
('affectsMultipleDSAs', 71), ('other', 80), ('reserved-81', 81),
|
| 511 |
+
('reserved-82', 82), ('reserved-83', 83), ('reserved-84', 84),
|
| 512 |
+
('reserved-85', 85), ('reserved-86', 86), ('reserved-87', 87),
|
| 513 |
+
('reserved-88', 88), ('reserved-89', 89), ('reserved-90', 90)))),
|
| 514 |
+
namedtype.NamedType('matchedDN', LDAPDN()),
|
| 515 |
+
namedtype.NamedType('errorMessage', LDAPString()),
|
| 516 |
+
namedtype.OptionalNamedType('referral', Referral().subtype(
|
| 517 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 518 |
+
|
| 519 |
+
namedtype.OptionalNamedType('responseName', LDAPOID().subtype(
|
| 520 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 10))),
|
| 521 |
+
namedtype.OptionalNamedType('response', univ.OctetString().subtype(
|
| 522 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 11)))
|
| 523 |
+
)
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
class MessageID(univ.Integer):
|
| 527 |
+
subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
|
| 528 |
+
0, maxInt
|
| 529 |
+
)
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
class LDAPMessage(univ.Sequence):
|
| 533 |
+
componentType = namedtype.NamedTypes(
|
| 534 |
+
namedtype.NamedType('messageID', MessageID()),
|
| 535 |
+
namedtype.NamedType(
|
| 536 |
+
'protocolOp', univ.Choice(
|
| 537 |
+
componentType=namedtype.NamedTypes(
|
| 538 |
+
namedtype.NamedType('bindRequest', BindRequest()),
|
| 539 |
+
namedtype.NamedType('bindResponse', BindResponse()),
|
| 540 |
+
namedtype.NamedType('unbindRequest', UnbindRequest()),
|
| 541 |
+
namedtype.NamedType('searchRequest', SearchRequest()),
|
| 542 |
+
namedtype.NamedType('searchResEntry', SearchResultEntry()),
|
| 543 |
+
namedtype.NamedType('searchResDone', SearchResultDone()),
|
| 544 |
+
namedtype.NamedType('searchResRef', SearchResultReference()),
|
| 545 |
+
namedtype.NamedType('modifyRequest', ModifyRequest()),
|
| 546 |
+
namedtype.NamedType('modifyResponse', ModifyResponse()),
|
| 547 |
+
namedtype.NamedType('addRequest', AddRequest()),
|
| 548 |
+
namedtype.NamedType('addResponse', AddResponse()),
|
| 549 |
+
namedtype.NamedType('delRequest', DelRequest()),
|
| 550 |
+
namedtype.NamedType('delResponse', DelResponse()),
|
| 551 |
+
namedtype.NamedType('modDNRequest', ModifyDNRequest()),
|
| 552 |
+
namedtype.NamedType('modDNResponse', ModifyDNResponse()),
|
| 553 |
+
namedtype.NamedType('compareRequest', CompareRequest()),
|
| 554 |
+
namedtype.NamedType('compareResponse', CompareResponse()),
|
| 555 |
+
namedtype.NamedType('abandonRequest', AbandonRequest()),
|
| 556 |
+
namedtype.NamedType('extendedReq', ExtendedRequest()),
|
| 557 |
+
namedtype.NamedType('extendedResp', ExtendedResponse())
|
| 558 |
+
)
|
| 559 |
+
)
|
| 560 |
+
),
|
| 561 |
+
namedtype.OptionalNamedType('controls', Controls().subtype(
|
| 562 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 563 |
+
)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2314.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Copyright (c) 2005-2020, Ilya Etingof <[email protected]>
|
| 5 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 6 |
+
#
|
| 7 |
+
# PKCS#10 syntax
|
| 8 |
+
#
|
| 9 |
+
# ASN.1 source from:
|
| 10 |
+
# http://tools.ietf.org/html/rfc2314
|
| 11 |
+
#
|
| 12 |
+
# Sample captures could be obtained with "openssl req" command
|
| 13 |
+
#
|
| 14 |
+
from pyasn1_modules.rfc2459 import *
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Attributes(univ.SetOf):
|
| 18 |
+
componentType = Attribute()
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class Version(univ.Integer):
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class CertificationRequestInfo(univ.Sequence):
|
| 26 |
+
componentType = namedtype.NamedTypes(
|
| 27 |
+
namedtype.NamedType('version', Version()),
|
| 28 |
+
namedtype.NamedType('subject', Name()),
|
| 29 |
+
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo()),
|
| 30 |
+
namedtype.NamedType('attributes',
|
| 31 |
+
Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Signature(univ.BitString):
|
| 36 |
+
pass
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class SignatureAlgorithmIdentifier(AlgorithmIdentifier):
|
| 40 |
+
pass
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class CertificationRequest(univ.Sequence):
|
| 44 |
+
componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.NamedType('certificationRequestInfo', CertificationRequestInfo()),
|
| 46 |
+
namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
|
| 47 |
+
namedtype.NamedType('signature', Signature())
|
| 48 |
+
)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2560.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Copyright (c) 2005-2020, Ilya Etingof <[email protected]>
|
| 5 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 6 |
+
#
|
| 7 |
+
# OCSP request/response syntax
|
| 8 |
+
#
|
| 9 |
+
# Derived from a minimal OCSP library (RFC2560) code written by
|
| 10 |
+
# Bud P. Bruegger <[email protected]>
|
| 11 |
+
# Copyright: Ancitel, S.p.a, Rome, Italy
|
| 12 |
+
# License: BSD
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
#
|
| 16 |
+
# current limitations:
|
| 17 |
+
# * request and response works only for a single certificate
|
| 18 |
+
# * only some values are parsed out of the response
|
| 19 |
+
# * the request does't set a nonce nor signature
|
| 20 |
+
# * there is no signature validation of the response
|
| 21 |
+
# * dates are left as strings in GeneralizedTime format -- datetime.datetime
|
| 22 |
+
# would be nicer
|
| 23 |
+
#
|
| 24 |
+
from pyasn1.type import namedtype
|
| 25 |
+
from pyasn1.type import namedval
|
| 26 |
+
from pyasn1.type import tag
|
| 27 |
+
from pyasn1.type import univ
|
| 28 |
+
from pyasn1.type import useful
|
| 29 |
+
|
| 30 |
+
from pyasn1_modules import rfc2459
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Start of OCSP module definitions
|
| 34 |
+
|
| 35 |
+
# This should be in directory Authentication Framework (X.509) module
|
| 36 |
+
|
| 37 |
+
class CRLReason(univ.Enumerated):
|
| 38 |
+
namedValues = namedval.NamedValues(
|
| 39 |
+
('unspecified', 0),
|
| 40 |
+
('keyCompromise', 1),
|
| 41 |
+
('cACompromise', 2),
|
| 42 |
+
('affiliationChanged', 3),
|
| 43 |
+
('superseded', 4),
|
| 44 |
+
('cessationOfOperation', 5),
|
| 45 |
+
('certificateHold', 6),
|
| 46 |
+
('removeFromCRL', 8),
|
| 47 |
+
('privilegeWithdrawn', 9),
|
| 48 |
+
('aACompromise', 10)
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
# end of directory Authentication Framework (X.509) module
|
| 53 |
+
|
| 54 |
+
# This should be in PKIX Certificate Extensions module
|
| 55 |
+
|
| 56 |
+
class GeneralName(univ.OctetString):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# end of PKIX Certificate Extensions module
|
| 61 |
+
|
| 62 |
+
id_kp_OCSPSigning = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 3, 9))
|
| 63 |
+
id_pkix_ocsp = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1))
|
| 64 |
+
id_pkix_ocsp_basic = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 1))
|
| 65 |
+
id_pkix_ocsp_nonce = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 2))
|
| 66 |
+
id_pkix_ocsp_crl = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 3))
|
| 67 |
+
id_pkix_ocsp_response = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 4))
|
| 68 |
+
id_pkix_ocsp_nocheck = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 5))
|
| 69 |
+
id_pkix_ocsp_archive_cutoff = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 6))
|
| 70 |
+
id_pkix_ocsp_service_locator = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 48, 1, 7))
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class AcceptableResponses(univ.SequenceOf):
|
| 74 |
+
componentType = univ.ObjectIdentifier()
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class ArchiveCutoff(useful.GeneralizedTime):
|
| 78 |
+
pass
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class UnknownInfo(univ.Null):
|
| 82 |
+
pass
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class RevokedInfo(univ.Sequence):
|
| 86 |
+
componentType = namedtype.NamedTypes(
|
| 87 |
+
namedtype.NamedType('revocationTime', useful.GeneralizedTime()),
|
| 88 |
+
namedtype.OptionalNamedType('revocationReason', CRLReason().subtype(
|
| 89 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class CertID(univ.Sequence):
|
| 94 |
+
componentType = namedtype.NamedTypes(
|
| 95 |
+
namedtype.NamedType('hashAlgorithm', rfc2459.AlgorithmIdentifier()),
|
| 96 |
+
namedtype.NamedType('issuerNameHash', univ.OctetString()),
|
| 97 |
+
namedtype.NamedType('issuerKeyHash', univ.OctetString()),
|
| 98 |
+
namedtype.NamedType('serialNumber', rfc2459.CertificateSerialNumber())
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class CertStatus(univ.Choice):
|
| 103 |
+
componentType = namedtype.NamedTypes(
|
| 104 |
+
namedtype.NamedType('good',
|
| 105 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 106 |
+
namedtype.NamedType('revoked',
|
| 107 |
+
RevokedInfo().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 108 |
+
namedtype.NamedType('unknown',
|
| 109 |
+
UnknownInfo().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class SingleResponse(univ.Sequence):
|
| 114 |
+
componentType = namedtype.NamedTypes(
|
| 115 |
+
namedtype.NamedType('certID', CertID()),
|
| 116 |
+
namedtype.NamedType('certStatus', CertStatus()),
|
| 117 |
+
namedtype.NamedType('thisUpdate', useful.GeneralizedTime()),
|
| 118 |
+
namedtype.OptionalNamedType('nextUpdate', useful.GeneralizedTime().subtype(
|
| 119 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 120 |
+
namedtype.OptionalNamedType('singleExtensions', rfc2459.Extensions().subtype(
|
| 121 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
class KeyHash(univ.OctetString):
|
| 126 |
+
pass
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class ResponderID(univ.Choice):
|
| 130 |
+
componentType = namedtype.NamedTypes(
|
| 131 |
+
namedtype.NamedType('byName',
|
| 132 |
+
rfc2459.Name().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 133 |
+
namedtype.NamedType('byKey',
|
| 134 |
+
KeyHash().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class Version(univ.Integer):
|
| 139 |
+
namedValues = namedval.NamedValues(('v1', 0))
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class ResponseData(univ.Sequence):
|
| 143 |
+
componentType = namedtype.NamedTypes(
|
| 144 |
+
namedtype.DefaultedNamedType('version', Version('v1').subtype(
|
| 145 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 146 |
+
namedtype.NamedType('responderID', ResponderID()),
|
| 147 |
+
namedtype.NamedType('producedAt', useful.GeneralizedTime()),
|
| 148 |
+
namedtype.NamedType('responses', univ.SequenceOf(componentType=SingleResponse())),
|
| 149 |
+
namedtype.OptionalNamedType('responseExtensions', rfc2459.Extensions().subtype(
|
| 150 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
class BasicOCSPResponse(univ.Sequence):
|
| 155 |
+
componentType = namedtype.NamedTypes(
|
| 156 |
+
namedtype.NamedType('tbsResponseData', ResponseData()),
|
| 157 |
+
namedtype.NamedType('signatureAlgorithm', rfc2459.AlgorithmIdentifier()),
|
| 158 |
+
namedtype.NamedType('signature', univ.BitString()),
|
| 159 |
+
namedtype.OptionalNamedType('certs', univ.SequenceOf(componentType=rfc2459.Certificate()).subtype(
|
| 160 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
class ResponseBytes(univ.Sequence):
|
| 165 |
+
componentType = namedtype.NamedTypes(
|
| 166 |
+
namedtype.NamedType('responseType', univ.ObjectIdentifier()),
|
| 167 |
+
namedtype.NamedType('response', univ.OctetString())
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
class OCSPResponseStatus(univ.Enumerated):
|
| 172 |
+
namedValues = namedval.NamedValues(
|
| 173 |
+
('successful', 0),
|
| 174 |
+
('malformedRequest', 1),
|
| 175 |
+
('internalError', 2),
|
| 176 |
+
('tryLater', 3),
|
| 177 |
+
('undefinedStatus', 4), # should never occur
|
| 178 |
+
('sigRequired', 5),
|
| 179 |
+
('unauthorized', 6)
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class OCSPResponse(univ.Sequence):
|
| 184 |
+
componentType = namedtype.NamedTypes(
|
| 185 |
+
namedtype.NamedType('responseStatus', OCSPResponseStatus()),
|
| 186 |
+
namedtype.OptionalNamedType('responseBytes', ResponseBytes().subtype(
|
| 187 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
class Request(univ.Sequence):
|
| 192 |
+
componentType = namedtype.NamedTypes(
|
| 193 |
+
namedtype.NamedType('reqCert', CertID()),
|
| 194 |
+
namedtype.OptionalNamedType('singleRequestExtensions', rfc2459.Extensions().subtype(
|
| 195 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
class Signature(univ.Sequence):
|
| 200 |
+
componentType = namedtype.NamedTypes(
|
| 201 |
+
namedtype.NamedType('signatureAlgorithm', rfc2459.AlgorithmIdentifier()),
|
| 202 |
+
namedtype.NamedType('signature', univ.BitString()),
|
| 203 |
+
namedtype.OptionalNamedType('certs', univ.SequenceOf(componentType=rfc2459.Certificate()).subtype(
|
| 204 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
class TBSRequest(univ.Sequence):
|
| 209 |
+
componentType = namedtype.NamedTypes(
|
| 210 |
+
namedtype.DefaultedNamedType('version', Version('v1').subtype(
|
| 211 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 212 |
+
namedtype.OptionalNamedType('requestorName', GeneralName().subtype(
|
| 213 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 214 |
+
namedtype.NamedType('requestList', univ.SequenceOf(componentType=Request())),
|
| 215 |
+
namedtype.OptionalNamedType('requestExtensions', rfc2459.Extensions().subtype(
|
| 216 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class OCSPRequest(univ.Sequence):
|
| 221 |
+
componentType = namedtype.NamedTypes(
|
| 222 |
+
namedtype.NamedType('tbsRequest', TBSRequest()),
|
| 223 |
+
namedtype.OptionalNamedType('optionalSignature', Signature().subtype(
|
| 224 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 225 |
+
)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc2985.py
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 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)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3125.py
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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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 |
+
# Electronic Signature Policies
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc3125.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid5901
|
| 14 |
+
# https://www.rfc-editor.org/errata/eid5902
|
| 15 |
+
#
|
| 16 |
+
|
| 17 |
+
from pyasn1.type import constraint
|
| 18 |
+
from pyasn1.type import namedtype
|
| 19 |
+
from pyasn1.type import namedval
|
| 20 |
+
from pyasn1.type import tag
|
| 21 |
+
from pyasn1.type import useful
|
| 22 |
+
from pyasn1.type import univ
|
| 23 |
+
|
| 24 |
+
from pyasn1_modules import rfc5280
|
| 25 |
+
|
| 26 |
+
MAX = float('inf')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Imports from RFC 5280
|
| 30 |
+
|
| 31 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 32 |
+
|
| 33 |
+
Attribute = rfc5280.Attribute
|
| 34 |
+
|
| 35 |
+
AttributeType = rfc5280.AttributeType
|
| 36 |
+
|
| 37 |
+
AttributeTypeAndValue = rfc5280.AttributeTypeAndValue
|
| 38 |
+
|
| 39 |
+
AttributeValue = rfc5280.AttributeValue
|
| 40 |
+
|
| 41 |
+
Certificate = rfc5280.Certificate
|
| 42 |
+
|
| 43 |
+
CertificateList = rfc5280.CertificateList
|
| 44 |
+
|
| 45 |
+
DirectoryString = rfc5280.DirectoryString
|
| 46 |
+
|
| 47 |
+
GeneralName = rfc5280.GeneralName
|
| 48 |
+
|
| 49 |
+
GeneralNames = rfc5280.GeneralNames
|
| 50 |
+
|
| 51 |
+
Name = rfc5280.Name
|
| 52 |
+
|
| 53 |
+
PolicyInformation = rfc5280.PolicyInformation
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# Electronic Signature Policies
|
| 57 |
+
|
| 58 |
+
class CertPolicyId(univ.ObjectIdentifier):
|
| 59 |
+
pass
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class AcceptablePolicySet(univ.SequenceOf):
|
| 63 |
+
componentType = CertPolicyId()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class SignPolExtn(univ.Sequence):
|
| 67 |
+
componentType = namedtype.NamedTypes(
|
| 68 |
+
namedtype.NamedType('extnID', univ.ObjectIdentifier()),
|
| 69 |
+
namedtype.NamedType('extnValue', univ.OctetString())
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class SignPolExtensions(univ.SequenceOf):
|
| 74 |
+
componentType = SignPolExtn()
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class AlgAndLength(univ.Sequence):
|
| 78 |
+
componentType = namedtype.NamedTypes(
|
| 79 |
+
namedtype.NamedType('algID', univ.ObjectIdentifier()),
|
| 80 |
+
namedtype.OptionalNamedType('minKeyLength', univ.Integer()),
|
| 81 |
+
namedtype.OptionalNamedType('other', SignPolExtensions())
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class AlgorithmConstraints(univ.SequenceOf):
|
| 86 |
+
componentType = AlgAndLength()
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
class AlgorithmConstraintSet(univ.Sequence):
|
| 90 |
+
componentType = namedtype.NamedTypes(
|
| 91 |
+
namedtype.OptionalNamedType('signerAlgorithmConstraints',
|
| 92 |
+
AlgorithmConstraints().subtype(explicitTag=tag.Tag(
|
| 93 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 94 |
+
namedtype.OptionalNamedType('eeCertAlgorithmConstraints',
|
| 95 |
+
AlgorithmConstraints().subtype(explicitTag=tag.Tag(
|
| 96 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 97 |
+
namedtype.OptionalNamedType('caCertAlgorithmConstraints',
|
| 98 |
+
AlgorithmConstraints().subtype(explicitTag=tag.Tag(
|
| 99 |
+
tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 100 |
+
namedtype.OptionalNamedType('aaCertAlgorithmConstraints',
|
| 101 |
+
AlgorithmConstraints().subtype(explicitTag=tag.Tag(
|
| 102 |
+
tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 103 |
+
namedtype.OptionalNamedType('tsaCertAlgorithmConstraints',
|
| 104 |
+
AlgorithmConstraints().subtype(explicitTag=tag.Tag(
|
| 105 |
+
tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
class AttributeValueConstraints(univ.SequenceOf):
|
| 110 |
+
componentType = AttributeTypeAndValue()
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
class AttributeTypeConstraints(univ.SequenceOf):
|
| 114 |
+
componentType = AttributeType()
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class AttributeConstraints(univ.Sequence):
|
| 118 |
+
componentType = namedtype.NamedTypes(
|
| 119 |
+
namedtype.OptionalNamedType('attributeTypeConstarints',
|
| 120 |
+
AttributeTypeConstraints().subtype(explicitTag=tag.Tag(
|
| 121 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 122 |
+
namedtype.OptionalNamedType('attributeValueConstarints',
|
| 123 |
+
AttributeValueConstraints().subtype(explicitTag=tag.Tag(
|
| 124 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
class HowCertAttribute(univ.Enumerated):
|
| 129 |
+
namedValues = namedval.NamedValues(
|
| 130 |
+
('claimedAttribute', 0),
|
| 131 |
+
('certifiedAttribtes', 1),
|
| 132 |
+
('either', 2)
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class SkipCerts(univ.Integer):
|
| 137 |
+
subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
class PolicyConstraints(univ.Sequence):
|
| 141 |
+
componentType = namedtype.NamedTypes(
|
| 142 |
+
namedtype.OptionalNamedType('requireExplicitPolicy',
|
| 143 |
+
SkipCerts().subtype(explicitTag=tag.Tag(
|
| 144 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 145 |
+
namedtype.OptionalNamedType('inhibitPolicyMapping',
|
| 146 |
+
SkipCerts().subtype(explicitTag=tag.Tag(
|
| 147 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
class BaseDistance(univ.Integer):
|
| 152 |
+
subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class GeneralSubtree(univ.Sequence):
|
| 156 |
+
componentType = namedtype.NamedTypes(
|
| 157 |
+
namedtype.NamedType('base', GeneralName()),
|
| 158 |
+
namedtype.DefaultedNamedType('minimum',
|
| 159 |
+
BaseDistance().subtype(explicitTag=tag.Tag(
|
| 160 |
+
tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(
|
| 161 |
+
value=0)),
|
| 162 |
+
namedtype.OptionalNamedType('maximum',
|
| 163 |
+
BaseDistance().subtype(explicitTag=tag.Tag(
|
| 164 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
class GeneralSubtrees(univ.SequenceOf):
|
| 169 |
+
componentType = GeneralSubtree()
|
| 170 |
+
subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class NameConstraints(univ.Sequence):
|
| 174 |
+
componentType = namedtype.NamedTypes(
|
| 175 |
+
namedtype.OptionalNamedType('permittedSubtrees',
|
| 176 |
+
GeneralSubtrees().subtype(explicitTag=tag.Tag(
|
| 177 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 178 |
+
namedtype.OptionalNamedType('excludedSubtrees',
|
| 179 |
+
GeneralSubtrees().subtype(explicitTag=tag.Tag(
|
| 180 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
class PathLenConstraint(univ.Integer):
|
| 185 |
+
subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
class CertificateTrustPoint(univ.Sequence):
|
| 189 |
+
componentType = namedtype.NamedTypes(
|
| 190 |
+
namedtype.NamedType('trustpoint', Certificate()),
|
| 191 |
+
namedtype.OptionalNamedType('pathLenConstraint',
|
| 192 |
+
PathLenConstraint().subtype(explicitTag=tag.Tag(
|
| 193 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 194 |
+
namedtype.OptionalNamedType('acceptablePolicySet',
|
| 195 |
+
AcceptablePolicySet().subtype(explicitTag=tag.Tag(
|
| 196 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 197 |
+
namedtype.OptionalNamedType('nameConstraints',
|
| 198 |
+
NameConstraints().subtype(explicitTag=tag.Tag(
|
| 199 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 200 |
+
namedtype.OptionalNamedType('policyConstraints',
|
| 201 |
+
PolicyConstraints().subtype(explicitTag=tag.Tag(
|
| 202 |
+
tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
class CertificateTrustTrees(univ.SequenceOf):
|
| 207 |
+
componentType = CertificateTrustPoint()
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class EnuRevReq(univ.Enumerated):
|
| 211 |
+
namedValues = namedval.NamedValues(
|
| 212 |
+
('clrCheck', 0),
|
| 213 |
+
('ocspCheck', 1),
|
| 214 |
+
('bothCheck', 2),
|
| 215 |
+
('eitherCheck', 3),
|
| 216 |
+
('noCheck', 4),
|
| 217 |
+
('other', 5)
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
class RevReq(univ.Sequence):
|
| 222 |
+
componentType = namedtype.NamedTypes(
|
| 223 |
+
namedtype.NamedType('enuRevReq', EnuRevReq()),
|
| 224 |
+
namedtype.OptionalNamedType('exRevReq', SignPolExtensions())
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
class CertRevReq(univ.Sequence):
|
| 229 |
+
componentType = namedtype.NamedTypes(
|
| 230 |
+
namedtype.NamedType('endCertRevReq', RevReq()),
|
| 231 |
+
namedtype.NamedType('caCerts',
|
| 232 |
+
RevReq().subtype(explicitTag=tag.Tag(
|
| 233 |
+
tag.tagClassContext, tag.tagFormatConstructed, 0)))
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
class AttributeTrustCondition(univ.Sequence):
|
| 238 |
+
componentType = namedtype.NamedTypes(
|
| 239 |
+
namedtype.NamedType('attributeMandated', univ.Boolean()),
|
| 240 |
+
namedtype.NamedType('howCertAttribute', HowCertAttribute()),
|
| 241 |
+
namedtype.OptionalNamedType('attrCertificateTrustTrees',
|
| 242 |
+
CertificateTrustTrees().subtype(explicitTag=tag.Tag(
|
| 243 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 244 |
+
namedtype.OptionalNamedType('attrRevReq',
|
| 245 |
+
CertRevReq().subtype(explicitTag=tag.Tag(
|
| 246 |
+
tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 247 |
+
namedtype.OptionalNamedType('attributeConstraints',
|
| 248 |
+
AttributeConstraints().subtype(explicitTag=tag.Tag(
|
| 249 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2)))
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
class CMSAttrs(univ.SequenceOf):
|
| 254 |
+
componentType = univ.ObjectIdentifier()
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
class CertInfoReq(univ.Enumerated):
|
| 258 |
+
namedValues = namedval.NamedValues(
|
| 259 |
+
('none', 0),
|
| 260 |
+
('signerOnly', 1),
|
| 261 |
+
('fullPath', 2)
|
| 262 |
+
)
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
class CertRefReq(univ.Enumerated):
|
| 266 |
+
namedValues = namedval.NamedValues(
|
| 267 |
+
('signerOnly', 1),
|
| 268 |
+
('fullPath', 2)
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
class DeltaTime(univ.Sequence):
|
| 273 |
+
componentType = namedtype.NamedTypes(
|
| 274 |
+
namedtype.NamedType('deltaSeconds', univ.Integer()),
|
| 275 |
+
namedtype.NamedType('deltaMinutes', univ.Integer()),
|
| 276 |
+
namedtype.NamedType('deltaHours', univ.Integer()),
|
| 277 |
+
namedtype.NamedType('deltaDays', univ.Integer())
|
| 278 |
+
)
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
class TimestampTrustCondition(univ.Sequence):
|
| 282 |
+
componentType = namedtype.NamedTypes(
|
| 283 |
+
namedtype.OptionalNamedType('ttsCertificateTrustTrees',
|
| 284 |
+
CertificateTrustTrees().subtype(explicitTag=tag.Tag(
|
| 285 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 286 |
+
namedtype.OptionalNamedType('ttsRevReq',
|
| 287 |
+
CertRevReq().subtype(explicitTag=tag.Tag(
|
| 288 |
+
tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 289 |
+
namedtype.OptionalNamedType('ttsNameConstraints',
|
| 290 |
+
NameConstraints().subtype(explicitTag=tag.Tag(
|
| 291 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 292 |
+
namedtype.OptionalNamedType('cautionPeriod',
|
| 293 |
+
DeltaTime().subtype(explicitTag=tag.Tag(
|
| 294 |
+
tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 295 |
+
namedtype.OptionalNamedType('signatureTimestampDelay',
|
| 296 |
+
DeltaTime().subtype(explicitTag=tag.Tag(
|
| 297 |
+
tag.tagClassContext, tag.tagFormatConstructed, 4)))
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
class SignerRules(univ.Sequence):
|
| 302 |
+
componentType = namedtype.NamedTypes(
|
| 303 |
+
namedtype.OptionalNamedType('externalSignedData', univ.Boolean()),
|
| 304 |
+
namedtype.NamedType('mandatedSignedAttr', CMSAttrs()),
|
| 305 |
+
namedtype.NamedType('mandatedUnsignedAttr', CMSAttrs()),
|
| 306 |
+
namedtype.DefaultedNamedType('mandatedCertificateRef',
|
| 307 |
+
CertRefReq().subtype(explicitTag=tag.Tag(
|
| 308 |
+
tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(
|
| 309 |
+
value='signerOnly')),
|
| 310 |
+
namedtype.DefaultedNamedType('mandatedCertificateInfo',
|
| 311 |
+
CertInfoReq().subtype(explicitTag=tag.Tag(
|
| 312 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)).subtype(
|
| 313 |
+
value='none')),
|
| 314 |
+
namedtype.OptionalNamedType('signPolExtensions',
|
| 315 |
+
SignPolExtensions().subtype(explicitTag=tag.Tag(
|
| 316 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 317 |
+
)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class MandatedUnsignedAttr(CMSAttrs):
|
| 321 |
+
pass
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
class VerifierRules(univ.Sequence):
|
| 325 |
+
componentType = namedtype.NamedTypes(
|
| 326 |
+
namedtype.NamedType('mandatedUnsignedAttr', MandatedUnsignedAttr()),
|
| 327 |
+
namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
|
| 328 |
+
)
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
class SignerAndVerifierRules(univ.Sequence):
|
| 332 |
+
componentType = namedtype.NamedTypes(
|
| 333 |
+
namedtype.NamedType('signerRules', SignerRules()),
|
| 334 |
+
namedtype.NamedType('verifierRules', VerifierRules())
|
| 335 |
+
)
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
class SigningCertTrustCondition(univ.Sequence):
|
| 339 |
+
componentType = namedtype.NamedTypes(
|
| 340 |
+
namedtype.NamedType('signerTrustTrees', CertificateTrustTrees()),
|
| 341 |
+
namedtype.NamedType('signerRevReq', CertRevReq())
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
class CommitmentTypeIdentifier(univ.ObjectIdentifier):
|
| 346 |
+
pass
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
class FieldOfApplication(DirectoryString):
|
| 350 |
+
pass
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
class CommitmentType(univ.Sequence):
|
| 354 |
+
componentType = namedtype.NamedTypes(
|
| 355 |
+
namedtype.NamedType('identifier', CommitmentTypeIdentifier()),
|
| 356 |
+
namedtype.OptionalNamedType('fieldOfApplication',
|
| 357 |
+
FieldOfApplication().subtype(explicitTag=tag.Tag(
|
| 358 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 359 |
+
namedtype.OptionalNamedType('semantics',
|
| 360 |
+
DirectoryString().subtype(explicitTag=tag.Tag(
|
| 361 |
+
tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 362 |
+
)
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
class SelectedCommitmentTypes(univ.SequenceOf):
|
| 366 |
+
componentType = univ.Choice(componentType=namedtype.NamedTypes(
|
| 367 |
+
namedtype.NamedType('empty', univ.Null()),
|
| 368 |
+
namedtype.NamedType('recognizedCommitmentType', CommitmentType())
|
| 369 |
+
))
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
class CommitmentRule(univ.Sequence):
|
| 373 |
+
componentType = namedtype.NamedTypes(
|
| 374 |
+
namedtype.NamedType('selCommitmentTypes', SelectedCommitmentTypes()),
|
| 375 |
+
namedtype.OptionalNamedType('signerAndVeriferRules',
|
| 376 |
+
SignerAndVerifierRules().subtype(explicitTag=tag.Tag(
|
| 377 |
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 378 |
+
namedtype.OptionalNamedType('signingCertTrustCondition',
|
| 379 |
+
SigningCertTrustCondition().subtype(explicitTag=tag.Tag(
|
| 380 |
+
tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 381 |
+
namedtype.OptionalNamedType('timeStampTrustCondition',
|
| 382 |
+
TimestampTrustCondition().subtype(explicitTag=tag.Tag(
|
| 383 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 384 |
+
namedtype.OptionalNamedType('attributeTrustCondition',
|
| 385 |
+
AttributeTrustCondition().subtype(explicitTag=tag.Tag(
|
| 386 |
+
tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 387 |
+
namedtype.OptionalNamedType('algorithmConstraintSet',
|
| 388 |
+
AlgorithmConstraintSet().subtype(explicitTag=tag.Tag(
|
| 389 |
+
tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 390 |
+
namedtype.OptionalNamedType('signPolExtensions',
|
| 391 |
+
SignPolExtensions().subtype(explicitTag=tag.Tag(
|
| 392 |
+
tag.tagClassContext, tag.tagFormatSimple, 5)))
|
| 393 |
+
)
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
class CommitmentRules(univ.SequenceOf):
|
| 397 |
+
componentType = CommitmentRule()
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
class CommonRules(univ.Sequence):
|
| 401 |
+
componentType = namedtype.NamedTypes(
|
| 402 |
+
namedtype.OptionalNamedType('signerAndVeriferRules',
|
| 403 |
+
SignerAndVerifierRules().subtype(explicitTag=tag.Tag(
|
| 404 |
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 405 |
+
namedtype.OptionalNamedType('signingCertTrustCondition',
|
| 406 |
+
SigningCertTrustCondition().subtype(explicitTag=tag.Tag(
|
| 407 |
+
tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 408 |
+
namedtype.OptionalNamedType('timeStampTrustCondition',
|
| 409 |
+
TimestampTrustCondition().subtype(explicitTag=tag.Tag(
|
| 410 |
+
tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 411 |
+
namedtype.OptionalNamedType('attributeTrustCondition',
|
| 412 |
+
AttributeTrustCondition().subtype(explicitTag=tag.Tag(
|
| 413 |
+
tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 414 |
+
namedtype.OptionalNamedType('algorithmConstraintSet',
|
| 415 |
+
AlgorithmConstraintSet().subtype(explicitTag=tag.Tag(
|
| 416 |
+
tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 417 |
+
namedtype.OptionalNamedType('signPolExtensions',
|
| 418 |
+
SignPolExtensions().subtype(explicitTag=tag.Tag(
|
| 419 |
+
tag.tagClassContext, tag.tagFormatSimple, 5)))
|
| 420 |
+
)
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
class PolicyIssuerName(GeneralNames):
|
| 424 |
+
pass
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
class SignPolicyHash(univ.OctetString):
|
| 428 |
+
pass
|
| 429 |
+
|
| 430 |
+
|
| 431 |
+
class SignPolicyId(univ.ObjectIdentifier):
|
| 432 |
+
pass
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
class SigningPeriod(univ.Sequence):
|
| 436 |
+
componentType = namedtype.NamedTypes(
|
| 437 |
+
namedtype.NamedType('notBefore', useful.GeneralizedTime()),
|
| 438 |
+
namedtype.OptionalNamedType('notAfter', useful.GeneralizedTime())
|
| 439 |
+
)
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
class SignatureValidationPolicy(univ.Sequence):
|
| 443 |
+
componentType = namedtype.NamedTypes(
|
| 444 |
+
namedtype.NamedType('signingPeriod', SigningPeriod()),
|
| 445 |
+
namedtype.NamedType('commonRules', CommonRules()),
|
| 446 |
+
namedtype.NamedType('commitmentRules', CommitmentRules()),
|
| 447 |
+
namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
|
| 448 |
+
)
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
class SignPolicyInfo(univ.Sequence):
|
| 452 |
+
componentType = namedtype.NamedTypes(
|
| 453 |
+
namedtype.NamedType('signPolicyIdentifier', SignPolicyId()),
|
| 454 |
+
namedtype.NamedType('dateOfIssue', useful.GeneralizedTime()),
|
| 455 |
+
namedtype.NamedType('policyIssuerName', PolicyIssuerName()),
|
| 456 |
+
namedtype.NamedType('fieldOfApplication', FieldOfApplication()),
|
| 457 |
+
namedtype.NamedType('signatureValidationPolicy', SignatureValidationPolicy()),
|
| 458 |
+
namedtype.OptionalNamedType('signPolExtensions', SignPolExtensions())
|
| 459 |
+
)
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
class SignaturePolicy(univ.Sequence):
|
| 463 |
+
componentType = namedtype.NamedTypes(
|
| 464 |
+
namedtype.NamedType('signPolicyHashAlg', AlgorithmIdentifier()),
|
| 465 |
+
namedtype.NamedType('signPolicyInfo', SignPolicyInfo()),
|
| 466 |
+
namedtype.OptionalNamedType('signPolicyHash', SignPolicyHash())
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
)
|
evalkit_cambrian/lib/python3.10/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
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3739.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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 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 |
+
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc3820.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Diffie-Hellman Key Agreement
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc3820.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import namedtype
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class ProxyCertPathLengthConstraint(univ.Integer):
|
| 23 |
+
pass
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class ProxyPolicy(univ.Sequence):
|
| 27 |
+
componentType = namedtype.NamedTypes(
|
| 28 |
+
namedtype.NamedType('policyLanguage', univ.ObjectIdentifier()),
|
| 29 |
+
namedtype.OptionalNamedType('policy', univ.OctetString())
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class ProxyCertInfoExtension(univ.Sequence):
|
| 34 |
+
componentType = namedtype.NamedTypes(
|
| 35 |
+
namedtype.OptionalNamedType('pCPathLenConstraint',
|
| 36 |
+
ProxyCertPathLengthConstraint()),
|
| 37 |
+
namedtype.NamedType('proxyPolicy', ProxyPolicy())
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
id_pe = id_pkix + (1, )
|
| 45 |
+
|
| 46 |
+
id_pe_proxyCertInfo = id_pe + (14, )
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
id_ppl = id_pkix + (21, )
|
| 50 |
+
|
| 51 |
+
id_ppl_anyLanguage = id_ppl + (0, )
|
| 52 |
+
|
| 53 |
+
id_ppl_inheritAll = id_ppl + (1, )
|
| 54 |
+
|
| 55 |
+
id_ppl_independent = id_ppl + (2, )
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# Map of Certificate Extension OIDs to Extensions added to the
|
| 59 |
+
# ones that are in rfc5280.py
|
| 60 |
+
|
| 61 |
+
_certificateExtensionsMapUpdate = {
|
| 62 |
+
id_pe_proxyCertInfo: ProxyCertInfoExtension(),
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4073.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley with some assistance from asn1ate v.0.6.0.
|
| 5 |
+
# Modified by Russ Housley to add a map for use with opentypes.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 8 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 9 |
+
#
|
| 10 |
+
# Protecting Multiple Contents with the CMS
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc4073.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
from pyasn1_modules import rfc5652
|
| 21 |
+
|
| 22 |
+
MAX = float('inf')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# Content Collection Content Type and Object Identifier
|
| 26 |
+
|
| 27 |
+
id_ct_contentCollection = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.19')
|
| 28 |
+
|
| 29 |
+
class ContentCollection(univ.SequenceOf):
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
ContentCollection.componentType = rfc5652.ContentInfo()
|
| 33 |
+
ContentCollection.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
# Content With Attributes Content Type and Object Identifier
|
| 37 |
+
|
| 38 |
+
id_ct_contentWithAttrs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.20')
|
| 39 |
+
|
| 40 |
+
class ContentWithAttributes(univ.Sequence):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
ContentWithAttributes.componentType = namedtype.NamedTypes(
|
| 44 |
+
namedtype.NamedType('content', rfc5652.ContentInfo()),
|
| 45 |
+
namedtype.NamedType('attrs', univ.SequenceOf(
|
| 46 |
+
componentType=rfc5652.Attribute()).subtype(
|
| 47 |
+
sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Map of Content Type OIDs to Content Types is added to the
|
| 52 |
+
# ones that are in rfc5652.py
|
| 53 |
+
|
| 54 |
+
_cmsContentTypesMapUpdate = {
|
| 55 |
+
id_ct_contentCollection: ContentCollection(),
|
| 56 |
+
id_ct_contentWithAttrs: ContentWithAttributes(),
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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()
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4211.py
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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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 |
+
# Copyright (c) 2005-2020, Ilya Etingof <[email protected]>
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Internet X.509 Public Key Infrastructure Certificate Request
|
| 10 |
+
# Message Format (CRMF)
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# http://www.ietf.org/rfc/rfc4211.txt
|
| 14 |
+
#
|
| 15 |
+
from pyasn1.type import char
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import namedval
|
| 19 |
+
from pyasn1.type import tag
|
| 20 |
+
from pyasn1.type import univ
|
| 21 |
+
|
| 22 |
+
from pyasn1_modules import rfc3280
|
| 23 |
+
from pyasn1_modules import rfc3852
|
| 24 |
+
|
| 25 |
+
MAX = float('inf')
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _buildOid(*components):
|
| 29 |
+
output = []
|
| 30 |
+
for x in tuple(components):
|
| 31 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 32 |
+
output.extend(list(x))
|
| 33 |
+
else:
|
| 34 |
+
output.append(int(x))
|
| 35 |
+
|
| 36 |
+
return univ.ObjectIdentifier(output)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
id_pkix = _buildOid(1, 3, 6, 1, 5, 5, 7)
|
| 40 |
+
|
| 41 |
+
id_pkip = _buildOid(id_pkix, 5)
|
| 42 |
+
|
| 43 |
+
id_regCtrl = _buildOid(id_pkip, 1)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class SinglePubInfo(univ.Sequence):
|
| 47 |
+
pass
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
SinglePubInfo.componentType = namedtype.NamedTypes(
|
| 51 |
+
namedtype.NamedType('pubMethod', univ.Integer(
|
| 52 |
+
namedValues=namedval.NamedValues(('dontCare', 0), ('x500', 1), ('web', 2), ('ldap', 3)))),
|
| 53 |
+
namedtype.OptionalNamedType('pubLocation', rfc3280.GeneralName())
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class UTF8Pairs(char.UTF8String):
|
| 58 |
+
pass
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class PKMACValue(univ.Sequence):
|
| 62 |
+
pass
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
PKMACValue.componentType = namedtype.NamedTypes(
|
| 66 |
+
namedtype.NamedType('algId', rfc3280.AlgorithmIdentifier()),
|
| 67 |
+
namedtype.NamedType('value', univ.BitString())
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
class POPOSigningKeyInput(univ.Sequence):
|
| 72 |
+
pass
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
POPOSigningKeyInput.componentType = namedtype.NamedTypes(
|
| 76 |
+
namedtype.NamedType(
|
| 77 |
+
'authInfo', univ.Choice(
|
| 78 |
+
componentType=namedtype.NamedTypes(
|
| 79 |
+
namedtype.NamedType(
|
| 80 |
+
'sender', rfc3280.GeneralName().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))
|
| 81 |
+
),
|
| 82 |
+
namedtype.NamedType(
|
| 83 |
+
'publicKeyMAC', PKMACValue()
|
| 84 |
+
)
|
| 85 |
+
)
|
| 86 |
+
)
|
| 87 |
+
),
|
| 88 |
+
namedtype.NamedType('publicKey', rfc3280.SubjectPublicKeyInfo())
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class POPOSigningKey(univ.Sequence):
|
| 93 |
+
pass
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
POPOSigningKey.componentType = namedtype.NamedTypes(
|
| 97 |
+
namedtype.OptionalNamedType('poposkInput', POPOSigningKeyInput().subtype(
|
| 98 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 99 |
+
namedtype.NamedType('algorithmIdentifier', rfc3280.AlgorithmIdentifier()),
|
| 100 |
+
namedtype.NamedType('signature', univ.BitString())
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
class Attributes(univ.SetOf):
|
| 105 |
+
pass
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
Attributes.componentType = rfc3280.Attribute()
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
class PrivateKeyInfo(univ.Sequence):
|
| 112 |
+
pass
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
PrivateKeyInfo.componentType = namedtype.NamedTypes(
|
| 116 |
+
namedtype.NamedType('version', univ.Integer()),
|
| 117 |
+
namedtype.NamedType('privateKeyAlgorithm', rfc3280.AlgorithmIdentifier()),
|
| 118 |
+
namedtype.NamedType('privateKey', univ.OctetString()),
|
| 119 |
+
namedtype.OptionalNamedType('attributes',
|
| 120 |
+
Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class EncryptedValue(univ.Sequence):
|
| 125 |
+
pass
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
EncryptedValue.componentType = namedtype.NamedTypes(
|
| 129 |
+
namedtype.OptionalNamedType('intendedAlg', rfc3280.AlgorithmIdentifier().subtype(
|
| 130 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 131 |
+
namedtype.OptionalNamedType('symmAlg', rfc3280.AlgorithmIdentifier().subtype(
|
| 132 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 133 |
+
namedtype.OptionalNamedType('encSymmKey', univ.BitString().subtype(
|
| 134 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 135 |
+
namedtype.OptionalNamedType('keyAlg', rfc3280.AlgorithmIdentifier().subtype(
|
| 136 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 137 |
+
namedtype.OptionalNamedType('valueHint', univ.OctetString().subtype(
|
| 138 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))),
|
| 139 |
+
namedtype.NamedType('encValue', univ.BitString())
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class EncryptedKey(univ.Choice):
|
| 144 |
+
pass
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
EncryptedKey.componentType = namedtype.NamedTypes(
|
| 148 |
+
namedtype.NamedType('encryptedValue', EncryptedValue()),
|
| 149 |
+
namedtype.NamedType('envelopedData', rfc3852.EnvelopedData().subtype(
|
| 150 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
class KeyGenParameters(univ.OctetString):
|
| 155 |
+
pass
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class PKIArchiveOptions(univ.Choice):
|
| 159 |
+
pass
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
PKIArchiveOptions.componentType = namedtype.NamedTypes(
|
| 163 |
+
namedtype.NamedType('encryptedPrivKey',
|
| 164 |
+
EncryptedKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 165 |
+
namedtype.NamedType('keyGenParameters',
|
| 166 |
+
KeyGenParameters().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 167 |
+
namedtype.NamedType('archiveRemGenPrivKey',
|
| 168 |
+
univ.Boolean().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
id_regCtrl_authenticator = _buildOid(id_regCtrl, 2)
|
| 172 |
+
|
| 173 |
+
id_regInfo = _buildOid(id_pkip, 2)
|
| 174 |
+
|
| 175 |
+
id_regInfo_certReq = _buildOid(id_regInfo, 2)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
class ProtocolEncrKey(rfc3280.SubjectPublicKeyInfo):
|
| 179 |
+
pass
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
class Authenticator(char.UTF8String):
|
| 183 |
+
pass
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
class SubsequentMessage(univ.Integer):
|
| 187 |
+
pass
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
SubsequentMessage.namedValues = namedval.NamedValues(
|
| 191 |
+
('encrCert', 0),
|
| 192 |
+
('challengeResp', 1)
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
class AttributeTypeAndValue(univ.Sequence):
|
| 197 |
+
pass
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
AttributeTypeAndValue.componentType = namedtype.NamedTypes(
|
| 201 |
+
namedtype.NamedType('type', univ.ObjectIdentifier()),
|
| 202 |
+
namedtype.NamedType('value', univ.Any())
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
class POPOPrivKey(univ.Choice):
|
| 207 |
+
pass
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
POPOPrivKey.componentType = namedtype.NamedTypes(
|
| 211 |
+
namedtype.NamedType('thisMessage',
|
| 212 |
+
univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 213 |
+
namedtype.NamedType('subsequentMessage',
|
| 214 |
+
SubsequentMessage().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 215 |
+
namedtype.NamedType('dhMAC',
|
| 216 |
+
univ.BitString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 217 |
+
namedtype.NamedType('agreeMAC',
|
| 218 |
+
PKMACValue().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 219 |
+
namedtype.NamedType('encryptedKey', rfc3852.EnvelopedData().subtype(
|
| 220 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 221 |
+
)
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class ProofOfPossession(univ.Choice):
|
| 225 |
+
pass
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
ProofOfPossession.componentType = namedtype.NamedTypes(
|
| 229 |
+
namedtype.NamedType('raVerified',
|
| 230 |
+
univ.Null().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 231 |
+
namedtype.NamedType('signature', POPOSigningKey().subtype(
|
| 232 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
|
| 233 |
+
namedtype.NamedType('keyEncipherment',
|
| 234 |
+
POPOPrivKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
|
| 235 |
+
namedtype.NamedType('keyAgreement',
|
| 236 |
+
POPOPrivKey().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class OptionalValidity(univ.Sequence):
|
| 241 |
+
pass
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
OptionalValidity.componentType = namedtype.NamedTypes(
|
| 245 |
+
namedtype.OptionalNamedType('notBefore', rfc3280.Time().subtype(
|
| 246 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 247 |
+
namedtype.OptionalNamedType('notAfter', rfc3280.Time().subtype(
|
| 248 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
class CertTemplate(univ.Sequence):
|
| 253 |
+
pass
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
CertTemplate.componentType = namedtype.NamedTypes(
|
| 257 |
+
namedtype.OptionalNamedType('version', rfc3280.Version().subtype(
|
| 258 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 259 |
+
namedtype.OptionalNamedType('serialNumber', univ.Integer().subtype(
|
| 260 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 261 |
+
namedtype.OptionalNamedType('signingAlg', rfc3280.AlgorithmIdentifier().subtype(
|
| 262 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 263 |
+
namedtype.OptionalNamedType('issuer', rfc3280.Name().subtype(
|
| 264 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
|
| 265 |
+
namedtype.OptionalNamedType('validity', OptionalValidity().subtype(
|
| 266 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4))),
|
| 267 |
+
namedtype.OptionalNamedType('subject', rfc3280.Name().subtype(
|
| 268 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5))),
|
| 269 |
+
namedtype.OptionalNamedType('publicKey', rfc3280.SubjectPublicKeyInfo().subtype(
|
| 270 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))),
|
| 271 |
+
namedtype.OptionalNamedType('issuerUID', rfc3280.UniqueIdentifier().subtype(
|
| 272 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
|
| 273 |
+
namedtype.OptionalNamedType('subjectUID', rfc3280.UniqueIdentifier().subtype(
|
| 274 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))),
|
| 275 |
+
namedtype.OptionalNamedType('extensions', rfc3280.Extensions().subtype(
|
| 276 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 9)))
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
class Controls(univ.SequenceOf):
|
| 281 |
+
pass
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
Controls.componentType = AttributeTypeAndValue()
|
| 285 |
+
Controls.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
class CertRequest(univ.Sequence):
|
| 289 |
+
pass
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
CertRequest.componentType = namedtype.NamedTypes(
|
| 293 |
+
namedtype.NamedType('certReqId', univ.Integer()),
|
| 294 |
+
namedtype.NamedType('certTemplate', CertTemplate()),
|
| 295 |
+
namedtype.OptionalNamedType('controls', Controls())
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
class CertReqMsg(univ.Sequence):
|
| 300 |
+
pass
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
CertReqMsg.componentType = namedtype.NamedTypes(
|
| 304 |
+
namedtype.NamedType('certReq', CertRequest()),
|
| 305 |
+
namedtype.OptionalNamedType('popo', ProofOfPossession()),
|
| 306 |
+
namedtype.OptionalNamedType('regInfo', univ.SequenceOf(componentType=AttributeTypeAndValue()))
|
| 307 |
+
)
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class CertReqMessages(univ.SequenceOf):
|
| 311 |
+
pass
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
CertReqMessages.componentType = CertReqMsg()
|
| 315 |
+
CertReqMessages.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
class CertReq(CertRequest):
|
| 319 |
+
pass
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
id_regCtrl_pkiPublicationInfo = _buildOid(id_regCtrl, 3)
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
class CertId(univ.Sequence):
|
| 326 |
+
pass
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
CertId.componentType = namedtype.NamedTypes(
|
| 330 |
+
namedtype.NamedType('issuer', rfc3280.GeneralName()),
|
| 331 |
+
namedtype.NamedType('serialNumber', univ.Integer())
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
class OldCertId(CertId):
|
| 336 |
+
pass
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
class PKIPublicationInfo(univ.Sequence):
|
| 340 |
+
pass
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
PKIPublicationInfo.componentType = namedtype.NamedTypes(
|
| 344 |
+
namedtype.NamedType('action',
|
| 345 |
+
univ.Integer(namedValues=namedval.NamedValues(('dontPublish', 0), ('pleasePublish', 1)))),
|
| 346 |
+
namedtype.OptionalNamedType('pubInfos', univ.SequenceOf(componentType=SinglePubInfo()))
|
| 347 |
+
)
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
class EncKeyWithID(univ.Sequence):
|
| 351 |
+
pass
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
EncKeyWithID.componentType = namedtype.NamedTypes(
|
| 355 |
+
namedtype.NamedType('privateKey', PrivateKeyInfo()),
|
| 356 |
+
namedtype.OptionalNamedType(
|
| 357 |
+
'identifier', univ.Choice(
|
| 358 |
+
componentType=namedtype.NamedTypes(
|
| 359 |
+
namedtype.NamedType('string', char.UTF8String()),
|
| 360 |
+
namedtype.NamedType('generalName', rfc3280.GeneralName())
|
| 361 |
+
)
|
| 362 |
+
)
|
| 363 |
+
)
|
| 364 |
+
)
|
| 365 |
+
|
| 366 |
+
id_regCtrl_protocolEncrKey = _buildOid(id_regCtrl, 6)
|
| 367 |
+
|
| 368 |
+
id_regCtrl_oldCertID = _buildOid(id_regCtrl, 5)
|
| 369 |
+
|
| 370 |
+
id_smime = _buildOid(1, 2, 840, 113549, 1, 9, 16)
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
class PBMParameter(univ.Sequence):
|
| 374 |
+
pass
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
PBMParameter.componentType = namedtype.NamedTypes(
|
| 378 |
+
namedtype.NamedType('salt', univ.OctetString()),
|
| 379 |
+
namedtype.NamedType('owf', rfc3280.AlgorithmIdentifier()),
|
| 380 |
+
namedtype.NamedType('iterationCount', univ.Integer()),
|
| 381 |
+
namedtype.NamedType('mac', rfc3280.AlgorithmIdentifier())
|
| 382 |
+
)
|
| 383 |
+
|
| 384 |
+
id_regCtrl_regToken = _buildOid(id_regCtrl, 1)
|
| 385 |
+
|
| 386 |
+
id_regCtrl_pkiArchiveOptions = _buildOid(id_regCtrl, 4)
|
| 387 |
+
|
| 388 |
+
id_regInfo_utf8Pairs = _buildOid(id_regInfo, 1)
|
| 389 |
+
|
| 390 |
+
id_ct = _buildOid(id_smime, 1)
|
| 391 |
+
|
| 392 |
+
id_ct_encKeyWithID = _buildOid(id_ct, 21)
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
class RegToken(char.UTF8String):
|
| 396 |
+
pass
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4334.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Certificate Extensions and Attributes Supporting Authentication
|
| 10 |
+
# in PPP and Wireless LAN Networks
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc4334.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import constraint
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
|
| 21 |
+
MAX = float('inf')
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# OID Arcs
|
| 25 |
+
|
| 26 |
+
id_pe = univ.ObjectIdentifier('1.3.6.1.5.5.7.1')
|
| 27 |
+
|
| 28 |
+
id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
|
| 29 |
+
|
| 30 |
+
id_aca = univ.ObjectIdentifier('1.3.6.1.5.5.7.10')
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Extended Key Usage Values
|
| 34 |
+
|
| 35 |
+
id_kp_eapOverPPP = id_kp + (13, )
|
| 36 |
+
|
| 37 |
+
id_kp_eapOverLAN = id_kp + (14, )
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Wireless LAN SSID Extension
|
| 41 |
+
|
| 42 |
+
id_pe_wlanSSID = id_pe + (13, )
|
| 43 |
+
|
| 44 |
+
class SSID(univ.OctetString):
|
| 45 |
+
constraint.ValueSizeConstraint(1, 32)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class SSIDList(univ.SequenceOf):
|
| 49 |
+
componentType = SSID()
|
| 50 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# Wireless LAN SSID Attribute Certificate Attribute
|
| 54 |
+
|
| 55 |
+
id_aca_wlanSSID = id_aca + (7, )
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# Map of Certificate Extension OIDs to Extensions
|
| 59 |
+
# To be added to the ones that are in rfc5280.py
|
| 60 |
+
|
| 61 |
+
_certificateExtensionsMap = {
|
| 62 |
+
id_pe_wlanSSID: SSIDList(),
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
# Map of AttributeType OIDs to AttributeValue added to the
|
| 69 |
+
# ones that are in rfc5280.py
|
| 70 |
+
|
| 71 |
+
_certificateAttributesMapUpdate = {
|
| 72 |
+
id_aca_wlanSSID: SSIDList(),
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4357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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 |
+
# Additional Cryptographic Algorithms for Use with GOST 28147-89,
|
| 10 |
+
# GOST R 34.10-94, GOST R 34.10-2001, and GOST R 34.11-94 Algorithms
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc4357.txt
|
| 14 |
+
# https://www.rfc-editor.org/errata/eid5927
|
| 15 |
+
# https://www.rfc-editor.org/errata/eid5928
|
| 16 |
+
#
|
| 17 |
+
|
| 18 |
+
from pyasn1.type import constraint
|
| 19 |
+
from pyasn1.type import namedtype
|
| 20 |
+
from pyasn1.type import namedval
|
| 21 |
+
from pyasn1.type import tag
|
| 22 |
+
from pyasn1.type import univ
|
| 23 |
+
|
| 24 |
+
from pyasn1_modules import rfc5280
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Import from RFC 5280
|
| 28 |
+
|
| 29 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# Object Identifiers
|
| 33 |
+
|
| 34 |
+
id_CryptoPro = univ.ObjectIdentifier((1, 2, 643, 2, 2,))
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
id_CryptoPro_modules = id_CryptoPro + (1, 1,)
|
| 38 |
+
|
| 39 |
+
id_CryptoPro_extensions = id_CryptoPro + (34,)
|
| 40 |
+
|
| 41 |
+
id_CryptoPro_policyIds = id_CryptoPro + (38,)
|
| 42 |
+
|
| 43 |
+
id_CryptoPro_policyQt = id_CryptoPro + (39,)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
cryptographic_Gost_Useful_Definitions = id_CryptoPro_modules + (0, 1,)
|
| 47 |
+
|
| 48 |
+
gostR3411_94_DigestSyntax = id_CryptoPro_modules + (1, 1,)
|
| 49 |
+
|
| 50 |
+
gostR3410_94_PKISyntax = id_CryptoPro_modules + (2, 1,)
|
| 51 |
+
|
| 52 |
+
gostR3410_94_SignatureSyntax = id_CryptoPro_modules + (3, 1,)
|
| 53 |
+
|
| 54 |
+
gost28147_89_EncryptionSyntax = id_CryptoPro_modules + (4, 1,)
|
| 55 |
+
|
| 56 |
+
gostR3410_EncryptionSyntax = id_CryptoPro_modules + (5, 2,)
|
| 57 |
+
|
| 58 |
+
gost28147_89_ParamSetSyntax = id_CryptoPro_modules + (6, 1,)
|
| 59 |
+
|
| 60 |
+
gostR3411_94_ParamSetSyntax = id_CryptoPro_modules + (7, 1,)
|
| 61 |
+
|
| 62 |
+
gostR3410_94_ParamSetSyntax = id_CryptoPro_modules + (8, 1, 1)
|
| 63 |
+
|
| 64 |
+
gostR3410_2001_PKISyntax = id_CryptoPro_modules + (9, 1,)
|
| 65 |
+
|
| 66 |
+
gostR3410_2001_SignatureSyntax = id_CryptoPro_modules + (10, 1,)
|
| 67 |
+
|
| 68 |
+
gostR3410_2001_ParamSetSyntax = id_CryptoPro_modules + (12, 1,)
|
| 69 |
+
|
| 70 |
+
gost_CryptoPro_ExtendedKeyUsage = id_CryptoPro_modules + (13, 1,)
|
| 71 |
+
|
| 72 |
+
gost_CryptoPro_PrivateKey = id_CryptoPro_modules + (14, 1,)
|
| 73 |
+
|
| 74 |
+
gost_CryptoPro_PKIXCMP = id_CryptoPro_modules + (15, 1,)
|
| 75 |
+
|
| 76 |
+
gost_CryptoPro_TLS = id_CryptoPro_modules + (16, 1,)
|
| 77 |
+
|
| 78 |
+
gost_CryptoPro_Policy = id_CryptoPro_modules + (17, 1,)
|
| 79 |
+
|
| 80 |
+
gost_CryptoPro_Constants = id_CryptoPro_modules + (18, 1,)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
id_CryptoPro_algorithms = id_CryptoPro
|
| 84 |
+
|
| 85 |
+
id_GostR3411_94_with_GostR3410_2001 = id_CryptoPro_algorithms + (3,)
|
| 86 |
+
|
| 87 |
+
id_GostR3411_94_with_GostR3410_94 = id_CryptoPro_algorithms + (4,)
|
| 88 |
+
|
| 89 |
+
id_GostR3411_94 = id_CryptoPro_algorithms + (9,)
|
| 90 |
+
|
| 91 |
+
id_Gost28147_89_None_KeyMeshing = id_CryptoPro_algorithms + (14, 0,)
|
| 92 |
+
|
| 93 |
+
id_Gost28147_89_CryptoPro_KeyMeshing = id_CryptoPro_algorithms + (14, 1,)
|
| 94 |
+
|
| 95 |
+
id_GostR3410_2001 = id_CryptoPro_algorithms + (19,)
|
| 96 |
+
|
| 97 |
+
id_GostR3410_94 = id_CryptoPro_algorithms + (20,)
|
| 98 |
+
|
| 99 |
+
id_Gost28147_89 = id_CryptoPro_algorithms + (21,)
|
| 100 |
+
|
| 101 |
+
id_Gost28147_89_MAC = id_CryptoPro_algorithms + (22,)
|
| 102 |
+
|
| 103 |
+
id_CryptoPro_hashes = id_CryptoPro_algorithms + (30,)
|
| 104 |
+
|
| 105 |
+
id_CryptoPro_encrypts = id_CryptoPro_algorithms + (31,)
|
| 106 |
+
|
| 107 |
+
id_CryptoPro_signs = id_CryptoPro_algorithms + (32,)
|
| 108 |
+
|
| 109 |
+
id_CryptoPro_exchanges = id_CryptoPro_algorithms + (33,)
|
| 110 |
+
|
| 111 |
+
id_CryptoPro_ecc_signs = id_CryptoPro_algorithms + (35,)
|
| 112 |
+
|
| 113 |
+
id_CryptoPro_ecc_exchanges = id_CryptoPro_algorithms + (36,)
|
| 114 |
+
|
| 115 |
+
id_CryptoPro_private_keys = id_CryptoPro_algorithms + (37,)
|
| 116 |
+
|
| 117 |
+
id_CryptoPro_pkixcmp_infos = id_CryptoPro_algorithms + (41,)
|
| 118 |
+
|
| 119 |
+
id_CryptoPro_audit_service_types = id_CryptoPro_algorithms + (42,)
|
| 120 |
+
|
| 121 |
+
id_CryptoPro_audit_record_types = id_CryptoPro_algorithms + (43,)
|
| 122 |
+
|
| 123 |
+
id_CryptoPro_attributes = id_CryptoPro_algorithms + (44,)
|
| 124 |
+
|
| 125 |
+
id_CryptoPro_name_service_types = id_CryptoPro_algorithms + (45,)
|
| 126 |
+
|
| 127 |
+
id_GostR3410_2001DH = id_CryptoPro_algorithms + (98,)
|
| 128 |
+
|
| 129 |
+
id_GostR3410_94DH = id_CryptoPro_algorithms + (99,)
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
id_Gost28147_89_TestParamSet = id_CryptoPro_encrypts + (0,)
|
| 133 |
+
|
| 134 |
+
id_Gost28147_89_CryptoPro_A_ParamSet = id_CryptoPro_encrypts + (1,)
|
| 135 |
+
|
| 136 |
+
id_Gost28147_89_CryptoPro_B_ParamSet = id_CryptoPro_encrypts + (2,)
|
| 137 |
+
|
| 138 |
+
id_Gost28147_89_CryptoPro_C_ParamSet = id_CryptoPro_encrypts + (3,)
|
| 139 |
+
|
| 140 |
+
id_Gost28147_89_CryptoPro_D_ParamSet = id_CryptoPro_encrypts + (4,)
|
| 141 |
+
|
| 142 |
+
id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet = id_CryptoPro_encrypts + (5,)
|
| 143 |
+
|
| 144 |
+
id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet = id_CryptoPro_encrypts + (6,)
|
| 145 |
+
|
| 146 |
+
id_Gost28147_89_CryptoPro_RIC_1_ParamSet = id_CryptoPro_encrypts + (7,)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
id_GostR3410_2001_TestParamSet = id_CryptoPro_ecc_signs + (0,)
|
| 150 |
+
|
| 151 |
+
id_GostR3410_2001_CryptoPro_A_ParamSet = id_CryptoPro_ecc_signs + (1,)
|
| 152 |
+
|
| 153 |
+
id_GostR3410_2001_CryptoPro_B_ParamSet = id_CryptoPro_ecc_signs + (2,)
|
| 154 |
+
|
| 155 |
+
id_GostR3410_2001_CryptoPro_C_ParamSet = id_CryptoPro_ecc_signs + (3,)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
id_GostR3410_2001_CryptoPro_XchA_ParamSet = id_CryptoPro_ecc_exchanges + (0,)
|
| 159 |
+
|
| 160 |
+
id_GostR3410_2001_CryptoPro_XchB_ParamSet = id_CryptoPro_ecc_exchanges + (1,)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
id_GostR3410_94_TestParamSet = id_CryptoPro_signs + (0,)
|
| 164 |
+
|
| 165 |
+
id_GostR3410_94_CryptoPro_A_ParamSet = id_CryptoPro_signs + (2,)
|
| 166 |
+
|
| 167 |
+
id_GostR3410_94_CryptoPro_B_ParamSet = id_CryptoPro_signs + (3,)
|
| 168 |
+
|
| 169 |
+
id_GostR3410_94_CryptoPro_C_ParamSet = id_CryptoPro_signs + (4,)
|
| 170 |
+
|
| 171 |
+
id_GostR3410_94_CryptoPro_D_ParamSet = id_CryptoPro_signs + (5,)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
id_GostR3410_94_CryptoPro_XchA_ParamSet = id_CryptoPro_exchanges + (1,)
|
| 175 |
+
|
| 176 |
+
id_GostR3410_94_CryptoPro_XchB_ParamSet = id_CryptoPro_exchanges + (2,)
|
| 177 |
+
|
| 178 |
+
id_GostR3410_94_CryptoPro_XchC_ParamSet = id_CryptoPro_exchanges + (3,)
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
id_GostR3410_94_a = id_GostR3410_94 + (1,)
|
| 182 |
+
|
| 183 |
+
id_GostR3410_94_aBis = id_GostR3410_94 + (2,)
|
| 184 |
+
|
| 185 |
+
id_GostR3410_94_b = id_GostR3410_94 + (3,)
|
| 186 |
+
|
| 187 |
+
id_GostR3410_94_bBis = id_GostR3410_94 + (4,)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
id_GostR3411_94_TestParamSet = id_CryptoPro_hashes + (0,)
|
| 191 |
+
|
| 192 |
+
id_GostR3411_94_CryptoProParamSet = id_CryptoPro_hashes + (1,)
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
class Gost28147_89_ParamSet(univ.ObjectIdentifier):
|
| 198 |
+
pass
|
| 199 |
+
|
| 200 |
+
Gost28147_89_ParamSet.subtypeSpec = constraint.SingleValueConstraint(
|
| 201 |
+
id_Gost28147_89_TestParamSet,
|
| 202 |
+
id_Gost28147_89_CryptoPro_A_ParamSet,
|
| 203 |
+
id_Gost28147_89_CryptoPro_B_ParamSet,
|
| 204 |
+
id_Gost28147_89_CryptoPro_C_ParamSet,
|
| 205 |
+
id_Gost28147_89_CryptoPro_D_ParamSet,
|
| 206 |
+
id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet,
|
| 207 |
+
id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet,
|
| 208 |
+
id_Gost28147_89_CryptoPro_RIC_1_ParamSet
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
class Gost28147_89_BlobParameters(univ.Sequence):
|
| 213 |
+
pass
|
| 214 |
+
|
| 215 |
+
Gost28147_89_BlobParameters.componentType = namedtype.NamedTypes(
|
| 216 |
+
namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet())
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class Gost28147_89_MAC(univ.OctetString):
|
| 221 |
+
pass
|
| 222 |
+
|
| 223 |
+
Gost28147_89_MAC.subtypeSpec = constraint.ValueSizeConstraint(1, 4)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class Gost28147_89_Key(univ.OctetString):
|
| 227 |
+
pass
|
| 228 |
+
|
| 229 |
+
Gost28147_89_Key.subtypeSpec = constraint.ValueSizeConstraint(32, 32)
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
class Gost28147_89_EncryptedKey(univ.Sequence):
|
| 233 |
+
pass
|
| 234 |
+
|
| 235 |
+
Gost28147_89_EncryptedKey.componentType = namedtype.NamedTypes(
|
| 236 |
+
namedtype.NamedType('encryptedKey', Gost28147_89_Key()),
|
| 237 |
+
namedtype.OptionalNamedType('maskKey', Gost28147_89_Key().subtype(
|
| 238 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 239 |
+
namedtype.NamedType('macKey', Gost28147_89_MAC())
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class Gost28147_89_IV(univ.OctetString):
|
| 244 |
+
pass
|
| 245 |
+
|
| 246 |
+
Gost28147_89_IV.subtypeSpec = constraint.ValueSizeConstraint(8, 8)
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
class Gost28147_89_UZ(univ.OctetString):
|
| 250 |
+
pass
|
| 251 |
+
|
| 252 |
+
Gost28147_89_UZ.subtypeSpec = constraint.ValueSizeConstraint(64, 64)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
class Gost28147_89_ParamSetParameters(univ.Sequence):
|
| 256 |
+
pass
|
| 257 |
+
|
| 258 |
+
Gost28147_89_ParamSetParameters.componentType = namedtype.NamedTypes(
|
| 259 |
+
namedtype.NamedType('eUZ', Gost28147_89_UZ()),
|
| 260 |
+
namedtype.NamedType('mode',
|
| 261 |
+
univ.Integer(namedValues=namedval.NamedValues(
|
| 262 |
+
('gost28147-89-CNT', 0),
|
| 263 |
+
('gost28147-89-CFB', 1),
|
| 264 |
+
('cryptoPro-CBC', 2)
|
| 265 |
+
))),
|
| 266 |
+
namedtype.NamedType('shiftBits',
|
| 267 |
+
univ.Integer(namedValues=namedval.NamedValues(
|
| 268 |
+
('gost28147-89-block', 64)
|
| 269 |
+
))),
|
| 270 |
+
namedtype.NamedType('keyMeshing', AlgorithmIdentifier())
|
| 271 |
+
)
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
class Gost28147_89_Parameters(univ.Sequence):
|
| 275 |
+
pass
|
| 276 |
+
|
| 277 |
+
Gost28147_89_Parameters.componentType = namedtype.NamedTypes(
|
| 278 |
+
namedtype.NamedType('iv', Gost28147_89_IV()),
|
| 279 |
+
namedtype.NamedType('encryptionParamSet', Gost28147_89_ParamSet())
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class GostR3410_2001_CertificateSignature(univ.BitString):
|
| 284 |
+
pass
|
| 285 |
+
|
| 286 |
+
GostR3410_2001_CertificateSignature.subtypeSpec=constraint.ValueSizeConstraint(256, 512)
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
class GostR3410_2001_ParamSetParameters(univ.Sequence):
|
| 290 |
+
pass
|
| 291 |
+
|
| 292 |
+
GostR3410_2001_ParamSetParameters.componentType = namedtype.NamedTypes(
|
| 293 |
+
namedtype.NamedType('a', univ.Integer()),
|
| 294 |
+
namedtype.NamedType('b', univ.Integer()),
|
| 295 |
+
namedtype.NamedType('p', univ.Integer()),
|
| 296 |
+
namedtype.NamedType('q', univ.Integer()),
|
| 297 |
+
namedtype.NamedType('x', univ.Integer()),
|
| 298 |
+
namedtype.NamedType('y', univ.Integer())
|
| 299 |
+
)
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
class GostR3410_2001_PublicKey(univ.OctetString):
|
| 303 |
+
pass
|
| 304 |
+
|
| 305 |
+
GostR3410_2001_PublicKey.subtypeSpec = constraint.ValueSizeConstraint(64, 64)
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
class GostR3410_2001_PublicKeyParameters(univ.Sequence):
|
| 309 |
+
pass
|
| 310 |
+
|
| 311 |
+
GostR3410_2001_PublicKeyParameters.componentType = namedtype.NamedTypes(
|
| 312 |
+
namedtype.NamedType('publicKeyParamSet', univ.ObjectIdentifier().subtype(
|
| 313 |
+
subtypeSpec=constraint.SingleValueConstraint(
|
| 314 |
+
id_GostR3410_2001_TestParamSet,
|
| 315 |
+
id_GostR3410_2001_CryptoPro_A_ParamSet,
|
| 316 |
+
id_GostR3410_2001_CryptoPro_B_ParamSet,
|
| 317 |
+
id_GostR3410_2001_CryptoPro_C_ParamSet,
|
| 318 |
+
id_GostR3410_2001_CryptoPro_XchA_ParamSet,
|
| 319 |
+
id_GostR3410_2001_CryptoPro_XchB_ParamSet
|
| 320 |
+
))),
|
| 321 |
+
namedtype.NamedType('digestParamSet', univ.ObjectIdentifier().subtype(
|
| 322 |
+
subtypeSpec=constraint.SingleValueConstraint(
|
| 323 |
+
id_GostR3411_94_TestParamSet,
|
| 324 |
+
id_GostR3411_94_CryptoProParamSet
|
| 325 |
+
))),
|
| 326 |
+
namedtype.DefaultedNamedType('encryptionParamSet',
|
| 327 |
+
Gost28147_89_ParamSet().subtype(value=id_Gost28147_89_CryptoPro_A_ParamSet
|
| 328 |
+
))
|
| 329 |
+
)
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
class GostR3410_94_CertificateSignature(univ.BitString):
|
| 333 |
+
pass
|
| 334 |
+
|
| 335 |
+
GostR3410_94_CertificateSignature.subtypeSpec = constraint.ValueSizeConstraint(256, 512)
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
class GostR3410_94_ParamSetParameters_t(univ.Integer):
|
| 339 |
+
pass
|
| 340 |
+
|
| 341 |
+
GostR3410_94_ParamSetParameters_t.subtypeSpec = constraint.SingleValueConstraint(512, 1024)
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
class GostR3410_94_ParamSetParameters(univ.Sequence):
|
| 345 |
+
pass
|
| 346 |
+
|
| 347 |
+
GostR3410_94_ParamSetParameters.componentType = namedtype.NamedTypes(
|
| 348 |
+
namedtype.NamedType('t', GostR3410_94_ParamSetParameters_t()),
|
| 349 |
+
namedtype.NamedType('p', univ.Integer()),
|
| 350 |
+
namedtype.NamedType('q', univ.Integer()),
|
| 351 |
+
namedtype.NamedType('a', univ.Integer()),
|
| 352 |
+
namedtype.OptionalNamedType('validationAlgorithm', AlgorithmIdentifier())
|
| 353 |
+
)
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
class GostR3410_94_PublicKey(univ.OctetString):
|
| 357 |
+
pass
|
| 358 |
+
|
| 359 |
+
GostR3410_94_PublicKey.subtypeSpec = constraint.ConstraintsUnion(
|
| 360 |
+
constraint.ValueSizeConstraint(64, 64),
|
| 361 |
+
constraint.ValueSizeConstraint(128, 128)
|
| 362 |
+
)
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
class GostR3410_94_PublicKeyParameters(univ.Sequence):
|
| 366 |
+
pass
|
| 367 |
+
|
| 368 |
+
GostR3410_94_PublicKeyParameters.componentType = namedtype.NamedTypes(
|
| 369 |
+
namedtype.NamedType('publicKeyParamSet', univ.ObjectIdentifier().subtype(
|
| 370 |
+
subtypeSpec=constraint.SingleValueConstraint(
|
| 371 |
+
id_GostR3410_94_TestParamSet,
|
| 372 |
+
id_GostR3410_94_CryptoPro_A_ParamSet,
|
| 373 |
+
id_GostR3410_94_CryptoPro_B_ParamSet,
|
| 374 |
+
id_GostR3410_94_CryptoPro_C_ParamSet,
|
| 375 |
+
id_GostR3410_94_CryptoPro_D_ParamSet,
|
| 376 |
+
id_GostR3410_94_CryptoPro_XchA_ParamSet,
|
| 377 |
+
id_GostR3410_94_CryptoPro_XchB_ParamSet,
|
| 378 |
+
id_GostR3410_94_CryptoPro_XchC_ParamSet
|
| 379 |
+
))),
|
| 380 |
+
namedtype.NamedType('digestParamSet', univ.ObjectIdentifier().subtype(
|
| 381 |
+
subtypeSpec=constraint.SingleValueConstraint(
|
| 382 |
+
id_GostR3411_94_TestParamSet,
|
| 383 |
+
id_GostR3411_94_CryptoProParamSet
|
| 384 |
+
))),
|
| 385 |
+
namedtype.DefaultedNamedType('encryptionParamSet',
|
| 386 |
+
Gost28147_89_ParamSet().subtype(value=id_Gost28147_89_CryptoPro_A_ParamSet
|
| 387 |
+
))
|
| 388 |
+
)
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class GostR3410_94_ValidationBisParameters_c(univ.Integer):
|
| 392 |
+
pass
|
| 393 |
+
|
| 394 |
+
GostR3410_94_ValidationBisParameters_c.subtypeSpec = constraint.ValueRangeConstraint(0, 4294967295)
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
class GostR3410_94_ValidationBisParameters(univ.Sequence):
|
| 398 |
+
pass
|
| 399 |
+
|
| 400 |
+
GostR3410_94_ValidationBisParameters.componentType = namedtype.NamedTypes(
|
| 401 |
+
namedtype.NamedType('x0', GostR3410_94_ValidationBisParameters_c()),
|
| 402 |
+
namedtype.NamedType('c', GostR3410_94_ValidationBisParameters_c()),
|
| 403 |
+
namedtype.OptionalNamedType('d', univ.Integer())
|
| 404 |
+
)
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
class GostR3410_94_ValidationParameters_c(univ.Integer):
|
| 408 |
+
pass
|
| 409 |
+
|
| 410 |
+
GostR3410_94_ValidationParameters_c.subtypeSpec = constraint.ValueRangeConstraint(0, 65535)
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
class GostR3410_94_ValidationParameters(univ.Sequence):
|
| 414 |
+
pass
|
| 415 |
+
|
| 416 |
+
GostR3410_94_ValidationParameters.componentType = namedtype.NamedTypes(
|
| 417 |
+
namedtype.NamedType('x0', GostR3410_94_ValidationParameters_c()),
|
| 418 |
+
namedtype.NamedType('c', GostR3410_94_ValidationParameters_c()),
|
| 419 |
+
namedtype.OptionalNamedType('d', univ.Integer())
|
| 420 |
+
)
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
class GostR3411_94_Digest(univ.OctetString):
|
| 424 |
+
pass
|
| 425 |
+
|
| 426 |
+
GostR3411_94_Digest.subtypeSpec = constraint.ValueSizeConstraint(32, 32)
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
class GostR3411_94_DigestParameters(univ.ObjectIdentifier):
|
| 430 |
+
pass
|
| 431 |
+
|
| 432 |
+
GostR3411_94_DigestParameters.subtypeSpec = constraint.ConstraintsUnion(
|
| 433 |
+
constraint.SingleValueConstraint(id_GostR3411_94_TestParamSet),
|
| 434 |
+
constraint.SingleValueConstraint(id_GostR3411_94_CryptoProParamSet),
|
| 435 |
+
)
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
class GostR3411_94_ParamSetParameters(univ.Sequence):
|
| 439 |
+
pass
|
| 440 |
+
|
| 441 |
+
GostR3411_94_ParamSetParameters.componentType = namedtype.NamedTypes(
|
| 442 |
+
namedtype.NamedType('hUZ', Gost28147_89_UZ()),
|
| 443 |
+
namedtype.NamedType('h0', GostR3411_94_Digest())
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
# Update the Algorithm Identifier map in rfc5280.py
|
| 448 |
+
|
| 449 |
+
_algorithmIdentifierMapUpdate = {
|
| 450 |
+
id_Gost28147_89: Gost28147_89_Parameters(),
|
| 451 |
+
id_Gost28147_89_TestParamSet: Gost28147_89_ParamSetParameters(),
|
| 452 |
+
id_Gost28147_89_CryptoPro_A_ParamSet: Gost28147_89_ParamSetParameters(),
|
| 453 |
+
id_Gost28147_89_CryptoPro_B_ParamSet: Gost28147_89_ParamSetParameters(),
|
| 454 |
+
id_Gost28147_89_CryptoPro_C_ParamSet: Gost28147_89_ParamSetParameters(),
|
| 455 |
+
id_Gost28147_89_CryptoPro_D_ParamSet: Gost28147_89_ParamSetParameters(),
|
| 456 |
+
id_Gost28147_89_CryptoPro_KeyMeshing: univ.Null(""),
|
| 457 |
+
id_Gost28147_89_None_KeyMeshing: univ.Null(""),
|
| 458 |
+
id_GostR3410_94: GostR3410_94_PublicKeyParameters(),
|
| 459 |
+
id_GostR3410_94_TestParamSet: GostR3410_94_ParamSetParameters(),
|
| 460 |
+
id_GostR3410_94_CryptoPro_A_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 461 |
+
id_GostR3410_94_CryptoPro_B_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 462 |
+
id_GostR3410_94_CryptoPro_C_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 463 |
+
id_GostR3410_94_CryptoPro_D_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 464 |
+
id_GostR3410_94_CryptoPro_XchA_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 465 |
+
id_GostR3410_94_CryptoPro_XchB_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 466 |
+
id_GostR3410_94_CryptoPro_XchC_ParamSet: GostR3410_94_ParamSetParameters(),
|
| 467 |
+
id_GostR3410_94_a: GostR3410_94_ValidationParameters(),
|
| 468 |
+
id_GostR3410_94_aBis: GostR3410_94_ValidationBisParameters(),
|
| 469 |
+
id_GostR3410_94_b: GostR3410_94_ValidationParameters(),
|
| 470 |
+
id_GostR3410_94_bBis: GostR3410_94_ValidationBisParameters(),
|
| 471 |
+
id_GostR3410_2001: univ.Null(""),
|
| 472 |
+
id_GostR3411_94: univ.Null(""),
|
| 473 |
+
id_GostR3411_94_TestParamSet: GostR3411_94_ParamSetParameters(),
|
| 474 |
+
id_GostR3411_94_CryptoProParamSet: GostR3411_94_ParamSetParameters(),
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4491.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Using the GOST R 34.10-94, GOST R 34.10-2001, and GOST R 34.11-94
|
| 10 |
+
# Algorithms with Certificates and CRLs
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc4491.txt
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1_modules import rfc4357
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Signature Algorithm GOST R 34.10-94
|
| 20 |
+
|
| 21 |
+
id_GostR3411_94_with_GostR3410_94 = rfc4357.id_GostR3411_94_with_GostR3410_94
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Signature Algorithm GOST R 34.10-2001
|
| 25 |
+
|
| 26 |
+
id_GostR3411_94_with_GostR3410_2001 = rfc4357.id_GostR3411_94_with_GostR3410_2001
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# GOST R 34.10-94 Keys
|
| 30 |
+
|
| 31 |
+
id_GostR3410_94 = rfc4357.id_GostR3410_94
|
| 32 |
+
|
| 33 |
+
GostR3410_2001_PublicKey = rfc4357.GostR3410_2001_PublicKey
|
| 34 |
+
|
| 35 |
+
GostR3410_2001_PublicKeyParameters = rfc4357.GostR3410_2001_PublicKeyParameters
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# GOST R 34.10-2001 Keys
|
| 39 |
+
|
| 40 |
+
id_GostR3410_2001 = rfc4357.id_GostR3410_2001
|
| 41 |
+
|
| 42 |
+
GostR3410_94_PublicKey = rfc4357.GostR3410_94_PublicKey
|
| 43 |
+
|
| 44 |
+
GostR3410_94_PublicKeyParameters = rfc4357.GostR3410_94_PublicKeyParameters
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc4683.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Subject Identification Method (SIM)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc4683.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid1047
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import char
|
| 17 |
+
from pyasn1.type import namedtype
|
| 18 |
+
from pyasn1.type import univ
|
| 19 |
+
|
| 20 |
+
from pyasn1_modules import rfc5280
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# Used to compute the PEPSI value
|
| 24 |
+
|
| 25 |
+
class HashContent(univ.Sequence):
|
| 26 |
+
componentType = namedtype.NamedTypes(
|
| 27 |
+
namedtype.NamedType('userPassword', char.UTF8String()),
|
| 28 |
+
namedtype.NamedType('authorityRandom', univ.OctetString()),
|
| 29 |
+
namedtype.NamedType('identifierType', univ.ObjectIdentifier()),
|
| 30 |
+
namedtype.NamedType('identifier', char.UTF8String())
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Used to encode the PEPSI value as the SIM Other Name
|
| 35 |
+
|
| 36 |
+
id_pkix = rfc5280.id_pkix
|
| 37 |
+
|
| 38 |
+
id_on = id_pkix + (8,)
|
| 39 |
+
|
| 40 |
+
id_on_SIM = id_on + (6,)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class SIM(univ.Sequence):
|
| 44 |
+
componentType = namedtype.NamedTypes(
|
| 45 |
+
namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),
|
| 46 |
+
namedtype.NamedType('authorityRandom', univ.OctetString()),
|
| 47 |
+
namedtype.NamedType('pEPSI', univ.OctetString())
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Used to encrypt the PEPSI value during certificate request
|
| 52 |
+
|
| 53 |
+
id_pkip = id_pkix + (5,)
|
| 54 |
+
|
| 55 |
+
id_regEPEPSI = id_pkip + (3,)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class EncryptedPEPSI(univ.Sequence):
|
| 59 |
+
componentType = namedtype.NamedTypes(
|
| 60 |
+
namedtype.NamedType('identifierType', univ.ObjectIdentifier()),
|
| 61 |
+
namedtype.NamedType('identifier', char.UTF8String()),
|
| 62 |
+
namedtype.NamedType('sIM', SIM())
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
# Update the map of Other Name OIDs to Other Names in rfc5280.py
|
| 67 |
+
|
| 68 |
+
_anotherNameMapUpdate = {
|
| 69 |
+
id_on_SIM: SIM(),
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
rfc5280.anotherNameMap.update(_anotherNameMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5084.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley with assistance from the asn1ate tool, with manual
|
| 4 |
+
# changes to AES_CCM_ICVlen.subtypeSpec and added comments
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2018-2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# AES-CCM and AES-GCM Algorithms fo use with the Authenticated-Enveloped-Data
|
| 10 |
+
# protecting content type for the Cryptographic Message Syntax (CMS)
|
| 11 |
+
#
|
| 12 |
+
# ASN.1 source from:
|
| 13 |
+
# https://www.rfc-editor.org/rfc/rfc5084.txt
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _OID(*components):
|
| 23 |
+
output = []
|
| 24 |
+
for x in tuple(components):
|
| 25 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 26 |
+
output.extend(list(x))
|
| 27 |
+
else:
|
| 28 |
+
output.append(int(x))
|
| 29 |
+
|
| 30 |
+
return univ.ObjectIdentifier(output)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class AES_CCM_ICVlen(univ.Integer):
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class AES_GCM_ICVlen(univ.Integer):
|
| 38 |
+
pass
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
AES_CCM_ICVlen.subtypeSpec = constraint.SingleValueConstraint(4, 6, 8, 10, 12, 14, 16)
|
| 42 |
+
|
| 43 |
+
AES_GCM_ICVlen.subtypeSpec = constraint.ValueRangeConstraint(12, 16)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class CCMParameters(univ.Sequence):
|
| 47 |
+
pass
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
CCMParameters.componentType = namedtype.NamedTypes(
|
| 51 |
+
namedtype.NamedType('aes-nonce', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(7, 13))),
|
| 52 |
+
# The aes-nonce parameter contains 15-L octets, where L is the size of the length field. L=8 is RECOMMENDED.
|
| 53 |
+
# Within the scope of any content-authenticated-encryption key, the nonce value MUST be unique.
|
| 54 |
+
namedtype.DefaultedNamedType('aes-ICVlen', AES_CCM_ICVlen().subtype(value=12))
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class GCMParameters(univ.Sequence):
|
| 59 |
+
pass
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
GCMParameters.componentType = namedtype.NamedTypes(
|
| 63 |
+
namedtype.NamedType('aes-nonce', univ.OctetString()),
|
| 64 |
+
# The aes-nonce may have any number of bits between 8 and 2^64, but it MUST be a multiple of 8 bits.
|
| 65 |
+
# Within the scope of any content-authenticated-encryption key, the nonce value MUST be unique.
|
| 66 |
+
# A nonce value of 12 octets can be processed more efficiently, so that length is RECOMMENDED.
|
| 67 |
+
namedtype.DefaultedNamedType('aes-ICVlen', AES_GCM_ICVlen().subtype(value=12))
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
aes = _OID(2, 16, 840, 1, 101, 3, 4, 1)
|
| 71 |
+
|
| 72 |
+
id_aes128_CCM = _OID(aes, 7)
|
| 73 |
+
|
| 74 |
+
id_aes128_GCM = _OID(aes, 6)
|
| 75 |
+
|
| 76 |
+
id_aes192_CCM = _OID(aes, 27)
|
| 77 |
+
|
| 78 |
+
id_aes192_GCM = _OID(aes, 26)
|
| 79 |
+
|
| 80 |
+
id_aes256_CCM = _OID(aes, 47)
|
| 81 |
+
|
| 82 |
+
id_aes256_GCM = _OID(aes, 46)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# Map of Algorithm Identifier OIDs to Parameters is added to the
|
| 86 |
+
# ones in rfc5280.py
|
| 87 |
+
|
| 88 |
+
_algorithmIdentifierMapUpdate = {
|
| 89 |
+
id_aes128_CCM: CCMParameters(),
|
| 90 |
+
id_aes128_GCM: GCMParameters(),
|
| 91 |
+
id_aes192_CCM: CCMParameters(),
|
| 92 |
+
id_aes192_GCM: GCMParameters(),
|
| 93 |
+
id_aes256_CCM: CCMParameters(),
|
| 94 |
+
id_aes256_GCM: GCMParameters(),
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
evalkit_cambrian/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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)
|
evalkit_cambrian/lib/python3.10/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 <[email protected]>
|
| 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 |
+
)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5275.py
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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 |
+
# An Internet Attribute Certificate Profile for Authorization
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5275.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import namedval
|
| 18 |
+
from pyasn1.type import opentype
|
| 19 |
+
from pyasn1.type import tag
|
| 20 |
+
from pyasn1.type import univ
|
| 21 |
+
from pyasn1.type import useful
|
| 22 |
+
|
| 23 |
+
from pyasn1_modules import rfc3565
|
| 24 |
+
from pyasn1_modules import rfc5280
|
| 25 |
+
from pyasn1_modules import rfc5652
|
| 26 |
+
from pyasn1_modules import rfc5751
|
| 27 |
+
from pyasn1_modules import rfc5755
|
| 28 |
+
|
| 29 |
+
MAX = float('inf')
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# Initialize the map for GLAQueryRequests and GLAQueryResponses
|
| 33 |
+
|
| 34 |
+
glaQueryRRMap = { }
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# Imports from RFC 3565
|
| 38 |
+
|
| 39 |
+
id_aes128_wrap = rfc3565.id_aes128_wrap
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Imports from RFC 5280
|
| 43 |
+
|
| 44 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 45 |
+
|
| 46 |
+
Certificate = rfc5280.Certificate
|
| 47 |
+
|
| 48 |
+
GeneralName = rfc5280.GeneralName
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Imports from RFC 5652
|
| 52 |
+
|
| 53 |
+
CertificateSet = rfc5652.CertificateSet
|
| 54 |
+
|
| 55 |
+
KEKIdentifier = rfc5652.KEKIdentifier
|
| 56 |
+
|
| 57 |
+
RecipientInfos = rfc5652.RecipientInfos
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# Imports from RFC 5751
|
| 61 |
+
|
| 62 |
+
SMIMECapability = rfc5751.SMIMECapability
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# Imports from RFC 5755
|
| 66 |
+
|
| 67 |
+
AttributeCertificate = rfc5755.AttributeCertificate
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# The GL symmetric key distribution object identifier arc
|
| 71 |
+
|
| 72 |
+
id_skd = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 8,))
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
# The GL Use KEK control attribute
|
| 76 |
+
|
| 77 |
+
id_skd_glUseKEK = id_skd + (1,)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class Certificates(univ.Sequence):
|
| 81 |
+
componentType = namedtype.NamedTypes(
|
| 82 |
+
namedtype.OptionalNamedType('pKC',
|
| 83 |
+
Certificate().subtype(implicitTag=tag.Tag(
|
| 84 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 85 |
+
namedtype.OptionalNamedType('aC',
|
| 86 |
+
univ.SequenceOf(componentType=AttributeCertificate()).subtype(
|
| 87 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
|
| 88 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 89 |
+
namedtype.OptionalNamedType('certPath',
|
| 90 |
+
CertificateSet().subtype(implicitTag=tag.Tag(
|
| 91 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class GLInfo(univ.Sequence):
|
| 96 |
+
componentType = namedtype.NamedTypes(
|
| 97 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 98 |
+
namedtype.NamedType('glAddress', GeneralName())
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class GLOwnerInfo(univ.Sequence):
|
| 103 |
+
componentType = namedtype.NamedTypes(
|
| 104 |
+
namedtype.NamedType('glOwnerName', GeneralName()),
|
| 105 |
+
namedtype.NamedType('glOwnerAddress', GeneralName()),
|
| 106 |
+
namedtype.OptionalNamedType('certificates', Certificates())
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
class GLAdministration(univ.Integer):
|
| 111 |
+
namedValues = namedval.NamedValues(
|
| 112 |
+
('unmanaged', 0),
|
| 113 |
+
('managed', 1),
|
| 114 |
+
('closed', 2)
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
requested_algorithm = SMIMECapability().subtype(
|
| 119 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4))
|
| 120 |
+
requested_algorithm['capabilityID'] = id_aes128_wrap
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
class GLKeyAttributes(univ.Sequence):
|
| 124 |
+
componentType = namedtype.NamedTypes(
|
| 125 |
+
namedtype.DefaultedNamedType('rekeyControlledByGLO',
|
| 126 |
+
univ.Boolean().subtype(value=0,
|
| 127 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 128 |
+
namedtype.DefaultedNamedType('recipientsNotMutuallyAware',
|
| 129 |
+
univ.Boolean().subtype(value=1,
|
| 130 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 131 |
+
namedtype.DefaultedNamedType('duration',
|
| 132 |
+
univ.Integer().subtype(value=0,
|
| 133 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 134 |
+
namedtype.DefaultedNamedType('generationCounter',
|
| 135 |
+
univ.Integer().subtype(value=2,
|
| 136 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 137 |
+
namedtype.DefaultedNamedType('requestedAlgorithm', requested_algorithm)
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class GLUseKEK(univ.Sequence):
|
| 142 |
+
componentType = namedtype.NamedTypes(
|
| 143 |
+
namedtype.NamedType('glInfo', GLInfo()),
|
| 144 |
+
namedtype.NamedType('glOwnerInfo',
|
| 145 |
+
univ.SequenceOf(componentType=GLOwnerInfo()).subtype(
|
| 146 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
| 147 |
+
namedtype.DefaultedNamedType('glAdministration',
|
| 148 |
+
GLAdministration().subtype(value=1)),
|
| 149 |
+
namedtype.OptionalNamedType('glKeyAttributes', GLKeyAttributes())
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
# The Delete GL control attribute
|
| 154 |
+
|
| 155 |
+
id_skd_glDelete = id_skd + (2,)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class DeleteGL(GeneralName):
|
| 159 |
+
pass
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
# The Add GL Member control attribute
|
| 163 |
+
|
| 164 |
+
id_skd_glAddMember = id_skd + (3,)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
class GLMember(univ.Sequence):
|
| 168 |
+
componentType = namedtype.NamedTypes(
|
| 169 |
+
namedtype.NamedType('glMemberName', GeneralName()),
|
| 170 |
+
namedtype.OptionalNamedType('glMemberAddress', GeneralName()),
|
| 171 |
+
namedtype.OptionalNamedType('certificates', Certificates())
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
class GLAddMember(univ.Sequence):
|
| 176 |
+
componentType = namedtype.NamedTypes(
|
| 177 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 178 |
+
namedtype.NamedType('glMember', GLMember())
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
# The Delete GL Member control attribute
|
| 183 |
+
|
| 184 |
+
id_skd_glDeleteMember = id_skd + (4,)
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class GLDeleteMember(univ.Sequence):
|
| 188 |
+
componentType = namedtype.NamedTypes(
|
| 189 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 190 |
+
namedtype.NamedType('glMemberToDelete', GeneralName())
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
# The GL Rekey control attribute
|
| 195 |
+
|
| 196 |
+
id_skd_glRekey = id_skd + (5,)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
class GLNewKeyAttributes(univ.Sequence):
|
| 200 |
+
componentType = namedtype.NamedTypes(
|
| 201 |
+
namedtype.OptionalNamedType('rekeyControlledByGLO',
|
| 202 |
+
univ.Boolean().subtype(implicitTag=tag.Tag(
|
| 203 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 204 |
+
namedtype.OptionalNamedType('recipientsNotMutuallyAware',
|
| 205 |
+
univ.Boolean().subtype(implicitTag=tag.Tag(
|
| 206 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 207 |
+
namedtype.OptionalNamedType('duration',
|
| 208 |
+
univ.Integer().subtype(implicitTag=tag.Tag(
|
| 209 |
+
tag.tagClassContext, tag.tagFormatSimple, 2))),
|
| 210 |
+
namedtype.OptionalNamedType('generationCounter',
|
| 211 |
+
univ.Integer().subtype(implicitTag=tag.Tag(
|
| 212 |
+
tag.tagClassContext, tag.tagFormatSimple, 3))),
|
| 213 |
+
namedtype.OptionalNamedType('requestedAlgorithm',
|
| 214 |
+
AlgorithmIdentifier().subtype(implicitTag=tag.Tag(
|
| 215 |
+
tag.tagClassContext, tag.tagFormatSimple, 4)))
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
class GLRekey(univ.Sequence):
|
| 220 |
+
componentType = namedtype.NamedTypes(
|
| 221 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 222 |
+
namedtype.OptionalNamedType('glAdministration', GLAdministration()),
|
| 223 |
+
namedtype.OptionalNamedType('glNewKeyAttributes', GLNewKeyAttributes()),
|
| 224 |
+
namedtype.OptionalNamedType('glRekeyAllGLKeys', univ.Boolean())
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
# The Add and Delete GL Owner control attributes
|
| 229 |
+
|
| 230 |
+
id_skd_glAddOwner = id_skd + (6,)
|
| 231 |
+
|
| 232 |
+
id_skd_glRemoveOwner = id_skd + (7,)
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class GLOwnerAdministration(univ.Sequence):
|
| 236 |
+
componentType = namedtype.NamedTypes(
|
| 237 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 238 |
+
namedtype.NamedType('glOwnerInfo', GLOwnerInfo())
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
# The GL Key Compromise control attribute
|
| 243 |
+
|
| 244 |
+
id_skd_glKeyCompromise = id_skd + (8,)
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
class GLKCompromise(GeneralName):
|
| 248 |
+
pass
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
# The GL Key Refresh control attribute
|
| 252 |
+
|
| 253 |
+
id_skd_glkRefresh = id_skd + (9,)
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
class Date(univ.Sequence):
|
| 257 |
+
componentType = namedtype.NamedTypes(
|
| 258 |
+
namedtype.NamedType('start', useful.GeneralizedTime()),
|
| 259 |
+
namedtype.OptionalNamedType('end', useful.GeneralizedTime())
|
| 260 |
+
)
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
class GLKRefresh(univ.Sequence):
|
| 264 |
+
componentType = namedtype.NamedTypes(
|
| 265 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 266 |
+
namedtype.NamedType('dates',
|
| 267 |
+
univ.SequenceOf(componentType=Date()).subtype(
|
| 268 |
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
# The GLA Query Request control attribute
|
| 273 |
+
|
| 274 |
+
id_skd_glaQueryRequest = id_skd + (11,)
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class GLAQueryRequest(univ.Sequence):
|
| 278 |
+
componentType = namedtype.NamedTypes(
|
| 279 |
+
namedtype.NamedType('glaRequestType', univ.ObjectIdentifier()),
|
| 280 |
+
namedtype.NamedType('glaRequestValue', univ.Any(),
|
| 281 |
+
openType=opentype.OpenType('glaRequestType', glaQueryRRMap))
|
| 282 |
+
)
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
# The GLA Query Response control attribute
|
| 286 |
+
|
| 287 |
+
id_skd_glaQueryResponse = id_skd + (12,)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
class GLAQueryResponse(univ.Sequence):
|
| 291 |
+
componentType = namedtype.NamedTypes(
|
| 292 |
+
namedtype.NamedType('glaResponseType', univ.ObjectIdentifier()),
|
| 293 |
+
namedtype.NamedType('glaResponseValue', univ.Any(),
|
| 294 |
+
openType=opentype.OpenType('glaResponseType', glaQueryRRMap))
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
# The GLA Request/Response (glaRR) arc for glaRequestType/glaResponseType
|
| 299 |
+
|
| 300 |
+
id_cmc_glaRR = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 7, 99,))
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
# The Algorithm Request
|
| 304 |
+
|
| 305 |
+
id_cmc_gla_skdAlgRequest = id_cmc_glaRR + (1,)
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
class SKDAlgRequest(univ.Null):
|
| 309 |
+
pass
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
# The Algorithm Response
|
| 313 |
+
|
| 314 |
+
id_cmc_gla_skdAlgResponse = id_cmc_glaRR + (2,)
|
| 315 |
+
|
| 316 |
+
SMIMECapabilities = rfc5751.SMIMECapabilities
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
# The control attribute to request an updated certificate to the GLA and
|
| 320 |
+
# the control attribute to return an updated certificate to the GLA
|
| 321 |
+
|
| 322 |
+
id_skd_glProvideCert = id_skd + (13,)
|
| 323 |
+
|
| 324 |
+
id_skd_glManageCert = id_skd + (14,)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
class GLManageCert(univ.Sequence):
|
| 328 |
+
componentType = namedtype.NamedTypes(
|
| 329 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 330 |
+
namedtype.NamedType('glMember', GLMember())
|
| 331 |
+
)
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
# The control attribute to distribute the GL shared KEK
|
| 335 |
+
|
| 336 |
+
id_skd_glKey = id_skd + (15,)
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
class GLKey(univ.Sequence):
|
| 340 |
+
componentType = namedtype.NamedTypes(
|
| 341 |
+
namedtype.NamedType('glName', GeneralName()),
|
| 342 |
+
namedtype.NamedType('glIdentifier', KEKIdentifier()),
|
| 343 |
+
namedtype.NamedType('glkWrapped', RecipientInfos()),
|
| 344 |
+
namedtype.NamedType('glkAlgorithm', AlgorithmIdentifier()),
|
| 345 |
+
namedtype.NamedType('glkNotBefore', useful.GeneralizedTime()),
|
| 346 |
+
namedtype.NamedType('glkNotAfter', useful.GeneralizedTime())
|
| 347 |
+
)
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
# The CMC error types
|
| 351 |
+
|
| 352 |
+
id_cet_skdFailInfo = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 15, 1,))
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class SKDFailInfo(univ.Integer):
|
| 356 |
+
namedValues = namedval.NamedValues(
|
| 357 |
+
('unspecified', 0),
|
| 358 |
+
('closedGL', 1),
|
| 359 |
+
('unsupportedDuration', 2),
|
| 360 |
+
('noGLACertificate', 3),
|
| 361 |
+
('invalidCert', 4),
|
| 362 |
+
('unsupportedAlgorithm', 5),
|
| 363 |
+
('noGLONameMatch', 6),
|
| 364 |
+
('invalidGLName', 7),
|
| 365 |
+
('nameAlreadyInUse', 8),
|
| 366 |
+
('noSpam', 9),
|
| 367 |
+
('alreadyAMember', 11),
|
| 368 |
+
('notAMember', 12),
|
| 369 |
+
('alreadyAnOwner', 13),
|
| 370 |
+
('notAnOwner', 14)
|
| 371 |
+
)
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
# Update the map for GLAQueryRequests and GLAQueryResponses
|
| 375 |
+
|
| 376 |
+
_glaQueryRRMapUpdate = {
|
| 377 |
+
id_cmc_gla_skdAlgRequest: univ.Null(""),
|
| 378 |
+
id_cmc_gla_skdAlgResponse: SMIMECapabilities(),
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
glaQueryRRMap.update(_glaQueryRRMapUpdate)
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
# Update the map for CMC control attributes; since CMS Attributes and
|
| 385 |
+
# CMC Controls both use 'attrType', one map is used for both
|
| 386 |
+
|
| 387 |
+
_cmcControlAttributesMapUpdate = {
|
| 388 |
+
id_skd_glUseKEK: GLUseKEK(),
|
| 389 |
+
id_skd_glDelete: DeleteGL(),
|
| 390 |
+
id_skd_glAddMember: GLAddMember(),
|
| 391 |
+
id_skd_glDeleteMember: GLDeleteMember(),
|
| 392 |
+
id_skd_glRekey: GLRekey(),
|
| 393 |
+
id_skd_glAddOwner: GLOwnerAdministration(),
|
| 394 |
+
id_skd_glRemoveOwner: GLOwnerAdministration(),
|
| 395 |
+
id_skd_glKeyCompromise: GLKCompromise(),
|
| 396 |
+
id_skd_glkRefresh: GLKRefresh(),
|
| 397 |
+
id_skd_glaQueryRequest: GLAQueryRequest(),
|
| 398 |
+
id_skd_glaQueryResponse: GLAQueryResponse(),
|
| 399 |
+
id_skd_glProvideCert: GLManageCert(),
|
| 400 |
+
id_skd_glManageCert: GLManageCert(),
|
| 401 |
+
id_skd_glKey: GLKey(),
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
rfc5652.cmsAttributesMap.update(_cmcControlAttributesMapUpdate)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/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')
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5652.py
ADDED
|
@@ -0,0 +1,761 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 8 |
+
# Copyright (c) 2005-2020, Ilya Etingof <[email protected]>
|
| 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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5697.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 6 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 7 |
+
#
|
| 8 |
+
# Other Certificates Extension
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5697.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import univ
|
| 15 |
+
|
| 16 |
+
from pyasn1_modules import rfc5280
|
| 17 |
+
from pyasn1_modules import rfc4055
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Imports from RFC 5280
|
| 21 |
+
|
| 22 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 23 |
+
|
| 24 |
+
CertificateSerialNumber = rfc5280.CertificateSerialNumber
|
| 25 |
+
|
| 26 |
+
GeneralNames = rfc5280.GeneralNames
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# Imports from RFC 4055
|
| 30 |
+
|
| 31 |
+
id_sha1 = rfc4055.id_sha1
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Imports from RFC 5055
|
| 35 |
+
# These are defined here because a module for RFC 5055 does not exist yet
|
| 36 |
+
|
| 37 |
+
class SCVPIssuerSerial(univ.Sequence):
|
| 38 |
+
componentType = namedtype.NamedTypes(
|
| 39 |
+
namedtype.NamedType('issuer', GeneralNames()),
|
| 40 |
+
namedtype.NamedType('serialNumber', CertificateSerialNumber())
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
sha1_alg_id = AlgorithmIdentifier()
|
| 45 |
+
sha1_alg_id['algorithm'] = id_sha1
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class SCVPCertID(univ.Sequence):
|
| 49 |
+
componentType = namedtype.NamedTypes(
|
| 50 |
+
namedtype.NamedType('certHash', univ.OctetString()),
|
| 51 |
+
namedtype.NamedType('issuerSerial', SCVPIssuerSerial()),
|
| 52 |
+
namedtype.DefaultedNamedType('hashAlgorithm', sha1_alg_id)
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# Other Certificates Extension
|
| 57 |
+
|
| 58 |
+
id_pe_otherCerts = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 1, 19,))
|
| 59 |
+
|
| 60 |
+
class OtherCertificates(univ.SequenceOf):
|
| 61 |
+
componentType = SCVPCertID()
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# Update of certificate extension map in rfc5280.py
|
| 65 |
+
|
| 66 |
+
_certificateExtensionsMapUpdate = {
|
| 67 |
+
id_pe_otherCerts: OtherCertificates(),
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5751.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 6 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 7 |
+
#
|
| 8 |
+
# S/MIME Version 3.2 Message Specification
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5751.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import opentype
|
| 15 |
+
from pyasn1.type import tag
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5652
|
| 19 |
+
from pyasn1_modules import rfc8018
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _OID(*components):
|
| 23 |
+
output = []
|
| 24 |
+
for x in tuple(components):
|
| 25 |
+
if isinstance(x, univ.ObjectIdentifier):
|
| 26 |
+
output.extend(list(x))
|
| 27 |
+
else:
|
| 28 |
+
output.append(int(x))
|
| 29 |
+
return univ.ObjectIdentifier(output)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# Imports from RFC 5652 and RFC 8018
|
| 33 |
+
|
| 34 |
+
IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber
|
| 35 |
+
|
| 36 |
+
RecipientKeyIdentifier = rfc5652.RecipientKeyIdentifier
|
| 37 |
+
|
| 38 |
+
SubjectKeyIdentifier = rfc5652.SubjectKeyIdentifier
|
| 39 |
+
|
| 40 |
+
rc2CBC = rfc8018.rc2CBC
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# S/MIME Capabilities Attribute
|
| 44 |
+
|
| 45 |
+
smimeCapabilities = univ.ObjectIdentifier('1.2.840.113549.1.9.15')
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
smimeCapabilityMap = { }
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class SMIMECapability(univ.Sequence):
|
| 52 |
+
pass
|
| 53 |
+
|
| 54 |
+
SMIMECapability.componentType = namedtype.NamedTypes(
|
| 55 |
+
namedtype.NamedType('capabilityID', univ.ObjectIdentifier()),
|
| 56 |
+
namedtype.OptionalNamedType('parameters', univ.Any(),
|
| 57 |
+
openType=opentype.OpenType('capabilityID', smimeCapabilityMap))
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class SMIMECapabilities(univ.SequenceOf):
|
| 62 |
+
pass
|
| 63 |
+
|
| 64 |
+
SMIMECapabilities.componentType = SMIMECapability()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class SMIMECapabilitiesParametersForRC2CBC(univ.Integer):
|
| 68 |
+
# which carries the RC2 Key Length (number of bits)
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# S/MIME Encryption Key Preference Attribute
|
| 73 |
+
|
| 74 |
+
id_smime = univ.ObjectIdentifier('1.2.840.113549.1.9.16')
|
| 75 |
+
|
| 76 |
+
id_aa = _OID(id_smime, 2)
|
| 77 |
+
|
| 78 |
+
id_aa_encrypKeyPref = _OID(id_aa, 11)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class SMIMEEncryptionKeyPreference(univ.Choice):
|
| 82 |
+
pass
|
| 83 |
+
|
| 84 |
+
SMIMEEncryptionKeyPreference.componentType = namedtype.NamedTypes(
|
| 85 |
+
namedtype.NamedType('issuerAndSerialNumber',
|
| 86 |
+
IssuerAndSerialNumber().subtype(implicitTag=tag.Tag(
|
| 87 |
+
tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 88 |
+
namedtype.NamedType('receipentKeyId',
|
| 89 |
+
# Yes, 'receipentKeyId' is spelled incorrectly, but kept
|
| 90 |
+
# this way for alignment with the ASN.1 module in the RFC.
|
| 91 |
+
RecipientKeyIdentifier().subtype(implicitTag=tag.Tag(
|
| 92 |
+
tag.tagClassContext, tag.tagFormatSimple, 1))),
|
| 93 |
+
namedtype.NamedType('subjectAltKeyIdentifier',
|
| 94 |
+
SubjectKeyIdentifier().subtype(implicitTag=tag.Tag(
|
| 95 |
+
tag.tagClassContext, tag.tagFormatSimple, 2)))
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
# The Prefer Binary Inside SMIMECapabilities attribute
|
| 100 |
+
|
| 101 |
+
id_cap = _OID(id_smime, 11)
|
| 102 |
+
|
| 103 |
+
id_cap_preferBinaryInside = _OID(id_cap, 1)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
# CMS Attribute Map
|
| 107 |
+
|
| 108 |
+
_cmsAttributesMapUpdate = {
|
| 109 |
+
smimeCapabilities: SMIMECapabilities(),
|
| 110 |
+
id_aa_encrypKeyPref: SMIMEEncryptionKeyPreference(),
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
# SMIMECapabilities Attribute Map
|
| 117 |
+
#
|
| 118 |
+
# Do not include OIDs in the dictionary when the parameters are absent.
|
| 119 |
+
|
| 120 |
+
_smimeCapabilityMapUpdate = {
|
| 121 |
+
rc2CBC: SMIMECapabilitiesParametersForRC2CBC(),
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5752.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Multiple Signatures in Cryptographic Message Syntax (CMS)
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5752.txt
|
| 13 |
+
# https://www.rfc-editor.org/errata/eid4444
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5035
|
| 20 |
+
from pyasn1_modules import rfc5652
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class SignAttrsHash(univ.Sequence):
|
| 24 |
+
componentType = namedtype.NamedTypes(
|
| 25 |
+
namedtype.NamedType('algID', rfc5652.DigestAlgorithmIdentifier()),
|
| 26 |
+
namedtype.NamedType('hash', univ.OctetString())
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class MultipleSignatures(univ.Sequence):
|
| 31 |
+
componentType = namedtype.NamedTypes(
|
| 32 |
+
namedtype.NamedType('bodyHashAlg', rfc5652.DigestAlgorithmIdentifier()),
|
| 33 |
+
namedtype.NamedType('signAlg', rfc5652.SignatureAlgorithmIdentifier()),
|
| 34 |
+
namedtype.NamedType('signAttrsHash', SignAttrsHash()),
|
| 35 |
+
namedtype.OptionalNamedType('cert', rfc5035.ESSCertIDv2())
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
id_aa_multipleSignatures = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.51')
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Map of Attribute Type OIDs to Attributes added to the
|
| 43 |
+
# ones that are in rfc5652.py
|
| 44 |
+
|
| 45 |
+
_cmsAttributesMapUpdate = {
|
| 46 |
+
id_aa_multipleSignatures: MultipleSignatures(),
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5753.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# 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)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5915.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is being contributed to pyasn1-modules software.
|
| 2 |
+
#
|
| 3 |
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 6 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 7 |
+
#
|
| 8 |
+
# Elliptic Curve Private Key
|
| 9 |
+
#
|
| 10 |
+
# ASN.1 source from:
|
| 11 |
+
# https://www.rfc-editor.org/rfc/rfc5915.txt
|
| 12 |
+
|
| 13 |
+
from pyasn1.type import namedtype
|
| 14 |
+
from pyasn1.type import namedval
|
| 15 |
+
from pyasn1.type import tag
|
| 16 |
+
from pyasn1.type import univ
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5480
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class ECPrivateKey(univ.Sequence):
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
ECPrivateKey.componentType = namedtype.NamedTypes(
|
| 25 |
+
namedtype.NamedType('version', univ.Integer(
|
| 26 |
+
namedValues=namedval.NamedValues(('ecPrivkeyVer1', 1)))),
|
| 27 |
+
namedtype.NamedType('privateKey', univ.OctetString()),
|
| 28 |
+
namedtype.OptionalNamedType('parameters', rfc5480.ECParameters().subtype(
|
| 29 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
| 30 |
+
namedtype.OptionalNamedType('publicKey', univ.BitString().subtype(
|
| 31 |
+
explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
|
| 32 |
+
)
|
evalkit_cambrian/lib/python3.10/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)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5958.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is being contributed to pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley.
|
| 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 |
+
# Asymmetric Key Packages, which is essentially version 2 of
|
| 11 |
+
# the PrivateKeyInfo structure in PKCS#8 in RFC 5208
|
| 12 |
+
#
|
| 13 |
+
# ASN.1 source from:
|
| 14 |
+
# https://www.rfc-editor.org/rfc/rfc5958.txt
|
| 15 |
+
|
| 16 |
+
from pyasn1.type import univ, constraint, namedtype, namedval, tag
|
| 17 |
+
|
| 18 |
+
from pyasn1_modules import rfc5280
|
| 19 |
+
from pyasn1_modules import rfc5652
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
MAX = float('inf')
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class KeyEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 26 |
+
pass
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class PrivateKeyAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class EncryptedData(univ.OctetString):
|
| 34 |
+
pass
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class EncryptedPrivateKeyInfo(univ.Sequence):
|
| 38 |
+
componentType = namedtype.NamedTypes(
|
| 39 |
+
namedtype.NamedType('encryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
| 40 |
+
namedtype.NamedType('encryptedData', EncryptedData())
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class Version(univ.Integer):
|
| 45 |
+
namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class PrivateKey(univ.OctetString):
|
| 49 |
+
pass
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class Attributes(univ.SetOf):
|
| 53 |
+
componentType = rfc5652.Attribute()
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class PublicKey(univ.BitString):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# OneAsymmetricKey is essentially version 2 of PrivateKeyInfo.
|
| 61 |
+
# If publicKey is present, then the version must be v2;
|
| 62 |
+
# otherwise, the version should be v1.
|
| 63 |
+
|
| 64 |
+
class OneAsymmetricKey(univ.Sequence):
|
| 65 |
+
componentType = namedtype.NamedTypes(
|
| 66 |
+
namedtype.NamedType('version', Version()),
|
| 67 |
+
namedtype.NamedType('privateKeyAlgorithm', PrivateKeyAlgorithmIdentifier()),
|
| 68 |
+
namedtype.NamedType('privateKey', PrivateKey()),
|
| 69 |
+
namedtype.OptionalNamedType('attributes', Attributes().subtype(
|
| 70 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
| 71 |
+
namedtype.OptionalNamedType('publicKey', PublicKey().subtype(
|
| 72 |
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class PrivateKeyInfo(OneAsymmetricKey):
|
| 77 |
+
pass
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# The CMS AsymmetricKeyPackage Content Type
|
| 81 |
+
|
| 82 |
+
id_ct_KP_aKeyPackage = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.5')
|
| 83 |
+
|
| 84 |
+
class AsymmetricKeyPackage(univ.SequenceOf):
|
| 85 |
+
pass
|
| 86 |
+
|
| 87 |
+
AsymmetricKeyPackage.componentType = OneAsymmetricKey()
|
| 88 |
+
AsymmetricKeyPackage.sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
# Map of Content Type OIDs to Content Types is added to the
|
| 92 |
+
# ones that are in rfc5652.py
|
| 93 |
+
|
| 94 |
+
_cmsContentTypesMapUpdate = {
|
| 95 |
+
id_ct_KP_aKeyPackage: AsymmetricKeyPackage(),
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc5990.py
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|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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 |
+
# Use of the RSA-KEM Key Transport Algorithm in the CMS
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc5990.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import constraint
|
| 16 |
+
from pyasn1.type import namedtype
|
| 17 |
+
from pyasn1.type import univ
|
| 18 |
+
|
| 19 |
+
from pyasn1_modules import rfc5280
|
| 20 |
+
|
| 21 |
+
MAX = float('inf')
|
| 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 5280
|
| 34 |
+
|
| 35 |
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# Useful types and definitions
|
| 39 |
+
|
| 40 |
+
class NullParms(univ.Null):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Object identifier arcs
|
| 45 |
+
|
| 46 |
+
is18033_2 = _OID(1, 0, 18033, 2)
|
| 47 |
+
|
| 48 |
+
nistAlgorithm = _OID(2, 16, 840, 1, 101, 3, 4)
|
| 49 |
+
|
| 50 |
+
pkcs_1 = _OID(1, 2, 840, 113549, 1, 1)
|
| 51 |
+
|
| 52 |
+
x9_44 = _OID(1, 3, 133, 16, 840, 9, 44)
|
| 53 |
+
|
| 54 |
+
x9_44_components = _OID(x9_44, 1)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# Types for algorithm identifiers
|
| 58 |
+
|
| 59 |
+
class Camellia_KeyWrappingScheme(AlgorithmIdentifier):
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
class DataEncapsulationMechanism(AlgorithmIdentifier):
|
| 63 |
+
pass
|
| 64 |
+
|
| 65 |
+
class KDF2_HashFunction(AlgorithmIdentifier):
|
| 66 |
+
pass
|
| 67 |
+
|
| 68 |
+
class KDF3_HashFunction(AlgorithmIdentifier):
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
class KeyDerivationFunction(AlgorithmIdentifier):
|
| 72 |
+
pass
|
| 73 |
+
|
| 74 |
+
class KeyEncapsulationMechanism(AlgorithmIdentifier):
|
| 75 |
+
pass
|
| 76 |
+
|
| 77 |
+
class X9_SymmetricKeyWrappingScheme(AlgorithmIdentifier):
|
| 78 |
+
pass
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
# RSA-KEM Key Transport Algorithm
|
| 82 |
+
|
| 83 |
+
id_rsa_kem = _OID(1, 2, 840, 113549, 1, 9, 16, 3, 14)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class GenericHybridParameters(univ.Sequence):
|
| 87 |
+
pass
|
| 88 |
+
|
| 89 |
+
GenericHybridParameters.componentType = namedtype.NamedTypes(
|
| 90 |
+
namedtype.NamedType('kem', KeyEncapsulationMechanism()),
|
| 91 |
+
namedtype.NamedType('dem', DataEncapsulationMechanism())
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
rsa_kem = AlgorithmIdentifier()
|
| 96 |
+
rsa_kem['algorithm'] = id_rsa_kem
|
| 97 |
+
rsa_kem['parameters'] = GenericHybridParameters()
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
# KEM-RSA Key Encapsulation Mechanism
|
| 101 |
+
|
| 102 |
+
id_kem_rsa = _OID(is18033_2, 2, 4)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class KeyLength(univ.Integer):
|
| 106 |
+
pass
|
| 107 |
+
|
| 108 |
+
KeyLength.subtypeSpec = constraint.ValueRangeConstraint(1, MAX)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
class RsaKemParameters(univ.Sequence):
|
| 112 |
+
pass
|
| 113 |
+
|
| 114 |
+
RsaKemParameters.componentType = namedtype.NamedTypes(
|
| 115 |
+
namedtype.NamedType('keyDerivationFunction', KeyDerivationFunction()),
|
| 116 |
+
namedtype.NamedType('keyLength', KeyLength())
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
kem_rsa = AlgorithmIdentifier()
|
| 121 |
+
kem_rsa['algorithm'] = id_kem_rsa
|
| 122 |
+
kem_rsa['parameters'] = RsaKemParameters()
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# Key Derivation Functions
|
| 126 |
+
|
| 127 |
+
id_kdf_kdf2 = _OID(x9_44_components, 1)
|
| 128 |
+
|
| 129 |
+
id_kdf_kdf3 = _OID(x9_44_components, 2)
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
kdf2 = AlgorithmIdentifier()
|
| 133 |
+
kdf2['algorithm'] = id_kdf_kdf2
|
| 134 |
+
kdf2['parameters'] = KDF2_HashFunction()
|
| 135 |
+
|
| 136 |
+
kdf3 = AlgorithmIdentifier()
|
| 137 |
+
kdf3['algorithm'] = id_kdf_kdf3
|
| 138 |
+
kdf3['parameters'] = KDF3_HashFunction()
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
# Hash Functions
|
| 142 |
+
|
| 143 |
+
id_sha1 = _OID(1, 3, 14, 3, 2, 26)
|
| 144 |
+
|
| 145 |
+
id_sha224 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 4)
|
| 146 |
+
|
| 147 |
+
id_sha256 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 1)
|
| 148 |
+
|
| 149 |
+
id_sha384 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 2)
|
| 150 |
+
|
| 151 |
+
id_sha512 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 3)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
sha1 = AlgorithmIdentifier()
|
| 155 |
+
sha1['algorithm'] = id_sha1
|
| 156 |
+
sha1['parameters'] = univ.Null("")
|
| 157 |
+
|
| 158 |
+
sha224 = AlgorithmIdentifier()
|
| 159 |
+
sha224['algorithm'] = id_sha224
|
| 160 |
+
sha224['parameters'] = univ.Null("")
|
| 161 |
+
|
| 162 |
+
sha256 = AlgorithmIdentifier()
|
| 163 |
+
sha256['algorithm'] = id_sha256
|
| 164 |
+
sha256['parameters'] = univ.Null("")
|
| 165 |
+
|
| 166 |
+
sha384 = AlgorithmIdentifier()
|
| 167 |
+
sha384['algorithm'] = id_sha384
|
| 168 |
+
sha384['parameters'] = univ.Null("")
|
| 169 |
+
|
| 170 |
+
sha512 = AlgorithmIdentifier()
|
| 171 |
+
sha512['algorithm'] = id_sha512
|
| 172 |
+
sha512['parameters'] = univ.Null("")
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# Symmetric Key-Wrapping Schemes
|
| 176 |
+
|
| 177 |
+
id_aes128_Wrap = _OID(nistAlgorithm, 1, 5)
|
| 178 |
+
|
| 179 |
+
id_aes192_Wrap = _OID(nistAlgorithm, 1, 25)
|
| 180 |
+
|
| 181 |
+
id_aes256_Wrap = _OID(nistAlgorithm, 1, 45)
|
| 182 |
+
|
| 183 |
+
id_alg_CMS3DESwrap = _OID(1, 2, 840, 113549, 1, 9, 16, 3, 6)
|
| 184 |
+
|
| 185 |
+
id_camellia128_Wrap = _OID(1, 2, 392, 200011, 61, 1, 1, 3, 2)
|
| 186 |
+
|
| 187 |
+
id_camellia192_Wrap = _OID(1, 2, 392, 200011, 61, 1, 1, 3, 3)
|
| 188 |
+
|
| 189 |
+
id_camellia256_Wrap = _OID(1, 2, 392, 200011, 61, 1, 1, 3, 4)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
aes128_Wrap = AlgorithmIdentifier()
|
| 193 |
+
aes128_Wrap['algorithm'] = id_aes128_Wrap
|
| 194 |
+
# aes128_Wrap['parameters'] are absent
|
| 195 |
+
|
| 196 |
+
aes192_Wrap = AlgorithmIdentifier()
|
| 197 |
+
aes192_Wrap['algorithm'] = id_aes128_Wrap
|
| 198 |
+
# aes192_Wrap['parameters'] are absent
|
| 199 |
+
|
| 200 |
+
aes256_Wrap = AlgorithmIdentifier()
|
| 201 |
+
aes256_Wrap['algorithm'] = id_sha256
|
| 202 |
+
# aes256_Wrap['parameters'] are absent
|
| 203 |
+
|
| 204 |
+
tdes_Wrap = AlgorithmIdentifier()
|
| 205 |
+
tdes_Wrap['algorithm'] = id_alg_CMS3DESwrap
|
| 206 |
+
tdes_Wrap['parameters'] = univ.Null("")
|
| 207 |
+
|
| 208 |
+
camellia128_Wrap = AlgorithmIdentifier()
|
| 209 |
+
camellia128_Wrap['algorithm'] = id_camellia128_Wrap
|
| 210 |
+
# camellia128_Wrap['parameters'] are absent
|
| 211 |
+
|
| 212 |
+
camellia192_Wrap = AlgorithmIdentifier()
|
| 213 |
+
camellia192_Wrap['algorithm'] = id_camellia192_Wrap
|
| 214 |
+
# camellia192_Wrap['parameters'] are absent
|
| 215 |
+
|
| 216 |
+
camellia256_Wrap = AlgorithmIdentifier()
|
| 217 |
+
camellia256_Wrap['algorithm'] = id_camellia256_Wrap
|
| 218 |
+
# camellia256_Wrap['parameters'] are absent
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
# Update the Algorithm Identifier map in rfc5280.py.
|
| 222 |
+
# Note that the ones that must not have parameters are not added to the map.
|
| 223 |
+
|
| 224 |
+
_algorithmIdentifierMapUpdate = {
|
| 225 |
+
id_rsa_kem: GenericHybridParameters(),
|
| 226 |
+
id_kem_rsa: RsaKemParameters(),
|
| 227 |
+
id_kdf_kdf2: KDF2_HashFunction(),
|
| 228 |
+
id_kdf_kdf3: KDF3_HashFunction(),
|
| 229 |
+
id_sha1: univ.Null(),
|
| 230 |
+
id_sha224: univ.Null(),
|
| 231 |
+
id_sha256: univ.Null(),
|
| 232 |
+
id_sha384: univ.Null(),
|
| 233 |
+
id_sha512: univ.Null(),
|
| 234 |
+
id_alg_CMS3DESwrap: univ.Null(),
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
evalkit_cambrian/lib/python3.10/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: BinarySigningTime(),
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6170.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file is part of pyasn1-modules software.
|
| 3 |
+
#
|
| 4 |
+
# Created by Russ Housley.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 2019, Vigil Security, LLC
|
| 7 |
+
# License: http://snmplabs.com/pyasn1/license.html
|
| 8 |
+
#
|
| 9 |
+
# Certificate Image in the Internet X.509 Public Key Infrastructure
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc6170.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
id_logo_certImage = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.3')
|
evalkit_cambrian/lib/python3.10/site-packages/pyasn1_modules/rfc6187.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# X.509v3 Certificates for Secure Shell Authentication
|
| 10 |
+
#
|
| 11 |
+
# ASN.1 source from:
|
| 12 |
+
# https://www.rfc-editor.org/rfc/rfc6187.txt
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
from pyasn1.type import univ
|
| 16 |
+
|
| 17 |
+
id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
|
| 18 |
+
|
| 19 |
+
id_kp = id_pkix + (3, )
|
| 20 |
+
|
| 21 |
+
id_kp_secureShellClient = id_kp + (21, )
|
| 22 |
+
id_kp_secureShellServer = id_kp + (22, )
|