pyasn1-alt-modules 0.4.5__py3-none-any.whl → 0.4.6__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 +1 -1
- pyasn1_alt_modules/opentypemap.py +1 -1
- pyasn1_alt_modules/pem.py +1 -1
- pyasn1_alt_modules/rfc1155.py +1 -1
- pyasn1_alt_modules/rfc1157.py +1 -1
- pyasn1_alt_modules/rfc1901.py +1 -1
- pyasn1_alt_modules/rfc1902.py +1 -1
- pyasn1_alt_modules/rfc1905.py +1 -1
- pyasn1_alt_modules/rfc2040.py +1 -1
- pyasn1_alt_modules/rfc2251.py +1 -1
- pyasn1_alt_modules/rfc2314.py +1 -1
- pyasn1_alt_modules/rfc2315.py +1 -1
- pyasn1_alt_modules/rfc2437.py +1 -1
- pyasn1_alt_modules/rfc2459.py +1 -1
- pyasn1_alt_modules/rfc2511.py +1 -1
- pyasn1_alt_modules/rfc2528.py +1 -1
- pyasn1_alt_modules/rfc2560.py +1 -1
- pyasn1_alt_modules/rfc2631.py +1 -1
- pyasn1_alt_modules/rfc2634.py +1 -1
- pyasn1_alt_modules/rfc2743.py +1 -1
- pyasn1_alt_modules/rfc2876.py +1 -1
- pyasn1_alt_modules/rfc2898.py +1 -1
- pyasn1_alt_modules/rfc2985.py +1 -1
- pyasn1_alt_modules/rfc2986.py +1 -1
- pyasn1_alt_modules/rfc3058.py +1 -1
- pyasn1_alt_modules/rfc3114.py +1 -1
- pyasn1_alt_modules/rfc3125.py +1 -1
- pyasn1_alt_modules/rfc3161.py +1 -1
- pyasn1_alt_modules/rfc3217.py +1 -1
- pyasn1_alt_modules/rfc3274.py +1 -1
- pyasn1_alt_modules/rfc3279.py +1 -1
- pyasn1_alt_modules/rfc3280.py +1 -1
- pyasn1_alt_modules/rfc3281.py +1 -1
- pyasn1_alt_modules/rfc3370.py +1 -1
- pyasn1_alt_modules/rfc3412.py +1 -1
- pyasn1_alt_modules/rfc3414.py +1 -1
- pyasn1_alt_modules/rfc3447.py +1 -1
- pyasn1_alt_modules/rfc3537.py +1 -1
- pyasn1_alt_modules/rfc3546.py +1 -1
- pyasn1_alt_modules/rfc3560.py +1 -1
- pyasn1_alt_modules/rfc3565.py +1 -1
- pyasn1_alt_modules/rfc3657.py +1 -1
- pyasn1_alt_modules/rfc3709.py +1 -1
- pyasn1_alt_modules/rfc3739.py +1 -2
- pyasn1_alt_modules/rfc3770.py +1 -1
- pyasn1_alt_modules/rfc3779.py +1 -1
- pyasn1_alt_modules/rfc3820.py +1 -1
- pyasn1_alt_modules/rfc3852.py +1 -1
- pyasn1_alt_modules/rfc3874.py +1 -1
- pyasn1_alt_modules/rfc4010.py +1 -1
- pyasn1_alt_modules/rfc4043.py +1 -1
- pyasn1_alt_modules/rfc4055.py +1 -1
- pyasn1_alt_modules/rfc4056.py +1 -1
- pyasn1_alt_modules/rfc4059.py +1 -1
- pyasn1_alt_modules/rfc4073.py +1 -1
- pyasn1_alt_modules/rfc4108.py +1 -1
- pyasn1_alt_modules/rfc4210.py +1 -1
- pyasn1_alt_modules/rfc4211.py +1 -1
- pyasn1_alt_modules/rfc4231.py +1 -1
- pyasn1_alt_modules/rfc4262.py +1 -1
- pyasn1_alt_modules/rfc4334.py +1 -1
- pyasn1_alt_modules/rfc4357.py +1 -1
- pyasn1_alt_modules/rfc4366.py +1 -1
- pyasn1_alt_modules/rfc4387.py +1 -1
- pyasn1_alt_modules/rfc4476.py +1 -1
- pyasn1_alt_modules/rfc4490.py +1 -1
- pyasn1_alt_modules/rfc4491.py +1 -1
- pyasn1_alt_modules/rfc4683.py +1 -1
- pyasn1_alt_modules/rfc4985.py +1 -1
- pyasn1_alt_modules/rfc4998.py +1 -1
- pyasn1_alt_modules/rfc5035.py +1 -1
- pyasn1_alt_modules/rfc5055.py +1 -1
- pyasn1_alt_modules/rfc5083.py +1 -1
- pyasn1_alt_modules/rfc5084.py +1 -1
- pyasn1_alt_modules/rfc5126.py +1 -1
- pyasn1_alt_modules/rfc5208.py +1 -1
- pyasn1_alt_modules/rfc5275.py +1 -1
- pyasn1_alt_modules/rfc5276.py +1 -1
- pyasn1_alt_modules/rfc5280.py +1 -1
- pyasn1_alt_modules/rfc5480.py +1 -1
- pyasn1_alt_modules/rfc5544.py +1 -1
- pyasn1_alt_modules/rfc5636.py +1 -1
- pyasn1_alt_modules/rfc5639.py +1 -1
- pyasn1_alt_modules/rfc5649.py +1 -1
- pyasn1_alt_modules/rfc5652.py +1 -1
- pyasn1_alt_modules/rfc5697.py +1 -1
- pyasn1_alt_modules/rfc5698.py +1 -1
- pyasn1_alt_modules/rfc5751.py +1 -1
- pyasn1_alt_modules/rfc5752.py +1 -1
- pyasn1_alt_modules/rfc5753.py +1 -1
- pyasn1_alt_modules/rfc5755.py +1 -1
- pyasn1_alt_modules/rfc5913.py +1 -1
- pyasn1_alt_modules/rfc5914.py +1 -1
- pyasn1_alt_modules/rfc5915.py +1 -1
- pyasn1_alt_modules/rfc5916.py +1 -1
- pyasn1_alt_modules/rfc5917.py +1 -1
- pyasn1_alt_modules/rfc5924.py +1 -1
- pyasn1_alt_modules/rfc5934.py +1 -1
- pyasn1_alt_modules/rfc5940.py +1 -1
- pyasn1_alt_modules/rfc5958.py +1 -1
- pyasn1_alt_modules/rfc5990.py +1 -1
- pyasn1_alt_modules/rfc6010.py +1 -1
- pyasn1_alt_modules/rfc6019.py +1 -1
- pyasn1_alt_modules/rfc6031.py +1 -1
- pyasn1_alt_modules/rfc6032.py +1 -1
- pyasn1_alt_modules/rfc6066.py +1 -1
- pyasn1_alt_modules/rfc6120.py +1 -1
- pyasn1_alt_modules/rfc6170.py +1 -1
- pyasn1_alt_modules/rfc6187.py +1 -1
- pyasn1_alt_modules/rfc6210.py +1 -1
- pyasn1_alt_modules/rfc6211.py +1 -1
- pyasn1_alt_modules/rfc6402.py +1 -1
- pyasn1_alt_modules/rfc6482.py +1 -1
- pyasn1_alt_modules/rfc6484.py +1 -1
- pyasn1_alt_modules/rfc6486.py +1 -1
- pyasn1_alt_modules/rfc6487.py +1 -1
- pyasn1_alt_modules/rfc6492.py +1 -1
- pyasn1_alt_modules/rfc6493.py +1 -1
- pyasn1_alt_modules/rfc6494.py +1 -1
- pyasn1_alt_modules/rfc6664.py +1 -1
- pyasn1_alt_modules/rfc6955.py +1 -1
- pyasn1_alt_modules/rfc6960.py +1 -1
- pyasn1_alt_modules/rfc6962.py +1 -1
- pyasn1_alt_modules/rfc7030.py +1 -1
- pyasn1_alt_modules/rfc7191.py +1 -1
- pyasn1_alt_modules/rfc7229.py +1 -1
- pyasn1_alt_modules/rfc7292.py +1 -1
- pyasn1_alt_modules/rfc7296.py +1 -1
- pyasn1_alt_modules/rfc7508.py +1 -1
- pyasn1_alt_modules/rfc7585.py +1 -1
- pyasn1_alt_modules/rfc7633.py +1 -1
- pyasn1_alt_modules/rfc7693.py +1 -1
- pyasn1_alt_modules/rfc7773.py +1 -1
- pyasn1_alt_modules/rfc7836.py +1 -1
- pyasn1_alt_modules/rfc7894.py +1 -1
- pyasn1_alt_modules/rfc7906.py +1 -1
- pyasn1_alt_modules/rfc7914.py +1 -1
- pyasn1_alt_modules/rfc8017.py +1 -1
- pyasn1_alt_modules/rfc8018.py +1 -1
- pyasn1_alt_modules/rfc8103.py +1 -1
- pyasn1_alt_modules/rfc8209.py +1 -1
- pyasn1_alt_modules/rfc8226.py +1 -1
- pyasn1_alt_modules/rfc8358.py +1 -1
- pyasn1_alt_modules/rfc8360.py +1 -1
- pyasn1_alt_modules/rfc8398.py +1 -1
- pyasn1_alt_modules/rfc8410.py +1 -1
- pyasn1_alt_modules/rfc8418.py +1 -1
- pyasn1_alt_modules/rfc8419.py +1 -1
- pyasn1_alt_modules/rfc8479.py +1 -1
- pyasn1_alt_modules/rfc8494.py +1 -1
- pyasn1_alt_modules/rfc8520.py +1 -1
- pyasn1_alt_modules/rfc8619.py +1 -1
- pyasn1_alt_modules/rfc8649.py +1 -1
- pyasn1_alt_modules/rfc8692.py +1 -1
- pyasn1_alt_modules/rfc8696.py +1 -1
- pyasn1_alt_modules/rfc8702.py +1 -1
- pyasn1_alt_modules/rfc8708.py +1 -1
- pyasn1_alt_modules/rfc8737.py +1 -1
- pyasn1_alt_modules/rfc8769.py +1 -1
- pyasn1_alt_modules/rfc8894.py +1 -1
- pyasn1_alt_modules/rfc8951.py +1 -1
- pyasn1_alt_modules/rfc8954.py +1 -1
- pyasn1_alt_modules/rfc8994.py +1 -1
- pyasn1_alt_modules/rfc8995.py +1 -1
- pyasn1_alt_modules/rfc9044.py +1 -1
- pyasn1_alt_modules/rfc9092.py +1 -1
- pyasn1_alt_modules/rfc9118.py +1 -1
- pyasn1_alt_modules/rfc9174.py +1 -1
- pyasn1_alt_modules/rfc9189.py +1 -1
- pyasn1_alt_modules/rfc9215.py +1 -1
- pyasn1_alt_modules/rfc9286.py +1 -1
- pyasn1_alt_modules/rfc9289.py +1 -1
- pyasn1_alt_modules/rfc9310.py +1 -1
- pyasn1_alt_modules/rfc9323.py +1 -1
- pyasn1_alt_modules/rfc9336.py +1 -1
- pyasn1_alt_modules/rfc9337.py +1 -1
- pyasn1_alt_modules/rfc9345.py +1 -1
- pyasn1_alt_modules/rfc9385.py +1 -1
- pyasn1_alt_modules/rfc9399.py +1 -1
- pyasn1_alt_modules/rfc9480.py +1 -1
- pyasn1_alt_modules/rfc9481.py +1 -1
- pyasn1_alt_modules/rfc9509.py +1 -1
- pyasn1_alt_modules/rfc9548.py +1 -1
- pyasn1_alt_modules/rfc9579.py +1 -1
- pyasn1_alt_modules/rfc9582.py +1 -1
- pyasn1_alt_modules/rfc9598.py +1 -1
- pyasn1_alt_modules/rfc9608.py +1 -1
- pyasn1_alt_modules/rfc9629.py +1 -1
- pyasn1_alt_modules/rfc9654.py +1 -1
- pyasn1_alt_modules/rfc9688.py +297 -0
- pyasn1_alt_modules/rfc9690.py +200 -0
- pyasn1_alt_modules/rfc9691.py +75 -0
- pyasn1_alt_modules/rfc9708.py +35 -0
- pyasn1_alt_modules/rfc9709.py +66 -0
- pyasn1_alt_modules/rfc9734.py +20 -0
- pyasn1_alt_modules-0.4.6.dist-info/METADATA +70 -0
- pyasn1_alt_modules-0.4.6.dist-info/RECORD +201 -0
- {pyasn1_alt_modules-0.4.5.dist-info → pyasn1_alt_modules-0.4.6.dist-info}/WHEEL +1 -1
- {pyasn1_alt_modules-0.4.5.dist-info → pyasn1_alt_modules-0.4.6.dist-info/licenses}/LICENSE.txt +1 -1
- pyasn1_alt_modules-0.4.5.dist-info/METADATA +0 -34
- pyasn1_alt_modules-0.4.5.dist-info/RECORD +0 -195
- {pyasn1_alt_modules-0.4.5.dist-info → pyasn1_alt_modules-0.4.6.dist-info}/top_level.txt +0 -0
- {pyasn1_alt_modules-0.4.5.dist-info → pyasn1_alt_modules-0.4.6.dist-info}/zip-safe +0 -0
pyasn1_alt_modules/rfc9608.py
CHANGED
pyasn1_alt_modules/rfc9629.py
CHANGED
pyasn1_alt_modules/rfc9654.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# Modified by Russ Housley to include size constraints for the nonce (RFC 8954).
|
|
6
6
|
# Modified by Russ Housley to adjust size constraints for the nonce (RFC 9654).
|
|
7
7
|
#
|
|
8
|
-
# Copyright (c) 2019-
|
|
8
|
+
# Copyright (c) 2019-2025, Vigil Security, LLC
|
|
9
9
|
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
10
10
|
#
|
|
11
11
|
# Online Certificate Status Protocol (OCSP)
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# This file is part of pyasn1-alt-modules software.
|
|
2
|
+
#
|
|
3
|
+
# Created by Russ Housley
|
|
4
|
+
# Modified by Russ Housley to import items related to KDF2 and KDF3 from
|
|
5
|
+
# rfc5990, which makes the algorithmIdentifierMap update more simple.
|
|
6
|
+
#
|
|
7
|
+
# Copyright (c) 2024-2025, Vigil Security, LLC
|
|
8
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
9
|
+
#
|
|
10
|
+
# Use of the SHA3 One-way Hash Functions in the CMS
|
|
11
|
+
#
|
|
12
|
+
# ASN.1 source from:
|
|
13
|
+
# https://www.rfc-editor.org/rfc/rfc9688.txt
|
|
14
|
+
|
|
15
|
+
from pyasn1.type import univ
|
|
16
|
+
|
|
17
|
+
from pyasn1_alt_modules import rfc3279
|
|
18
|
+
from pyasn1_alt_modules import rfc5280
|
|
19
|
+
from pyasn1_alt_modules import rfc5990
|
|
20
|
+
|
|
21
|
+
from pyasn1_alt_modules import opentypemap
|
|
22
|
+
|
|
23
|
+
algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
|
|
24
|
+
|
|
25
|
+
smimeCapabilityMap = opentypemap.get('smimeCapabilityMap')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Imports from RFC 3279
|
|
29
|
+
|
|
30
|
+
rsaEncryption = rfc3279.rsaEncryption
|
|
31
|
+
|
|
32
|
+
RSAPublicKey = rfc3279.RSAPublicKey
|
|
33
|
+
|
|
34
|
+
ECPoint = rfc3279.ECPoint
|
|
35
|
+
|
|
36
|
+
ECDSA_Sig_Value = rfc3279.ECDSA_Sig_Value
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Imports from RFC 5280
|
|
40
|
+
|
|
41
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Imports from RFC 5990
|
|
45
|
+
|
|
46
|
+
x9_44 = rfc5990.x9_44
|
|
47
|
+
|
|
48
|
+
x9_44_components = rfc5990.x9_44_components
|
|
49
|
+
|
|
50
|
+
id_kdf_kdf2 = rfc5990.id_kdf_kdf2
|
|
51
|
+
|
|
52
|
+
id_kdf_kdf3 = rfc5990.id_kdf_kdf3
|
|
53
|
+
|
|
54
|
+
KDF2_HashFunction = rfc5990.KDF2_HashFunction
|
|
55
|
+
|
|
56
|
+
KDF3_HashFunction = rfc5990.KDF3_HashFunction
|
|
57
|
+
|
|
58
|
+
KeyDerivationFunction = rfc5990.KeyDerivationFunction
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# OID arcs
|
|
62
|
+
|
|
63
|
+
nistAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.3.4')
|
|
64
|
+
|
|
65
|
+
hashAlgs = nistAlgorithm + (2, )
|
|
66
|
+
|
|
67
|
+
sigAlgs = nistAlgorithm + (3, )
|
|
68
|
+
|
|
69
|
+
id_alg = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3')
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# SHA3 Hash Algorithms
|
|
73
|
+
|
|
74
|
+
id_sha3_224 = hashAlgs + (7, )
|
|
75
|
+
|
|
76
|
+
id_sha3_256 = hashAlgs + (8, )
|
|
77
|
+
|
|
78
|
+
id_sha3_384 = hashAlgs + (9, )
|
|
79
|
+
|
|
80
|
+
id_sha3_512 = hashAlgs + (10, )
|
|
81
|
+
|
|
82
|
+
mda_sha3_224 = rfc5280.AlgorithmIdentifier()
|
|
83
|
+
mda_sha3_224['algorithm'] = id_sha3_224
|
|
84
|
+
# mda_id_sha3_224['parameters'] is absent
|
|
85
|
+
|
|
86
|
+
mda_sha3_256 = rfc5280.AlgorithmIdentifier()
|
|
87
|
+
mda_sha3_256['algorithm'] = id_sha3_256
|
|
88
|
+
# mda_id_sha3_256['parameters'] is absent
|
|
89
|
+
|
|
90
|
+
mda_sha3_384 = rfc5280.AlgorithmIdentifier()
|
|
91
|
+
mda_sha3_384['algorithm'] = id_sha3_384
|
|
92
|
+
# mda_id_sha3_384['parameters'] is absent
|
|
93
|
+
|
|
94
|
+
mda_sha3_512 = rfc5280.AlgorithmIdentifier()
|
|
95
|
+
mda_sha3_512['algorithm'] = id_sha3_512
|
|
96
|
+
# mda_id_sha3_512['parameters'] is absent
|
|
97
|
+
|
|
98
|
+
class HashAlgorithm(AlgorithmIdentifier):
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# RSASSA PKCS#1 v1.5 with SHA3
|
|
103
|
+
|
|
104
|
+
id_rsassa_pkcs1_v1_5_with_sha3_224 = sigAlgs + (13, )
|
|
105
|
+
|
|
106
|
+
id_rsassa_pkcs1_v1_5_with_sha3_256 = sigAlgs + (14, )
|
|
107
|
+
|
|
108
|
+
id_rsassa_pkcs1_v1_5_with_sha3_384 = sigAlgs + (15, )
|
|
109
|
+
|
|
110
|
+
id_rsassa_pkcs1_v1_5_with_sha3_512 = sigAlgs + (16, )
|
|
111
|
+
|
|
112
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_224 = rfc5280.AlgorithmIdentifier()
|
|
113
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_224['algorithm'] = id_rsassa_pkcs1_v1_5_with_sha3_224
|
|
114
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_224['parameters'] = univ.Null('')
|
|
115
|
+
|
|
116
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_256 = rfc5280.AlgorithmIdentifier()
|
|
117
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_256['algorithm'] = id_rsassa_pkcs1_v1_5_with_sha3_256
|
|
118
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_256['parameters'] = univ.Null('')
|
|
119
|
+
|
|
120
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_384 = rfc5280.AlgorithmIdentifier()
|
|
121
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_384['algorithm'] = id_rsassa_pkcs1_v1_5_with_sha3_384
|
|
122
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_384['parameters'] = univ.Null('')
|
|
123
|
+
|
|
124
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_512 = rfc5280.AlgorithmIdentifier()
|
|
125
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_512['algorithm'] = id_rsassa_pkcs1_v1_5_with_sha3_512
|
|
126
|
+
sa_rsassa_pkcs1_v1_5_with_sha3_512['parameters'] = univ.Null('')
|
|
127
|
+
|
|
128
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_224 = rfc5280.SubjectPublicKeyInfo()
|
|
129
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_224['algorithm'] = sa_rsassa_pkcs1_v1_5_with_sha3_224
|
|
130
|
+
# pk_rsassa_pkcs1_v1_5_with_sha3_224['subjectPublicKey'] is DER-encoded RSAPublicKey
|
|
131
|
+
|
|
132
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_256 = rfc5280.SubjectPublicKeyInfo()
|
|
133
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_256['algorithm'] = sa_rsassa_pkcs1_v1_5_with_sha3_256
|
|
134
|
+
# pk_rsassa_pkcs1_v1_5_with_sha3_256['subjectPublicKey'] is DER-encoded RSAPublicKey
|
|
135
|
+
|
|
136
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_384 = rfc5280.SubjectPublicKeyInfo()
|
|
137
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_384['algorithm'] = sa_rsassa_pkcs1_v1_5_with_sha3_384
|
|
138
|
+
# pk_rsassa_pkcs1_v1_5_with_sha3_384['subjectPublicKey'] is DER-encoded RSAPublicKey
|
|
139
|
+
|
|
140
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_512 = rfc5280.SubjectPublicKeyInfo()
|
|
141
|
+
pk_rsassa_pkcs1_v1_5_with_sha3_512['algorithm'] = sa_rsassa_pkcs1_v1_5_with_sha3_512
|
|
142
|
+
# pk_rsassa_pkcs1_v1_5_with_sha3_512['subjectPublicKey'] is DER-encoded RSAPublicKey
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# ECDSA with SHA3
|
|
146
|
+
|
|
147
|
+
id_ecdsa_with_sha3_224 = sigAlgs + (9, )
|
|
148
|
+
|
|
149
|
+
id_ecdsa_with_sha3_256 = sigAlgs + (10, )
|
|
150
|
+
|
|
151
|
+
id_ecdsa_with_sha3_384 = sigAlgs + (11, )
|
|
152
|
+
|
|
153
|
+
id_ecdsa_with_sha3_512 = sigAlgs + (12, )
|
|
154
|
+
|
|
155
|
+
sa_ecdsa_with_sha3_224 = rfc5280.AlgorithmIdentifier()
|
|
156
|
+
sa_ecdsa_with_sha3_224['algorithm'] = id_ecdsa_with_sha3_224
|
|
157
|
+
# sa_ecdsa_with_sha3_224['parameters'] is absent
|
|
158
|
+
|
|
159
|
+
sa_ecdsa_with_sha3_256 = rfc5280.AlgorithmIdentifier()
|
|
160
|
+
sa_ecdsa_with_sha3_256['algorithm'] = id_ecdsa_with_sha3_256
|
|
161
|
+
# sa_ecdsa_with_sha3_256['parameters'] is absent
|
|
162
|
+
|
|
163
|
+
sa_ecdsa_with_sha3_384 = rfc5280.AlgorithmIdentifier()
|
|
164
|
+
sa_ecdsa_with_sha3_384['algorithm'] = id_ecdsa_with_sha3_384
|
|
165
|
+
# sa_ecdsa_with_sha3_384['parameters'] is absent
|
|
166
|
+
|
|
167
|
+
sa_ecdsa_with_sha3_512 = rfc5280.AlgorithmIdentifier()
|
|
168
|
+
sa_ecdsa_with_sha3_512['algorithm'] = id_ecdsa_with_sha3_512
|
|
169
|
+
# sa_ecdsa_with_sha3_512['parameters'] is absent
|
|
170
|
+
|
|
171
|
+
pk_ecdsa_with_sha3_224 = rfc5280.SubjectPublicKeyInfo()
|
|
172
|
+
pk_ecdsa_with_sha3_224['algorithm'] = sa_ecdsa_with_sha3_224
|
|
173
|
+
# pk_ecdsa_with_sha3_224['subjectPublicKey'] is DER-encoded ECPoint
|
|
174
|
+
|
|
175
|
+
pk_ecdsa_with_sha3_256 = rfc5280.SubjectPublicKeyInfo()
|
|
176
|
+
pk_ecdsa_with_sha3_256['algorithm'] = sa_ecdsa_with_sha3_256
|
|
177
|
+
# pk_ecdsa_with_sha3_256['subjectPublicKey'] is DER-encoded ECPoint
|
|
178
|
+
|
|
179
|
+
pk_ecdsa_with_sha3_384 = rfc5280.SubjectPublicKeyInfo()
|
|
180
|
+
pk_ecdsa_with_sha3_384['algorithm'] = sa_ecdsa_with_sha3_384
|
|
181
|
+
# pk_ecdsa_with_sha3_384['subjectPublicKey'] is DER-encoded ECPoint
|
|
182
|
+
|
|
183
|
+
pk_ecdsa_with_sha3_512 = rfc5280.SubjectPublicKeyInfo()
|
|
184
|
+
pk_ecdsa_with_sha3_512['algorithm'] = sa_ecdsa_with_sha3_512
|
|
185
|
+
# pk_ecdsa_with_sha3_512['subjectPublicKey'] is DER-encoded ECPoint
|
|
186
|
+
|
|
187
|
+
class SignatureAlgorithm(AlgorithmIdentifier):
|
|
188
|
+
pass
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# HMAC with SHA3
|
|
192
|
+
|
|
193
|
+
id_hmacWithSHA3_224 = hashAlgs + (13, )
|
|
194
|
+
|
|
195
|
+
id_hmacWithSHA3_256 = hashAlgs + (14, )
|
|
196
|
+
|
|
197
|
+
id_hmacWithSHA3_384 = hashAlgs + (15, )
|
|
198
|
+
|
|
199
|
+
id_hmacWithSHA3_512 = hashAlgs + (16, )
|
|
200
|
+
|
|
201
|
+
maca_hmacWithSHA3_224 = rfc5280.AlgorithmIdentifier()
|
|
202
|
+
maca_hmacWithSHA3_224['algorithm'] = id_hmacWithSHA3_224
|
|
203
|
+
# maca_hmacWithSHA3_224['parameters'] are absent
|
|
204
|
+
|
|
205
|
+
maca_hmacWithSHA3_256 = rfc5280.AlgorithmIdentifier()
|
|
206
|
+
maca_hmacWithSHA3_256['algorithm'] = id_hmacWithSHA3_256
|
|
207
|
+
# maca_hmacWithSHA3_256['parameters'] are absent
|
|
208
|
+
|
|
209
|
+
maca_hmacWithSHA3_384 = rfc5280.AlgorithmIdentifier()
|
|
210
|
+
maca_hmacWithSHA3_384['algorithm'] = id_hmacWithSHA3_384
|
|
211
|
+
# maca_hmacWithSHA3_384['parameters'] are absent
|
|
212
|
+
|
|
213
|
+
maca_hmacWithSHA3_512 = rfc5280.AlgorithmIdentifier()
|
|
214
|
+
maca_hmacWithSHA3_512['algorithm'] = id_hmacWithSHA3_512
|
|
215
|
+
# maca_hmacWithSHA3_512['parameters'] are absent
|
|
216
|
+
|
|
217
|
+
class MACAlgorithm(AlgorithmIdentifier):
|
|
218
|
+
pass
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# HKDF with SHA3
|
|
222
|
+
|
|
223
|
+
id_alg_hkdf_with_sha3_224 = id_alg + (32, )
|
|
224
|
+
|
|
225
|
+
id_alg_hkdf_with_sha3_256 = id_alg + (33, )
|
|
226
|
+
|
|
227
|
+
id_alg_hkdf_with_sha3_384 = id_alg + (34, )
|
|
228
|
+
|
|
229
|
+
id_alg_hkdf_with_sha3_512 = id_alg + (35, )
|
|
230
|
+
|
|
231
|
+
kda_hkdf_with_sha3_224 = rfc5280.AlgorithmIdentifier()
|
|
232
|
+
kda_hkdf_with_sha3_224['algorithm'] = id_alg_hkdf_with_sha3_224
|
|
233
|
+
# kda_hkdf_with_sha3_224['parameters'] are absent
|
|
234
|
+
|
|
235
|
+
kda_hkdf_with_sha3_256 = rfc5280.AlgorithmIdentifier()
|
|
236
|
+
kda_hkdf_with_sha3_256['algorithm'] = id_alg_hkdf_with_sha3_256
|
|
237
|
+
# kda_hkdf_with_sha3_256['parameters'] are absent
|
|
238
|
+
|
|
239
|
+
kda_hkdf_with_sha3_384 = rfc5280.AlgorithmIdentifier()
|
|
240
|
+
kda_hkdf_with_sha3_384['algorithm'] = id_alg_hkdf_with_sha3_384
|
|
241
|
+
# kda_hkdf_with_sha3_384['parameters'] are absent
|
|
242
|
+
|
|
243
|
+
kda_hkdf_with_sha3_512 = rfc5280.AlgorithmIdentifier()
|
|
244
|
+
kda_hkdf_with_sha3_512['algorithm'] = id_alg_hkdf_with_sha3_512
|
|
245
|
+
# kda_hkdf_with_sha3_512['parameters'] are absent
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
# KDF using KMAC128 and KMAC512
|
|
249
|
+
|
|
250
|
+
id_kmac128 = hashAlgs + (21, )
|
|
251
|
+
|
|
252
|
+
id_kmac256 = hashAlgs + (22, )
|
|
253
|
+
|
|
254
|
+
class Customization(univ.OctetString):
|
|
255
|
+
pass
|
|
256
|
+
|
|
257
|
+
kda_kmac128 = rfc5280.AlgorithmIdentifier()
|
|
258
|
+
kda_kmac128['algorithm'] = id_kmac128
|
|
259
|
+
# kda_kmac128['parameters'] are absent when Customization is ''H
|
|
260
|
+
|
|
261
|
+
kda_kmac256 = rfc5280.AlgorithmIdentifier()
|
|
262
|
+
kda_kmac256['algorithm'] = id_kmac256
|
|
263
|
+
# kda_kmac256['parameters'] are absent when Customization is ''H
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
# KDF2 and KDF3 with SHA3
|
|
267
|
+
|
|
268
|
+
kda_kdf2 = rfc5280.AlgorithmIdentifier()
|
|
269
|
+
kda_kdf2['algorithm'] = id_kdf_kdf2
|
|
270
|
+
kda_kdf2['parameters'] = id_sha3_256
|
|
271
|
+
# kda_kdf2['parameters'] can be the OID for any hash function
|
|
272
|
+
|
|
273
|
+
kda_kdf3 = rfc5280.AlgorithmIdentifier()
|
|
274
|
+
kda_kdf3['algorithm'] = id_kdf_kdf3
|
|
275
|
+
kda_kdf3['parameters'] = id_sha3_256
|
|
276
|
+
# kda_kdf3['parameters'] can be the OID for any hash function
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# Update the algorithm identifiers map and the S/MIME capability map
|
|
280
|
+
#
|
|
281
|
+
# No need to add all of the OIDs to the algorithmIdentifierMap and the
|
|
282
|
+
# smimeCapabilityMap; do not add the ones where the parameters are
|
|
283
|
+
# always absent. Also, the KDF OIDs do not get added to the S/MIME
|
|
284
|
+
# capability map.
|
|
285
|
+
|
|
286
|
+
_mapUpdate = {
|
|
287
|
+
id_rsassa_pkcs1_v1_5_with_sha3_224: univ.Null(),
|
|
288
|
+
id_rsassa_pkcs1_v1_5_with_sha3_256: univ.Null(),
|
|
289
|
+
id_rsassa_pkcs1_v1_5_with_sha3_384: univ.Null(),
|
|
290
|
+
id_rsassa_pkcs1_v1_5_with_sha3_512: univ.Null(),
|
|
291
|
+
id_kmac128: Customization(),
|
|
292
|
+
id_kmac256: Customization(),
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
algorithmIdentifierMap.update(_mapUpdate)
|
|
296
|
+
|
|
297
|
+
smimeCapabilityMap.update(_mapUpdate)
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2025, Vigil Security, LLC
|
|
7
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
8
|
+
#
|
|
9
|
+
# KEM-RSA Algorithm with CMS KEMRecipientInfo
|
|
10
|
+
#
|
|
11
|
+
# ASN.1 source from:
|
|
12
|
+
# https://www.rfc-editor.org/rfc/rfc9690.txt
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
from pyasn1.type import univ
|
|
16
|
+
|
|
17
|
+
from pyasn1_alt_modules import rfc5280
|
|
18
|
+
from pyasn1_alt_modules import rfc4055
|
|
19
|
+
from pyasn1_alt_modules import rfc5990
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# Alias for Object Identifier
|
|
23
|
+
|
|
24
|
+
class OID(univ.ObjectIdentifier):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Imports from RFC 5280
|
|
29
|
+
|
|
30
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
31
|
+
|
|
32
|
+
SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Imports from RFC 4055
|
|
36
|
+
|
|
37
|
+
RSAPublicKey = rfc4055.RSAPublicKey
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Imports from RFC 5990
|
|
41
|
+
|
|
42
|
+
NullParms = rfc5990.NullParms
|
|
43
|
+
|
|
44
|
+
is18033_2 = rfc5990.is18033_2
|
|
45
|
+
|
|
46
|
+
nistAlgorithm = rfc5990.nistAlgorithm
|
|
47
|
+
|
|
48
|
+
pkcs_1 = rfc5990.pkcs_1
|
|
49
|
+
|
|
50
|
+
x9_44 = rfc5990.x9_44
|
|
51
|
+
|
|
52
|
+
x9_44_components = rfc5990.x9_44_components
|
|
53
|
+
|
|
54
|
+
Camellia_KeyWrappingScheme = rfc5990.Camellia_KeyWrappingScheme
|
|
55
|
+
|
|
56
|
+
DataEncapsulationMechanism = rfc5990.DataEncapsulationMechanism
|
|
57
|
+
|
|
58
|
+
KDF2_HashFunction = rfc5990.KDF2_HashFunction
|
|
59
|
+
|
|
60
|
+
KDF3_HashFunction = rfc5990.KDF3_HashFunction
|
|
61
|
+
|
|
62
|
+
KeyDerivationFunction = rfc5990.KeyDerivationFunction
|
|
63
|
+
|
|
64
|
+
KeyEncapsulationMechanism = rfc5990.KeyEncapsulationMechanism
|
|
65
|
+
|
|
66
|
+
X9_SymmetricKeyWrappingScheme = rfc5990.X9_SymmetricKeyWrappingScheme
|
|
67
|
+
|
|
68
|
+
id_rsa_kem = rfc5990.id_rsa_kem
|
|
69
|
+
|
|
70
|
+
id_rsa_kem_spki = rfc5990.id_rsa_kem
|
|
71
|
+
|
|
72
|
+
GenericHybridParameters = rfc5990.GenericHybridParameters
|
|
73
|
+
|
|
74
|
+
id_kem_rsa = rfc5990.id_kem_rsa
|
|
75
|
+
|
|
76
|
+
KeyLength = rfc5990.KeyLength
|
|
77
|
+
|
|
78
|
+
RsaKemParameters = rfc5990.RsaKemParameters
|
|
79
|
+
|
|
80
|
+
id_kdf_kdf2 = rfc5990.id_kdf_kdf2
|
|
81
|
+
|
|
82
|
+
id_kdf_kdf3 = rfc5990.id_kdf_kdf3
|
|
83
|
+
|
|
84
|
+
id_sha1 = rfc5990.id_sha1
|
|
85
|
+
|
|
86
|
+
id_sha224 = rfc5990.id_sha224
|
|
87
|
+
|
|
88
|
+
id_sha256 = rfc5990.id_sha256
|
|
89
|
+
|
|
90
|
+
id_sha384 = rfc5990.id_sha384
|
|
91
|
+
|
|
92
|
+
id_sha512 = rfc5990.id_sha512
|
|
93
|
+
|
|
94
|
+
id_aes128_wrap = rfc5990.id_aes128_Wrap
|
|
95
|
+
|
|
96
|
+
id_aes192_wrap = rfc5990.id_aes192_Wrap
|
|
97
|
+
|
|
98
|
+
id_aes256_wrap = rfc5990.id_aes256_Wrap
|
|
99
|
+
|
|
100
|
+
id_alg_CMS3DESwrap = rfc5990.id_alg_CMS3DESwrap
|
|
101
|
+
|
|
102
|
+
id_camellia128_wrap = rfc5990.id_camellia128_Wrap
|
|
103
|
+
|
|
104
|
+
id_camellia192_wrap = rfc5990.id_camellia192_Wrap
|
|
105
|
+
|
|
106
|
+
id_camellia256_wrap = rfc5990.id_camellia256_Wrap
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# KEM-RSA Key Encapsulation Mechanism Algorithms
|
|
110
|
+
|
|
111
|
+
kema_rsa_kem = AlgorithmIdentifier()
|
|
112
|
+
kema_rsa_kem['algorithm'] = id_rsa_kem_spki
|
|
113
|
+
kema_rsa_kem['parameters'] = GenericHybridParameters()
|
|
114
|
+
|
|
115
|
+
kema_kem_rsa = AlgorithmIdentifier()
|
|
116
|
+
kema_kem_rsa['algorithm'] = id_kem_rsa
|
|
117
|
+
kema_kem_rsa['parameters'] = RsaKemParameters()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# RSA Public Key for use only with the KEM-RSA Algorithm
|
|
121
|
+
|
|
122
|
+
pk_rsa_kem = SubjectPublicKeyInfo()
|
|
123
|
+
pk_rsa_kem['algorithm']['algorithm'] = id_rsa_kem_spki
|
|
124
|
+
# To limit the KDF or KWA choices, provide parameters:
|
|
125
|
+
# pk_rsa_kem['algorithm']['parameters'] = GenericHybridParameters()
|
|
126
|
+
# To provide the public key value:
|
|
127
|
+
# pubkey = RSAPublicKey()
|
|
128
|
+
# pubkey['modulus'] = n
|
|
129
|
+
# pubkey['publicExponent'] = e
|
|
130
|
+
# encodedpk = der.encoder.encode(pubkey)
|
|
131
|
+
# pk_rsa_kem['subjectPublicKey'] = univ.BitString.fromOctetString(encodedpk)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
# Key Derivation Functions
|
|
135
|
+
|
|
136
|
+
kda_kdf2 = AlgorithmIdentifier()
|
|
137
|
+
kda_kdf2['algorithm'] = id_kdf_kdf2
|
|
138
|
+
kda_kdf2['parameters'] = KDF2_HashFunction()
|
|
139
|
+
|
|
140
|
+
kda_kdf3 = AlgorithmIdentifier()
|
|
141
|
+
kda_kdf3['algorithm'] = id_kdf_kdf3
|
|
142
|
+
kda_kdf3['parameters'] = KDF3_HashFunction()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# Hash Functions
|
|
146
|
+
|
|
147
|
+
mda_sha1 = AlgorithmIdentifier()
|
|
148
|
+
mda_sha1['algorithm'] = id_sha1
|
|
149
|
+
mda_sha1['parameters'] = NullParms("")
|
|
150
|
+
|
|
151
|
+
mda_sha224 = AlgorithmIdentifier()
|
|
152
|
+
mda_sha224['algorithm'] = id_sha224
|
|
153
|
+
mda_sha224['parameters'] = NullParms("")
|
|
154
|
+
|
|
155
|
+
mda_sha256 = AlgorithmIdentifier()
|
|
156
|
+
mda_sha256['algorithm'] = id_sha256
|
|
157
|
+
mda_sha256['parameters'] = NullParms("")
|
|
158
|
+
|
|
159
|
+
mda_sha384 = AlgorithmIdentifier()
|
|
160
|
+
mda_sha384['algorithm'] = id_sha384
|
|
161
|
+
mda_sha384['parameters'] = NullParms("")
|
|
162
|
+
|
|
163
|
+
mda_sha512 = AlgorithmIdentifier()
|
|
164
|
+
mda_sha512['algorithm'] = id_sha512
|
|
165
|
+
mda_sha512['parameters'] = NullParms("")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# Key Wrap Algorithms
|
|
169
|
+
|
|
170
|
+
kwa_aes128_wrap = AlgorithmIdentifier()
|
|
171
|
+
kwa_aes128_wrap['algorithm'] = id_aes128_wrap
|
|
172
|
+
# kwa_aes128_wrap['parameters'] are absent
|
|
173
|
+
|
|
174
|
+
kwa_aes192_wrap = AlgorithmIdentifier()
|
|
175
|
+
kwa_aes192_wrap['algorithm'] = id_aes192_wrap
|
|
176
|
+
# kwa_aes192_wrap['parameters'] are absent
|
|
177
|
+
|
|
178
|
+
kwa_aes256_wrap = AlgorithmIdentifier()
|
|
179
|
+
kwa_aes256_wrap['algorithm'] = id_aes256_wrap
|
|
180
|
+
# kwa_aes256_wrap['parameters'] are absent
|
|
181
|
+
|
|
182
|
+
kwa_3DESWrap = AlgorithmIdentifier()
|
|
183
|
+
kwa_3DESWrap['algorithm'] = id_alg_CMS3DESwrap
|
|
184
|
+
kwa_3DESWrap['parameters'] = NullParms("")
|
|
185
|
+
|
|
186
|
+
kwa_camellia128_wrap = AlgorithmIdentifier()
|
|
187
|
+
kwa_camellia128_wrap['algorithm'] = id_camellia128_wrap
|
|
188
|
+
# kwa_camellia128_wrap['parameters'] are absent
|
|
189
|
+
|
|
190
|
+
kwa_camellia192_wrap = AlgorithmIdentifier()
|
|
191
|
+
kwa_camellia192_wrap['algorithm'] = id_camellia192_wrap
|
|
192
|
+
# kwa_camellia192_wrap['parameters'] are absent
|
|
193
|
+
|
|
194
|
+
kwa_camellia256_wrap = AlgorithmIdentifier()
|
|
195
|
+
kwa_camellia256_wrap['algorithm'] = id_camellia256_wrap
|
|
196
|
+
# kwa_camellia256_wrap['parameters'] are absent
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# No need to update the Algorithm Identifier map or the
|
|
200
|
+
# S/MIME Capabilities map. Import of rfc5900 already did so.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1-alt-modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley with some assistance from asn1ate v.0.6.0.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2024-2025, Vigil Security, LLC
|
|
7
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
8
|
+
#
|
|
9
|
+
# RPKI Signed Trust Anchor List
|
|
10
|
+
#
|
|
11
|
+
# ASN.1 source from:
|
|
12
|
+
# https://www.rfc-editor.org/rfc/rfc9691.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 tag
|
|
19
|
+
from pyasn1.type import univ
|
|
20
|
+
|
|
21
|
+
from pyasn1_alt_modules import rfc5280
|
|
22
|
+
from pyasn1_alt_modules import opentypemap
|
|
23
|
+
|
|
24
|
+
cmsContentTypesMap = opentypemap.get('cmsContentTypesMap')
|
|
25
|
+
|
|
26
|
+
MAX = float('inf')
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Import from RFC 5280
|
|
30
|
+
|
|
31
|
+
SubjectPublicKeyInfo = rfc5280.SubjectPublicKeyInfo
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# Signed Trust Anchor List
|
|
35
|
+
|
|
36
|
+
class CertificateURI(char.IA5String):
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class TAKey(univ.Sequence):
|
|
41
|
+
componentType = namedtype.NamedTypes(
|
|
42
|
+
namedtype.NamedType('comments', univ.SequenceOf(
|
|
43
|
+
componentType=char.UTF8String()).subtype(
|
|
44
|
+
subtypeSpec=constraint.ValueSizeConstraint(0, MAX))),
|
|
45
|
+
namedtype.NamedType('certificateURIs', univ.SequenceOf(
|
|
46
|
+
componentType=CertificateURI()).subtype(
|
|
47
|
+
subtypeSpec=constraint.ValueSizeConstraint(1, MAX))),
|
|
48
|
+
namedtype.NamedType('subjectPublicKeyInfo', SubjectPublicKeyInfo())
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class TAK(univ.Sequence):
|
|
53
|
+
componentType = namedtype.NamedTypes(
|
|
54
|
+
namedtype.DefaultedNamedType('version',
|
|
55
|
+
univ.Integer().subtype(value=0)),
|
|
56
|
+
namedtype.NamedType('current', TAKey()),
|
|
57
|
+
namedtype.OptionalNamedType('predecessor',
|
|
58
|
+
TAKey().subtype(explicitTag=tag.Tag(
|
|
59
|
+
tag.tagClassContext, tag.tagFormatConstructed, 0))),
|
|
60
|
+
namedtype.OptionalNamedType('successor',
|
|
61
|
+
TAKey().subtype(explicitTag=tag.Tag(
|
|
62
|
+
tag.tagClassContext, tag.tagFormatConstructed, 1)))
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
id_ct_signedTAL = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 1, 50))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Update the CMS Content Type Map
|
|
70
|
+
|
|
71
|
+
_cmsContentTypesMapUpdate = {
|
|
72
|
+
id_ct_signedTAL: TAK(),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
cmsContentTypesMap.update(_cmsContentTypesMapUpdate)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# This file is part of pyasn1-alt-modules software.
|
|
2
|
+
#
|
|
3
|
+
# Created by Russ Housley
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2024-2025, Vigil Security, LLC
|
|
6
|
+
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
|
|
7
|
+
#
|
|
8
|
+
# HSS/LMS Hash-based Signature Algorithm for CMS
|
|
9
|
+
#
|
|
10
|
+
# ASN.1 source from:
|
|
11
|
+
# https://www.rfc-editor.org/rfc/rfcXXXX.txt
|
|
12
|
+
|
|
13
|
+
from pyasn1_alt_modules import rfc8708
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Object Identifiers
|
|
17
|
+
|
|
18
|
+
id_alg_hss_lms_hashsig = rfc8708.id_alg_hss_lms_hashsig
|
|
19
|
+
|
|
20
|
+
id_alg_mts_hashsig = id_alg_hss_lms_hashsig
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Signature Algorithm Identifier
|
|
24
|
+
|
|
25
|
+
sa_HSS_LMS_HashSig = rfc8708.sa_HSS_LMS_HashSig
|
|
26
|
+
# sa_HSS_LMS_HashSig['parameters'] is alway absent
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Public Key
|
|
30
|
+
|
|
31
|
+
HSS_LMS_HashSig_PublicKey = rfc8708.HSS_LMS_HashSig_PublicKey
|
|
32
|
+
|
|
33
|
+
pk_HSS_LMS_HashSig = rfc8708.pk_HSS_LMS_HashSig
|
|
34
|
+
# pk_HSS_LMS_HashSig['subjectPublicKey'] CONTAINS the
|
|
35
|
+
# HSS/LMS public key without any ASN.1 encoding
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pyasn1_alt_modules software.
|
|
3
|
+
#
|
|
4
|
+
# Created by Russ Housley.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2025, Vigil Security, LLC
|
|
7
|
+
# License: http://vigilsec.com/pyasn1_alt_modules_license.txt
|
|
8
|
+
#
|
|
9
|
+
# Encryption Key Derivation in the CMS using HKDF with SHA-256
|
|
10
|
+
#
|
|
11
|
+
# ASN.1 source from:
|
|
12
|
+
# https://www.rfc_editor.org/rfc/rfc9709.txt
|
|
13
|
+
# Current version is based on draft-ietf-lamps-cms-cek-hkdf-sha256-01
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
from pyasn1.type import univ
|
|
17
|
+
|
|
18
|
+
from pyasn1_alt_modules import rfc5280
|
|
19
|
+
from pyasn1_alt_modules import rfc5751
|
|
20
|
+
from pyasn1_alt_modules import opentypemap
|
|
21
|
+
|
|
22
|
+
algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Import from RFC 5280
|
|
26
|
+
|
|
27
|
+
AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Import from RFC 5751
|
|
31
|
+
|
|
32
|
+
SMIMECapability = rfc5751.SMIMECapability
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Algorithm Identifier for CEK_HKDF_SHA256
|
|
36
|
+
|
|
37
|
+
id_alg_cek_hkdf_sha256 = univ.ObjectIdentifier((1, 2, 840, 113549, 1, 9, 16, 3, 31))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ContentEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
cea_CEKHKDFSHA256 = ContentEncryptionAlgorithmIdentifier()
|
|
45
|
+
cea_CEKHKDFSHA256['algorithm'] = id_alg_cek_hkdf_sha256
|
|
46
|
+
cea_CEKHKDFSHA256['parameters'] = AlgorithmIdentifier()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# S/MIIME Capability for CEK_HKDF_SHA256
|
|
50
|
+
|
|
51
|
+
cap_CMSCEKHKDFSHA256 = SMIMECapability()
|
|
52
|
+
cap_CMSCEKHKDFSHA256['capabilityID'] = id_alg_cek_hkdf_sha256
|
|
53
|
+
# cap_CMSCEKHKDFSHA256['parameters'] is always absent
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Update the Algorithm Identifier map
|
|
57
|
+
|
|
58
|
+
_algorithmIdentifierMapUpdate = {
|
|
59
|
+
id_alg_cek_hkdf_sha256: AlgorithmIdentifier(),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Do not need to update the SMIMECapability Map because the parameters
|
|
66
|
+
# are always absent.
|