pyasn1-alt-modules 0.4.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyasn1-alt-modules might be problematic. Click here for more details.
- pyasn1_alt_modules/__init__.py +2 -0
- pyasn1_alt_modules/opentypemap.py +19 -0
- pyasn1_alt_modules/pem.py +66 -0
- pyasn1_alt_modules/rfc1155.py +97 -0
- pyasn1_alt_modules/rfc1157.py +127 -0
- pyasn1_alt_modules/rfc1901.py +23 -0
- pyasn1_alt_modules/rfc1902.py +130 -0
- pyasn1_alt_modules/rfc1905.py +136 -0
- pyasn1_alt_modules/rfc2040.py +50 -0
- pyasn1_alt_modules/rfc2251.py +564 -0
- pyasn1_alt_modules/rfc2314.py +68 -0
- pyasn1_alt_modules/rfc2315.py +325 -0
- pyasn1_alt_modules/rfc2437.py +70 -0
- pyasn1_alt_modules/rfc2459.py +1340 -0
- pyasn1_alt_modules/rfc2511.py +303 -0
- pyasn1_alt_modules/rfc2528.py +34 -0
- pyasn1_alt_modules/rfc2560.py +226 -0
- pyasn1_alt_modules/rfc2631.py +37 -0
- pyasn1_alt_modules/rfc2634.py +342 -0
- pyasn1_alt_modules/rfc2743.py +60 -0
- pyasn1_alt_modules/rfc2876.py +61 -0
- pyasn1_alt_modules/rfc2898.py +72 -0
- pyasn1_alt_modules/rfc2985.py +593 -0
- pyasn1_alt_modules/rfc2986.py +76 -0
- pyasn1_alt_modules/rfc3058.py +48 -0
- pyasn1_alt_modules/rfc3114.py +80 -0
- pyasn1_alt_modules/rfc3125.py +469 -0
- pyasn1_alt_modules/rfc3161.py +142 -0
- pyasn1_alt_modules/rfc3217.py +42 -0
- pyasn1_alt_modules/rfc3274.py +62 -0
- pyasn1_alt_modules/rfc3279.py +264 -0
- pyasn1_alt_modules/rfc3280.py +1544 -0
- pyasn1_alt_modules/rfc3281.py +332 -0
- pyasn1_alt_modules/rfc3370.py +142 -0
- pyasn1_alt_modules/rfc3412.py +54 -0
- pyasn1_alt_modules/rfc3414.py +29 -0
- pyasn1_alt_modules/rfc3447.py +46 -0
- pyasn1_alt_modules/rfc3537.py +44 -0
- pyasn1_alt_modules/rfc3546.py +23 -0
- pyasn1_alt_modules/rfc3560.py +74 -0
- pyasn1_alt_modules/rfc3565.py +59 -0
- pyasn1_alt_modules/rfc3657.py +69 -0
- pyasn1_alt_modules/rfc3709.py +230 -0
- pyasn1_alt_modules/rfc3739.py +207 -0
- pyasn1_alt_modules/rfc3770.py +77 -0
- pyasn1_alt_modules/rfc3779.py +139 -0
- pyasn1_alt_modules/rfc3820.py +66 -0
- pyasn1_alt_modules/rfc3852.py +707 -0
- pyasn1_alt_modules/rfc3874.py +29 -0
- pyasn1_alt_modules/rfc4010.py +58 -0
- pyasn1_alt_modules/rfc4043.py +45 -0
- pyasn1_alt_modules/rfc4055.py +285 -0
- pyasn1_alt_modules/rfc4056.py +56 -0
- pyasn1_alt_modules/rfc4059.py +101 -0
- pyasn1_alt_modules/rfc4073.py +62 -0
- pyasn1_alt_modules/rfc4108.py +355 -0
- pyasn1_alt_modules/rfc4210.py +807 -0
- pyasn1_alt_modules/rfc4211.py +420 -0
- pyasn1_alt_modules/rfc4231.py +38 -0
- pyasn1_alt_modules/rfc4262.py +37 -0
- pyasn1_alt_modules/rfc4334.py +78 -0
- pyasn1_alt_modules/rfc4357.py +485 -0
- pyasn1_alt_modules/rfc4366.py +23 -0
- pyasn1_alt_modules/rfc4387.py +23 -0
- pyasn1_alt_modules/rfc4476.py +99 -0
- pyasn1_alt_modules/rfc4490.py +119 -0
- pyasn1_alt_modules/rfc4491.py +44 -0
- pyasn1_alt_modules/rfc4683.py +76 -0
- pyasn1_alt_modules/rfc4985.py +52 -0
- pyasn1_alt_modules/rfc4998.py +125 -0
- pyasn1_alt_modules/rfc5035.py +206 -0
- pyasn1_alt_modules/rfc5055.py +763 -0
- pyasn1_alt_modules/rfc5083.py +55 -0
- pyasn1_alt_modules/rfc5084.py +94 -0
- pyasn1_alt_modules/rfc5126.py +578 -0
- pyasn1_alt_modules/rfc5208.py +73 -0
- pyasn1_alt_modules/rfc5275.py +404 -0
- pyasn1_alt_modules/rfc5276.py +82 -0
- pyasn1_alt_modules/rfc5280.py +1666 -0
- pyasn1_alt_modules/rfc5480.py +190 -0
- pyasn1_alt_modules/rfc5544.py +127 -0
- pyasn1_alt_modules/rfc5636.py +117 -0
- pyasn1_alt_modules/rfc5639.py +49 -0
- pyasn1_alt_modules/rfc5649.py +33 -0
- pyasn1_alt_modules/rfc5652.py +763 -0
- pyasn1_alt_modules/rfc5697.py +64 -0
- pyasn1_alt_modules/rfc5698.py +159 -0
- pyasn1_alt_modules/rfc5751.py +127 -0
- pyasn1_alt_modules/rfc5752.py +52 -0
- pyasn1_alt_modules/rfc5753.py +163 -0
- pyasn1_alt_modules/rfc5755.py +400 -0
- pyasn1_alt_modules/rfc5913.py +46 -0
- pyasn1_alt_modules/rfc5914.py +119 -0
- pyasn1_alt_modules/rfc5915.py +32 -0
- pyasn1_alt_modules/rfc5916.py +39 -0
- pyasn1_alt_modules/rfc5917.py +59 -0
- pyasn1_alt_modules/rfc5924.py +19 -0
- pyasn1_alt_modules/rfc5934.py +786 -0
- pyasn1_alt_modules/rfc5940.py +62 -0
- pyasn1_alt_modules/rfc5958.py +100 -0
- pyasn1_alt_modules/rfc5990.py +238 -0
- pyasn1_alt_modules/rfc6010.py +92 -0
- pyasn1_alt_modules/rfc6019.py +46 -0
- pyasn1_alt_modules/rfc6031.py +469 -0
- pyasn1_alt_modules/rfc6032.py +71 -0
- pyasn1_alt_modules/rfc6066.py +25 -0
- pyasn1_alt_modules/rfc6120.py +46 -0
- pyasn1_alt_modules/rfc6170.py +17 -0
- pyasn1_alt_modules/rfc6187.py +22 -0
- pyasn1_alt_modules/rfc6210.py +45 -0
- pyasn1_alt_modules/rfc6211.py +75 -0
- pyasn1_alt_modules/rfc6402.py +643 -0
- pyasn1_alt_modules/rfc6482.py +77 -0
- pyasn1_alt_modules/rfc6484.py +17 -0
- pyasn1_alt_modules/rfc6486.py +70 -0
- pyasn1_alt_modules/rfc6487.py +22 -0
- pyasn1_alt_modules/rfc6492.py +41 -0
- pyasn1_alt_modules/rfc6493.py +24 -0
- pyasn1_alt_modules/rfc6494.py +23 -0
- pyasn1_alt_modules/rfc6664.py +151 -0
- pyasn1_alt_modules/rfc6955.py +112 -0
- pyasn1_alt_modules/rfc6960.py +234 -0
- pyasn1_alt_modules/rfc6962.py +52 -0
- pyasn1_alt_modules/rfc7030.py +70 -0
- pyasn1_alt_modules/rfc7191.py +267 -0
- pyasn1_alt_modules/rfc7229.py +29 -0
- pyasn1_alt_modules/rfc7292.py +359 -0
- pyasn1_alt_modules/rfc7296.py +32 -0
- pyasn1_alt_modules/rfc7508.py +92 -0
- pyasn1_alt_modules/rfc7585.py +53 -0
- pyasn1_alt_modules/rfc7633.py +40 -0
- pyasn1_alt_modules/rfc7693.py +66 -0
- pyasn1_alt_modules/rfc7773.py +54 -0
- pyasn1_alt_modules/rfc7836.py +65 -0
- pyasn1_alt_modules/rfc7894.py +100 -0
- pyasn1_alt_modules/rfc7906.py +739 -0
- pyasn1_alt_modules/rfc7914.py +55 -0
- pyasn1_alt_modules/rfc8017.py +159 -0
- pyasn1_alt_modules/rfc8018.py +269 -0
- pyasn1_alt_modules/rfc8103.py +36 -0
- pyasn1_alt_modules/rfc8209.py +20 -0
- pyasn1_alt_modules/rfc8226.py +151 -0
- pyasn1_alt_modules/rfc8358.py +54 -0
- pyasn1_alt_modules/rfc8360.py +46 -0
- pyasn1_alt_modules/rfc8398.py +55 -0
- pyasn1_alt_modules/rfc8410.py +43 -0
- pyasn1_alt_modules/rfc8418.py +36 -0
- pyasn1_alt_modules/rfc8419.py +70 -0
- pyasn1_alt_modules/rfc8479.py +48 -0
- pyasn1_alt_modules/rfc8494.py +80 -0
- pyasn1_alt_modules/rfc8520.py +66 -0
- pyasn1_alt_modules/rfc8619.py +45 -0
- pyasn1_alt_modules/rfc8649.py +42 -0
- pyasn1_alt_modules/rfc8692.py +79 -0
- pyasn1_alt_modules/rfc8696.py +108 -0
- pyasn1_alt_modules/rfc8702.py +109 -0
- pyasn1_alt_modules/rfc8708.py +43 -0
- pyasn1_alt_modules/rfc8737.py +36 -0
- pyasn1_alt_modules/rfc8769.py +21 -0
- pyasn1_alt_modules/rfc8894.py +52 -0
- pyasn1_alt_modules/rfc8951.py +42 -0
- pyasn1_alt_modules/rfc8954.py +238 -0
- pyasn1_alt_modules/rfc8994.py +52 -0
- pyasn1_alt_modules/rfc8995.py +39 -0
- pyasn1_alt_modules/rfc9044.py +80 -0
- pyasn1_alt_modules/rfc9092.py +35 -0
- pyasn1_alt_modules/rfc9118.py +82 -0
- pyasn1_alt_modules/rfc9174.py +55 -0
- pyasn1_alt_modules/rfc9189.py +74 -0
- pyasn1_alt_modules/rfc9215.py +228 -0
- pyasn1_alt_modules/rfc9286.py +78 -0
- pyasn1_alt_modules/rfc9289.py +22 -0
- pyasn1_alt_modules/rfc9310.py +46 -0
- pyasn1_alt_modules/rfc9323.py +129 -0
- pyasn1_alt_modules/rfc9336.py +20 -0
- pyasn1_alt_modules/rfc9337.py +74 -0
- pyasn1_alt_modules/rfc9345.py +36 -0
- pyasn1_alt_modules/rfc9385.py +22 -0
- pyasn1_alt_modules/rfc9399.py +59 -0
- pyasn1_alt_modules/rfc9480.py +731 -0
- pyasn1_alt_modules/rfc9481.py +224 -0
- pyasn1_alt_modules/rfc9509.py +24 -0
- pyasn1_alt_modules/rfc9548.py +23 -0
- pyasn1_alt_modules/rfc9579.py +89 -0
- pyasn1_alt_modules/rfc9582.py +107 -0
- pyasn1_alt_modules/rfc9598.py +52 -0
- pyasn1_alt_modules/rfc9608.py +35 -0
- pyasn1_alt_modules/rfc9629.py +100 -0
- pyasn1_alt_modules/rfc9654.py +241 -0
- pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
- pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
- pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
- pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
- pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
- pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
5
|
+
# Modified by Russ Housley to add map for use with opentypes.
|
|
6
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
9
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
10
|
+
#
|
|
11
|
+
# Additional CMS Revocation Information Choices
|
|
12
|
+
#
|
|
13
|
+
# ASN.1 source from:
|
|
14
|
+
# https://www.rfc-editor.org/rfc/rfc5940.txt
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
from pyasn1.type import namedtype
|
|
18
|
+
from pyasn1.type import tag
|
|
19
|
+
from pyasn1.type import univ
|
|
20
|
+
|
|
21
|
+
from pyasn1_alt_modules import rfc2560
|
|
22
|
+
from pyasn1_alt_modules import rfc5652
|
|
23
|
+
from pyasn1_alt_modules import opentypemap
|
|
24
|
+
|
|
25
|
+
otherRevInfoFormatMap = opentypemap.get('otherRevInfoFormatMap')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# RevocationInfoChoice for OCSP response:
|
|
29
|
+
# The OID is included in otherRevInfoFormat, and
|
|
30
|
+
# signed OCSPResponse is included in otherRevInfo
|
|
31
|
+
|
|
32
|
+
id_ri_ocsp_response = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.2')
|
|
33
|
+
|
|
34
|
+
OCSPResponse = rfc2560.OCSPResponse
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# RevocationInfoChoice for SCVP request/response:
|
|
38
|
+
# The OID is included in otherRevInfoFormat, and
|
|
39
|
+
# SCVPReqRes is included in otherRevInfo
|
|
40
|
+
|
|
41
|
+
id_ri_scvp = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.4')
|
|
42
|
+
|
|
43
|
+
ContentInfo = rfc5652.ContentInfo
|
|
44
|
+
|
|
45
|
+
class SCVPReqRes(univ.Sequence):
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
SCVPReqRes.componentType = namedtype.NamedTypes(
|
|
49
|
+
namedtype.OptionalNamedType('request',
|
|
50
|
+
ContentInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
|
|
51
|
+
namedtype.NamedType('response', ContentInfo())
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# Update the Revocation Info Formats Map
|
|
56
|
+
|
|
57
|
+
_otherRevInfoFormatMapUpdate = {
|
|
58
|
+
id_ri_ocsp_response: OCSPResponse(),
|
|
59
|
+
id_ri_scvp: SCVPReqRes(),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
otherRevInfoFormatMap.update(_otherRevInfoFormatMapUpdate)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley.
|
|
5
|
+
# Modified by Russ Housley to add a map for use with opentypes.
|
|
6
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
9
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
10
|
+
#
|
|
11
|
+
# Asymmetric Key Packages, which is essentially version 2 of
|
|
12
|
+
# the PrivateKeyInfo structure in PKCS#8 in RFC 5208
|
|
13
|
+
#
|
|
14
|
+
# ASN.1 source from:
|
|
15
|
+
# https://www.rfc-editor.org/rfc/rfc5958.txt
|
|
16
|
+
|
|
17
|
+
from pyasn1.type import univ, constraint, namedtype, namedval, tag
|
|
18
|
+
|
|
19
|
+
from pyasn1_alt_modules import rfc5280
|
|
20
|
+
from pyasn1_alt_modules import rfc5652
|
|
21
|
+
from pyasn1_alt_modules import opentypemap
|
|
22
|
+
|
|
23
|
+
cmsContentTypesMap = opentypemap.get('cmsContentTypesMap')
|
|
24
|
+
|
|
25
|
+
MAX = float('inf')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class KeyEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class PrivateKeyAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class EncryptedData(univ.OctetString):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class EncryptedPrivateKeyInfo(univ.Sequence):
|
|
41
|
+
componentType = namedtype.NamedTypes(
|
|
42
|
+
namedtype.NamedType('encryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
|
|
43
|
+
namedtype.NamedType('encryptedData', EncryptedData())
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class Version(univ.Integer):
|
|
48
|
+
namedValues = namedval.NamedValues(('v1', 0), ('v2', 1))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class PrivateKey(univ.OctetString):
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Attributes(univ.SetOf):
|
|
56
|
+
componentType = rfc5652.Attribute()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class PublicKey(univ.BitString):
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# OneAsymmetricKey is essentially version 2 of PrivateKeyInfo.
|
|
64
|
+
# If publicKey is present, then the version must be v2;
|
|
65
|
+
# otherwise, the version should be v1.
|
|
66
|
+
|
|
67
|
+
class OneAsymmetricKey(univ.Sequence):
|
|
68
|
+
componentType = namedtype.NamedTypes(
|
|
69
|
+
namedtype.NamedType('version', Version()),
|
|
70
|
+
namedtype.NamedType('privateKeyAlgorithm', PrivateKeyAlgorithmIdentifier()),
|
|
71
|
+
namedtype.NamedType('privateKey', PrivateKey()),
|
|
72
|
+
namedtype.OptionalNamedType('attributes', Attributes().subtype(
|
|
73
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
74
|
+
namedtype.OptionalNamedType('publicKey', PublicKey().subtype(
|
|
75
|
+
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class PrivateKeyInfo(OneAsymmetricKey):
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# The CMS AsymmetricKeyPackage Content Type
|
|
84
|
+
|
|
85
|
+
id_ct_KP_aKeyPackage = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.5')
|
|
86
|
+
|
|
87
|
+
class AsymmetricKeyPackage(univ.SequenceOf):
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
AsymmetricKeyPackage.componentType = OneAsymmetricKey()
|
|
91
|
+
AsymmetricKeyPackage.sizeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Update the CMS Content Types Map
|
|
95
|
+
|
|
96
|
+
_cmsContentTypesMapUpdate = {
|
|
97
|
+
id_ct_KP_aKeyPackage: AsymmetricKeyPackage(),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
5
|
+
# Modified by Russ Housley to update the S/MIME Capabilities map.
|
|
6
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
9
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
10
|
+
#
|
|
11
|
+
# Use of the RSA-KEM Key Transport Algorithm in the CMS
|
|
12
|
+
#
|
|
13
|
+
# ASN.1 source from:
|
|
14
|
+
# https://www.rfc-editor.org/rfc/rfc5990.txt
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
from pyasn1.type import constraint
|
|
18
|
+
from pyasn1.type import namedtype
|
|
19
|
+
from pyasn1.type import univ
|
|
20
|
+
|
|
21
|
+
from pyasn1_alt_modules import rfc5280
|
|
22
|
+
from pyasn1_alt_modules import rfc5751
|
|
23
|
+
from pyasn1_alt_modules import opentypemap
|
|
24
|
+
|
|
25
|
+
algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
|
|
26
|
+
|
|
27
|
+
smimeCapabilityMap = opentypemap.get('smimeCapabilityMap')
|
|
28
|
+
|
|
29
|
+
MAX = float('inf')
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Imports from RFC 5280
|
|
33
|
+
|
|
34
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Useful types and definitions
|
|
38
|
+
|
|
39
|
+
class NullParms(univ.Null):
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Object identifier arcs
|
|
44
|
+
|
|
45
|
+
is18033_2 = univ.ObjectIdentifier((1, 0, 18033, 2))
|
|
46
|
+
|
|
47
|
+
nistAlgorithm = univ.ObjectIdentifier((2, 16, 840, 1, 101, 3, 4))
|
|
48
|
+
|
|
49
|
+
pkcs_1 = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 1))
|
|
50
|
+
|
|
51
|
+
x9_44 = univ.ObjectIdentifier((1, 3, 133, 16, 840, 9, 44))
|
|
52
|
+
|
|
53
|
+
x9_44_components = x9_44 + (1,)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Types for algorithm identifiers
|
|
57
|
+
|
|
58
|
+
class Camellia_KeyWrappingScheme(AlgorithmIdentifier):
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
class DataEncapsulationMechanism(AlgorithmIdentifier):
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
class KDF2_HashFunction(AlgorithmIdentifier):
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
class KDF3_HashFunction(AlgorithmIdentifier):
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
class KeyDerivationFunction(AlgorithmIdentifier):
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
class KeyEncapsulationMechanism(AlgorithmIdentifier):
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
class X9_SymmetricKeyWrappingScheme(AlgorithmIdentifier):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# RSA-KEM Key Transport Algorithm
|
|
81
|
+
|
|
82
|
+
id_rsa_kem = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 3, 14))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class GenericHybridParameters(univ.Sequence):
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
GenericHybridParameters.componentType = namedtype.NamedTypes(
|
|
89
|
+
namedtype.NamedType('kem', KeyEncapsulationMechanism()),
|
|
90
|
+
namedtype.NamedType('dem', DataEncapsulationMechanism())
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
rsa_kem = AlgorithmIdentifier()
|
|
95
|
+
rsa_kem['algorithm'] = id_rsa_kem
|
|
96
|
+
rsa_kem['parameters'] = GenericHybridParameters()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# KEM-RSA Key Encapsulation Mechanism
|
|
100
|
+
|
|
101
|
+
id_kem_rsa = is18033_2 + (2, 4)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class KeyLength(univ.Integer):
|
|
105
|
+
pass
|
|
106
|
+
|
|
107
|
+
KeyLength.subtypeSpec = constraint.ValueRangeConstraint(1, MAX)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class RsaKemParameters(univ.Sequence):
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
RsaKemParameters.componentType = namedtype.NamedTypes(
|
|
114
|
+
namedtype.NamedType('keyDerivationFunction', KeyDerivationFunction()),
|
|
115
|
+
namedtype.NamedType('keyLength', KeyLength())
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
kem_rsa = AlgorithmIdentifier()
|
|
120
|
+
kem_rsa['algorithm'] = id_kem_rsa
|
|
121
|
+
kem_rsa['parameters'] = RsaKemParameters()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# Key Derivation Functions
|
|
125
|
+
|
|
126
|
+
id_kdf_kdf2 = x9_44_components + (1,)
|
|
127
|
+
|
|
128
|
+
id_kdf_kdf3 = x9_44_components + (2,)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
kdf2 = AlgorithmIdentifier()
|
|
132
|
+
kdf2['algorithm'] = id_kdf_kdf2
|
|
133
|
+
kdf2['parameters'] = KDF2_HashFunction()
|
|
134
|
+
|
|
135
|
+
kdf3 = AlgorithmIdentifier()
|
|
136
|
+
kdf3['algorithm'] = id_kdf_kdf3
|
|
137
|
+
kdf3['parameters'] = KDF3_HashFunction()
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# Hash Functions
|
|
141
|
+
|
|
142
|
+
id_sha1 = univ.ObjectIdentifier((1, 3, 14, 3, 2, 26))
|
|
143
|
+
|
|
144
|
+
id_sha224 = univ.ObjectIdentifier((2, 16, 840, 1, 101, 3, 4, 2, 4))
|
|
145
|
+
|
|
146
|
+
id_sha256 = univ.ObjectIdentifier((2, 16, 840, 1, 101, 3, 4, 2, 1))
|
|
147
|
+
|
|
148
|
+
id_sha384 = univ.ObjectIdentifier((2, 16, 840, 1, 101, 3, 4, 2, 2))
|
|
149
|
+
|
|
150
|
+
id_sha512 = univ.ObjectIdentifier((2, 16, 840, 1, 101, 3, 4, 2, 3))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
sha1 = AlgorithmIdentifier()
|
|
154
|
+
sha1['algorithm'] = id_sha1
|
|
155
|
+
sha1['parameters'] = univ.Null("")
|
|
156
|
+
|
|
157
|
+
sha224 = AlgorithmIdentifier()
|
|
158
|
+
sha224['algorithm'] = id_sha224
|
|
159
|
+
sha224['parameters'] = univ.Null("")
|
|
160
|
+
|
|
161
|
+
sha256 = AlgorithmIdentifier()
|
|
162
|
+
sha256['algorithm'] = id_sha256
|
|
163
|
+
sha256['parameters'] = univ.Null("")
|
|
164
|
+
|
|
165
|
+
sha384 = AlgorithmIdentifier()
|
|
166
|
+
sha384['algorithm'] = id_sha384
|
|
167
|
+
sha384['parameters'] = univ.Null("")
|
|
168
|
+
|
|
169
|
+
sha512 = AlgorithmIdentifier()
|
|
170
|
+
sha512['algorithm'] = id_sha512
|
|
171
|
+
sha512['parameters'] = univ.Null("")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# Symmetric Key-Wrapping Schemes
|
|
175
|
+
|
|
176
|
+
id_aes128_Wrap = nistAlgorithm + (1, 5)
|
|
177
|
+
|
|
178
|
+
id_aes192_Wrap = nistAlgorithm + (1, 25)
|
|
179
|
+
|
|
180
|
+
id_aes256_Wrap = nistAlgorithm + (1, 45)
|
|
181
|
+
|
|
182
|
+
id_alg_CMS3DESwrap = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 3, 6))
|
|
183
|
+
|
|
184
|
+
id_camellia128_Wrap = univ.ObjectIdentifier((1, 2, 392, 200011, 61, 1, 1, 3, 2))
|
|
185
|
+
|
|
186
|
+
id_camellia192_Wrap = univ.ObjectIdentifier((1, 2, 392, 200011, 61, 1, 1, 3, 3))
|
|
187
|
+
|
|
188
|
+
id_camellia256_Wrap = univ.ObjectIdentifier((1, 2, 392, 200011, 61, 1, 1, 3, 4))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
aes128_Wrap = AlgorithmIdentifier()
|
|
192
|
+
aes128_Wrap['algorithm'] = id_aes128_Wrap
|
|
193
|
+
# aes128_Wrap['parameters'] are absent
|
|
194
|
+
|
|
195
|
+
aes192_Wrap = AlgorithmIdentifier()
|
|
196
|
+
aes192_Wrap['algorithm'] = id_aes128_Wrap
|
|
197
|
+
# aes192_Wrap['parameters'] are absent
|
|
198
|
+
|
|
199
|
+
aes256_Wrap = AlgorithmIdentifier()
|
|
200
|
+
aes256_Wrap['algorithm'] = id_sha256
|
|
201
|
+
# aes256_Wrap['parameters'] are absent
|
|
202
|
+
|
|
203
|
+
tdes_Wrap = AlgorithmIdentifier()
|
|
204
|
+
tdes_Wrap['algorithm'] = id_alg_CMS3DESwrap
|
|
205
|
+
tdes_Wrap['parameters'] = univ.Null("")
|
|
206
|
+
|
|
207
|
+
camellia128_Wrap = AlgorithmIdentifier()
|
|
208
|
+
camellia128_Wrap['algorithm'] = id_camellia128_Wrap
|
|
209
|
+
# camellia128_Wrap['parameters'] are absent
|
|
210
|
+
|
|
211
|
+
camellia192_Wrap = AlgorithmIdentifier()
|
|
212
|
+
camellia192_Wrap['algorithm'] = id_camellia192_Wrap
|
|
213
|
+
# camellia192_Wrap['parameters'] are absent
|
|
214
|
+
|
|
215
|
+
camellia256_Wrap = AlgorithmIdentifier()
|
|
216
|
+
camellia256_Wrap['algorithm'] = id_camellia256_Wrap
|
|
217
|
+
# camellia256_Wrap['parameters'] are absent
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
# Update the Algorithm Identifier map and the S/MIME Capabilities map.
|
|
221
|
+
# Note that the ones that must not have parameters are not added to the maps.
|
|
222
|
+
|
|
223
|
+
_algorithmIdentifierMapUpdate = {
|
|
224
|
+
id_rsa_kem: GenericHybridParameters(),
|
|
225
|
+
id_kem_rsa: RsaKemParameters(),
|
|
226
|
+
id_kdf_kdf2: KDF2_HashFunction(),
|
|
227
|
+
id_kdf_kdf3: KDF3_HashFunction(),
|
|
228
|
+
id_sha1: univ.Null(),
|
|
229
|
+
id_sha224: univ.Null(),
|
|
230
|
+
id_sha256: univ.Null(),
|
|
231
|
+
id_sha384: univ.Null(),
|
|
232
|
+
id_sha512: univ.Null(),
|
|
233
|
+
id_alg_CMS3DESwrap: univ.Null(),
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
|
237
|
+
|
|
238
|
+
smimeCapabilityMap.update(_algorithmIdentifierMapUpdate)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
|
|
5
|
+
# Modified by Russ Housley to add maps for use with opentypes.
|
|
6
|
+
# Modified by Russ Housley to include the opentypemap manager.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (c) 2019-2024, Vigil Security, LLC
|
|
9
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
10
|
+
#
|
|
11
|
+
# Certificate Extension for CMS Content Constraints (CCC)
|
|
12
|
+
#
|
|
13
|
+
# ASN.1 source from:
|
|
14
|
+
# https://www.rfc-editor.org/rfc/rfc6010.txt
|
|
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 univ
|
|
21
|
+
|
|
22
|
+
from pyasn1_alt_modules import rfc5280
|
|
23
|
+
from pyasn1_alt_modules import opentypemap
|
|
24
|
+
|
|
25
|
+
certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
|
|
26
|
+
|
|
27
|
+
MAX = float('inf')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
AttributeType = rfc5280.AttributeType
|
|
31
|
+
|
|
32
|
+
AttributeValue = rfc5280.AttributeValue
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
id_ct_anyContentType = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.0')
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AttrConstraint(univ.Sequence):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
AttrConstraint.componentType = namedtype.NamedTypes(
|
|
42
|
+
namedtype.NamedType('attrType', AttributeType()),
|
|
43
|
+
namedtype.NamedType('attrValues', univ.SetOf(
|
|
44
|
+
componentType=AttributeValue()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class AttrConstraintList(univ.SequenceOf):
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
AttrConstraintList.componentType = AttrConstraint()
|
|
52
|
+
AttrConstraintList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ContentTypeGeneration(univ.Enumerated):
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
ContentTypeGeneration.namedValues = namedval.NamedValues(
|
|
59
|
+
('canSource', 0),
|
|
60
|
+
('cannotSource', 1)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class ContentTypeConstraint(univ.Sequence):
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
ContentTypeConstraint.componentType = namedtype.NamedTypes(
|
|
68
|
+
namedtype.NamedType('contentType', univ.ObjectIdentifier()),
|
|
69
|
+
namedtype.DefaultedNamedType('canSource', ContentTypeGeneration().subtype(value='canSource')),
|
|
70
|
+
namedtype.OptionalNamedType('attrConstraints', AttrConstraintList())
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# CMS Content Constraints (CCC) Extension and Object Identifier
|
|
75
|
+
|
|
76
|
+
id_pe_cmsContentConstraints = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.18')
|
|
77
|
+
|
|
78
|
+
class CMSContentConstraints(univ.SequenceOf):
|
|
79
|
+
pass
|
|
80
|
+
|
|
81
|
+
CMSContentConstraints.componentType = ContentTypeConstraint()
|
|
82
|
+
CMSContentConstraints.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# Map of Certificate Extension OIDs to Extensions
|
|
86
|
+
# To be added to the ones that are in rfc5280.py
|
|
87
|
+
|
|
88
|
+
_certificateExtensionsMapUpdate = {
|
|
89
|
+
id_pe_cmsContentConstraints: CMSContentConstraints(),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# This file is part of pyasn1-alt-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-2024, Vigil Security, LLC
|
|
7
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
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_alt_modules import opentypemap
|
|
18
|
+
|
|
19
|
+
cmsAttributesMap = opentypemap.get('cmsAttributesMap')
|
|
20
|
+
|
|
21
|
+
MAX = float('inf')
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# BinaryTime: Represent date and time as an integer
|
|
25
|
+
|
|
26
|
+
class BinaryTime(univ.Integer):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# CMS Attribute for representing signing time in BinaryTime
|
|
33
|
+
|
|
34
|
+
id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46')
|
|
35
|
+
|
|
36
|
+
class BinarySigningTime(BinaryTime):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Update the CMS Attribute Map
|
|
41
|
+
|
|
42
|
+
_cmsAttributesMapUpdate = {
|
|
43
|
+
id_aa_binarySigningTime: BinarySigningTime(),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
cmsAttributesMap.update(_cmsAttributesMapUpdate)
|