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

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

Potentially problematic release.


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

Files changed (195) hide show
  1. pyasn1_alt_modules/__init__.py +2 -0
  2. pyasn1_alt_modules/opentypemap.py +19 -0
  3. pyasn1_alt_modules/pem.py +66 -0
  4. pyasn1_alt_modules/rfc1155.py +97 -0
  5. pyasn1_alt_modules/rfc1157.py +127 -0
  6. pyasn1_alt_modules/rfc1901.py +23 -0
  7. pyasn1_alt_modules/rfc1902.py +130 -0
  8. pyasn1_alt_modules/rfc1905.py +136 -0
  9. pyasn1_alt_modules/rfc2040.py +50 -0
  10. pyasn1_alt_modules/rfc2251.py +564 -0
  11. pyasn1_alt_modules/rfc2314.py +68 -0
  12. pyasn1_alt_modules/rfc2315.py +325 -0
  13. pyasn1_alt_modules/rfc2437.py +70 -0
  14. pyasn1_alt_modules/rfc2459.py +1340 -0
  15. pyasn1_alt_modules/rfc2511.py +303 -0
  16. pyasn1_alt_modules/rfc2528.py +34 -0
  17. pyasn1_alt_modules/rfc2560.py +226 -0
  18. pyasn1_alt_modules/rfc2631.py +37 -0
  19. pyasn1_alt_modules/rfc2634.py +342 -0
  20. pyasn1_alt_modules/rfc2743.py +60 -0
  21. pyasn1_alt_modules/rfc2876.py +61 -0
  22. pyasn1_alt_modules/rfc2898.py +72 -0
  23. pyasn1_alt_modules/rfc2985.py +593 -0
  24. pyasn1_alt_modules/rfc2986.py +76 -0
  25. pyasn1_alt_modules/rfc3058.py +48 -0
  26. pyasn1_alt_modules/rfc3114.py +80 -0
  27. pyasn1_alt_modules/rfc3125.py +469 -0
  28. pyasn1_alt_modules/rfc3161.py +142 -0
  29. pyasn1_alt_modules/rfc3217.py +42 -0
  30. pyasn1_alt_modules/rfc3274.py +62 -0
  31. pyasn1_alt_modules/rfc3279.py +264 -0
  32. pyasn1_alt_modules/rfc3280.py +1544 -0
  33. pyasn1_alt_modules/rfc3281.py +332 -0
  34. pyasn1_alt_modules/rfc3370.py +142 -0
  35. pyasn1_alt_modules/rfc3412.py +54 -0
  36. pyasn1_alt_modules/rfc3414.py +29 -0
  37. pyasn1_alt_modules/rfc3447.py +46 -0
  38. pyasn1_alt_modules/rfc3537.py +44 -0
  39. pyasn1_alt_modules/rfc3546.py +23 -0
  40. pyasn1_alt_modules/rfc3560.py +74 -0
  41. pyasn1_alt_modules/rfc3565.py +59 -0
  42. pyasn1_alt_modules/rfc3657.py +69 -0
  43. pyasn1_alt_modules/rfc3709.py +230 -0
  44. pyasn1_alt_modules/rfc3739.py +207 -0
  45. pyasn1_alt_modules/rfc3770.py +77 -0
  46. pyasn1_alt_modules/rfc3779.py +139 -0
  47. pyasn1_alt_modules/rfc3820.py +66 -0
  48. pyasn1_alt_modules/rfc3852.py +707 -0
  49. pyasn1_alt_modules/rfc3874.py +29 -0
  50. pyasn1_alt_modules/rfc4010.py +58 -0
  51. pyasn1_alt_modules/rfc4043.py +45 -0
  52. pyasn1_alt_modules/rfc4055.py +285 -0
  53. pyasn1_alt_modules/rfc4056.py +56 -0
  54. pyasn1_alt_modules/rfc4059.py +101 -0
  55. pyasn1_alt_modules/rfc4073.py +62 -0
  56. pyasn1_alt_modules/rfc4108.py +355 -0
  57. pyasn1_alt_modules/rfc4210.py +807 -0
  58. pyasn1_alt_modules/rfc4211.py +420 -0
  59. pyasn1_alt_modules/rfc4231.py +38 -0
  60. pyasn1_alt_modules/rfc4262.py +37 -0
  61. pyasn1_alt_modules/rfc4334.py +78 -0
  62. pyasn1_alt_modules/rfc4357.py +485 -0
  63. pyasn1_alt_modules/rfc4366.py +23 -0
  64. pyasn1_alt_modules/rfc4387.py +23 -0
  65. pyasn1_alt_modules/rfc4476.py +99 -0
  66. pyasn1_alt_modules/rfc4490.py +119 -0
  67. pyasn1_alt_modules/rfc4491.py +44 -0
  68. pyasn1_alt_modules/rfc4683.py +76 -0
  69. pyasn1_alt_modules/rfc4985.py +52 -0
  70. pyasn1_alt_modules/rfc4998.py +125 -0
  71. pyasn1_alt_modules/rfc5035.py +206 -0
  72. pyasn1_alt_modules/rfc5055.py +763 -0
  73. pyasn1_alt_modules/rfc5083.py +55 -0
  74. pyasn1_alt_modules/rfc5084.py +94 -0
  75. pyasn1_alt_modules/rfc5126.py +578 -0
  76. pyasn1_alt_modules/rfc5208.py +73 -0
  77. pyasn1_alt_modules/rfc5275.py +404 -0
  78. pyasn1_alt_modules/rfc5276.py +82 -0
  79. pyasn1_alt_modules/rfc5280.py +1666 -0
  80. pyasn1_alt_modules/rfc5480.py +190 -0
  81. pyasn1_alt_modules/rfc5544.py +127 -0
  82. pyasn1_alt_modules/rfc5636.py +117 -0
  83. pyasn1_alt_modules/rfc5639.py +49 -0
  84. pyasn1_alt_modules/rfc5649.py +33 -0
  85. pyasn1_alt_modules/rfc5652.py +763 -0
  86. pyasn1_alt_modules/rfc5697.py +64 -0
  87. pyasn1_alt_modules/rfc5698.py +159 -0
  88. pyasn1_alt_modules/rfc5751.py +127 -0
  89. pyasn1_alt_modules/rfc5752.py +52 -0
  90. pyasn1_alt_modules/rfc5753.py +163 -0
  91. pyasn1_alt_modules/rfc5755.py +400 -0
  92. pyasn1_alt_modules/rfc5913.py +46 -0
  93. pyasn1_alt_modules/rfc5914.py +119 -0
  94. pyasn1_alt_modules/rfc5915.py +32 -0
  95. pyasn1_alt_modules/rfc5916.py +39 -0
  96. pyasn1_alt_modules/rfc5917.py +59 -0
  97. pyasn1_alt_modules/rfc5924.py +19 -0
  98. pyasn1_alt_modules/rfc5934.py +786 -0
  99. pyasn1_alt_modules/rfc5940.py +62 -0
  100. pyasn1_alt_modules/rfc5958.py +100 -0
  101. pyasn1_alt_modules/rfc5990.py +238 -0
  102. pyasn1_alt_modules/rfc6010.py +92 -0
  103. pyasn1_alt_modules/rfc6019.py +46 -0
  104. pyasn1_alt_modules/rfc6031.py +469 -0
  105. pyasn1_alt_modules/rfc6032.py +71 -0
  106. pyasn1_alt_modules/rfc6066.py +25 -0
  107. pyasn1_alt_modules/rfc6120.py +46 -0
  108. pyasn1_alt_modules/rfc6170.py +17 -0
  109. pyasn1_alt_modules/rfc6187.py +22 -0
  110. pyasn1_alt_modules/rfc6210.py +45 -0
  111. pyasn1_alt_modules/rfc6211.py +75 -0
  112. pyasn1_alt_modules/rfc6402.py +643 -0
  113. pyasn1_alt_modules/rfc6482.py +77 -0
  114. pyasn1_alt_modules/rfc6484.py +17 -0
  115. pyasn1_alt_modules/rfc6486.py +70 -0
  116. pyasn1_alt_modules/rfc6487.py +22 -0
  117. pyasn1_alt_modules/rfc6492.py +41 -0
  118. pyasn1_alt_modules/rfc6493.py +24 -0
  119. pyasn1_alt_modules/rfc6494.py +23 -0
  120. pyasn1_alt_modules/rfc6664.py +151 -0
  121. pyasn1_alt_modules/rfc6955.py +112 -0
  122. pyasn1_alt_modules/rfc6960.py +234 -0
  123. pyasn1_alt_modules/rfc6962.py +52 -0
  124. pyasn1_alt_modules/rfc7030.py +70 -0
  125. pyasn1_alt_modules/rfc7191.py +267 -0
  126. pyasn1_alt_modules/rfc7229.py +29 -0
  127. pyasn1_alt_modules/rfc7292.py +359 -0
  128. pyasn1_alt_modules/rfc7296.py +32 -0
  129. pyasn1_alt_modules/rfc7508.py +92 -0
  130. pyasn1_alt_modules/rfc7585.py +53 -0
  131. pyasn1_alt_modules/rfc7633.py +40 -0
  132. pyasn1_alt_modules/rfc7693.py +66 -0
  133. pyasn1_alt_modules/rfc7773.py +54 -0
  134. pyasn1_alt_modules/rfc7836.py +65 -0
  135. pyasn1_alt_modules/rfc7894.py +100 -0
  136. pyasn1_alt_modules/rfc7906.py +739 -0
  137. pyasn1_alt_modules/rfc7914.py +55 -0
  138. pyasn1_alt_modules/rfc8017.py +159 -0
  139. pyasn1_alt_modules/rfc8018.py +269 -0
  140. pyasn1_alt_modules/rfc8103.py +36 -0
  141. pyasn1_alt_modules/rfc8209.py +20 -0
  142. pyasn1_alt_modules/rfc8226.py +151 -0
  143. pyasn1_alt_modules/rfc8358.py +54 -0
  144. pyasn1_alt_modules/rfc8360.py +46 -0
  145. pyasn1_alt_modules/rfc8398.py +55 -0
  146. pyasn1_alt_modules/rfc8410.py +43 -0
  147. pyasn1_alt_modules/rfc8418.py +36 -0
  148. pyasn1_alt_modules/rfc8419.py +70 -0
  149. pyasn1_alt_modules/rfc8479.py +48 -0
  150. pyasn1_alt_modules/rfc8494.py +80 -0
  151. pyasn1_alt_modules/rfc8520.py +66 -0
  152. pyasn1_alt_modules/rfc8619.py +45 -0
  153. pyasn1_alt_modules/rfc8649.py +42 -0
  154. pyasn1_alt_modules/rfc8692.py +79 -0
  155. pyasn1_alt_modules/rfc8696.py +108 -0
  156. pyasn1_alt_modules/rfc8702.py +109 -0
  157. pyasn1_alt_modules/rfc8708.py +43 -0
  158. pyasn1_alt_modules/rfc8737.py +36 -0
  159. pyasn1_alt_modules/rfc8769.py +21 -0
  160. pyasn1_alt_modules/rfc8894.py +52 -0
  161. pyasn1_alt_modules/rfc8951.py +42 -0
  162. pyasn1_alt_modules/rfc8954.py +238 -0
  163. pyasn1_alt_modules/rfc8994.py +52 -0
  164. pyasn1_alt_modules/rfc8995.py +39 -0
  165. pyasn1_alt_modules/rfc9044.py +80 -0
  166. pyasn1_alt_modules/rfc9092.py +35 -0
  167. pyasn1_alt_modules/rfc9118.py +82 -0
  168. pyasn1_alt_modules/rfc9174.py +55 -0
  169. pyasn1_alt_modules/rfc9189.py +74 -0
  170. pyasn1_alt_modules/rfc9215.py +228 -0
  171. pyasn1_alt_modules/rfc9286.py +78 -0
  172. pyasn1_alt_modules/rfc9289.py +22 -0
  173. pyasn1_alt_modules/rfc9310.py +46 -0
  174. pyasn1_alt_modules/rfc9323.py +129 -0
  175. pyasn1_alt_modules/rfc9336.py +20 -0
  176. pyasn1_alt_modules/rfc9337.py +74 -0
  177. pyasn1_alt_modules/rfc9345.py +36 -0
  178. pyasn1_alt_modules/rfc9385.py +22 -0
  179. pyasn1_alt_modules/rfc9399.py +59 -0
  180. pyasn1_alt_modules/rfc9480.py +731 -0
  181. pyasn1_alt_modules/rfc9481.py +224 -0
  182. pyasn1_alt_modules/rfc9509.py +24 -0
  183. pyasn1_alt_modules/rfc9548.py +23 -0
  184. pyasn1_alt_modules/rfc9579.py +89 -0
  185. pyasn1_alt_modules/rfc9582.py +107 -0
  186. pyasn1_alt_modules/rfc9598.py +52 -0
  187. pyasn1_alt_modules/rfc9608.py +35 -0
  188. pyasn1_alt_modules/rfc9629.py +100 -0
  189. pyasn1_alt_modules/rfc9654.py +241 -0
  190. pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
  191. pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
  192. pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
  193. pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
  194. pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
  195. pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
@@ -0,0 +1,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)