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,108 @@
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
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Using Pre-Shared Key (PSK) in the Cryptographic Message Syntax (CMS)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8696.txt
14
+ #
15
+
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_alt_modules import rfc5652
23
+ from pyasn1_alt_modules import opentypemap
24
+
25
+ otherRecipientInfoMap = opentypemap.get('otherRecipientInfoMap')
26
+
27
+ MAX = float('inf')
28
+
29
+
30
+ id_ori = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13')
31
+
32
+ id_ori_keyTransPSK = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13.1')
33
+
34
+ id_ori_keyAgreePSK = univ.ObjectIdentifier('1.2.840.113549.1.9.16.13.2')
35
+
36
+
37
+ class PreSharedKeyIdentifier(univ.OctetString):
38
+ pass
39
+
40
+
41
+ class KeyTransRecipientInfos(univ.SequenceOf):
42
+ componentType = rfc5652.KeyTransRecipientInfo()
43
+
44
+
45
+ class KeyTransPSKRecipientInfo(univ.Sequence):
46
+ componentType = namedtype.NamedTypes(
47
+ namedtype.NamedType('version',
48
+ rfc5652.CMSVersion()),
49
+ namedtype.NamedType('pskid',
50
+ PreSharedKeyIdentifier()),
51
+ namedtype.NamedType('kdfAlgorithm',
52
+ rfc5652.KeyDerivationAlgorithmIdentifier()),
53
+ namedtype.NamedType('keyEncryptionAlgorithm',
54
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
55
+ namedtype.NamedType('ktris',
56
+ KeyTransRecipientInfos()),
57
+ namedtype.NamedType('encryptedKey',
58
+ rfc5652.EncryptedKey())
59
+ )
60
+
61
+
62
+ class KeyAgreePSKRecipientInfo(univ.Sequence):
63
+ componentType = namedtype.NamedTypes(
64
+ namedtype.NamedType('version',
65
+ rfc5652.CMSVersion()),
66
+ namedtype.NamedType('pskid',
67
+ PreSharedKeyIdentifier()),
68
+ namedtype.NamedType('originator',
69
+ rfc5652.OriginatorIdentifierOrKey().subtype(explicitTag=tag.Tag(
70
+ tag.tagClassContext, tag.tagFormatConstructed, 0))),
71
+ namedtype.OptionalNamedType('ukm',
72
+ rfc5652.UserKeyingMaterial().subtype(explicitTag=tag.Tag(
73
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
74
+ namedtype.NamedType('kdfAlgorithm',
75
+ rfc5652.KeyDerivationAlgorithmIdentifier()),
76
+ namedtype.NamedType('keyEncryptionAlgorithm',
77
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
78
+ namedtype.NamedType('recipientEncryptedKeys',
79
+ rfc5652.RecipientEncryptedKeys())
80
+ )
81
+
82
+
83
+ class CMSORIforPSKOtherInfo(univ.Sequence):
84
+ componentType = namedtype.NamedTypes(
85
+ namedtype.NamedType('psk',
86
+ univ.OctetString()),
87
+ namedtype.NamedType('keyMgmtAlgType',
88
+ univ.Enumerated(namedValues=namedval.NamedValues(
89
+ ('keyTrans', 5), ('keyAgree', 10)))),
90
+ namedtype.NamedType('keyEncryptionAlgorithm',
91
+ rfc5652.KeyEncryptionAlgorithmIdentifier()),
92
+ namedtype.NamedType('pskLength',
93
+ univ.Integer().subtype(
94
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
95
+ namedtype.NamedType('kdkLength',
96
+ univ.Integer().subtype(
97
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX)))
98
+ )
99
+
100
+
101
+ # Update the CMS Other Recipient Info Map
102
+
103
+ _otherRecipientInfoMapUpdate = {
104
+ id_ori_keyTransPSK: KeyTransPSKRecipientInfo(),
105
+ id_ori_keyAgreePSK: KeyAgreePSKRecipientInfo(),
106
+ }
107
+
108
+ otherRecipientInfoMap.update(_otherRecipientInfoMapUpdate)
@@ -0,0 +1,109 @@
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 include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2020-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # SHAKE One-way Hash Functions for CMS
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8702.txt
14
+ #
15
+ from pyasn1.type import namedtype
16
+ from pyasn1.type import tag
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_alt_modules import rfc5280
20
+ from pyasn1_alt_modules import rfc8692
21
+ from pyasn1_alt_modules import opentypemap
22
+
23
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
24
+
25
+
26
+ # Imports fprm RFC 5280
27
+
28
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
29
+
30
+
31
+ # Imports from RFC 8692
32
+
33
+ id_shake128 = rfc8692.id_shake128
34
+
35
+ mda_shake128 = rfc8692.mda_shake128
36
+
37
+ id_shake256 = rfc8692.id_shake256
38
+
39
+ mda_shake256 = rfc8692.mda_shake256
40
+
41
+ id_RSASSA_PSS_SHAKE128 = rfc8692.id_RSASSA_PSS_SHAKE128
42
+
43
+ sa_rSASSA_PSS_SHAKE128 = rfc8692.sa_rSASSA_PSS_SHAKE128
44
+
45
+ pk_rsaSSA_PSS_SHAKE128 = rfc8692.pk_rsaSSA_PSS_SHAKE128
46
+
47
+ id_RSASSA_PSS_SHAKE256 = rfc8692.id_RSASSA_PSS_SHAKE256
48
+
49
+ sa_rSASSA_PSS_SHAKE256 = rfc8692.sa_rSASSA_PSS_SHAKE256
50
+
51
+ pk_rsaSSA_PSS_SHAKE256 = rfc8692.pk_rsaSSA_PSS_SHAKE256
52
+
53
+ id_ecdsa_with_shake128 = rfc8692.id_ecdsa_with_shake128
54
+
55
+ sa_ecdsa_with_shake128 = rfc8692.sa_ecdsa_with_shake128
56
+
57
+ id_ecdsa_with_shake256 = rfc8692.id_ecdsa_with_shake256
58
+
59
+ sa_ecdsa_with_shake256 = rfc8692.sa_ecdsa_with_shake256
60
+
61
+ pk_ec = rfc8692.pk_ec
62
+
63
+
64
+ # KMAC with SHAKE128
65
+
66
+ id_KMACWithSHAKE128 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.19')
67
+
68
+
69
+ class KMACwithSHAKE128_params(univ.Sequence):
70
+ componentType = namedtype.NamedTypes(
71
+ namedtype.DefaultedNamedType('kMACOutputLength',
72
+ univ.Integer().subtype(value=256)),
73
+ namedtype.DefaultedNamedType('customizationString',
74
+ univ.OctetString().subtype(value=''))
75
+ )
76
+
77
+
78
+ maca_KMACwithSHAKE128 = AlgorithmIdentifier()
79
+ maca_KMACwithSHAKE128['algorithm'] = id_KMACWithSHAKE128
80
+ maca_KMACwithSHAKE128['parameters'] = KMACwithSHAKE128_params()
81
+
82
+
83
+ # KMAC with SHAKE256
84
+
85
+ id_KMACWithSHAKE256 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.20')
86
+
87
+
88
+ class KMACwithSHAKE256_params(univ.Sequence):
89
+ componentType = namedtype.NamedTypes(
90
+ namedtype.DefaultedNamedType('kMACOutputLength',
91
+ univ.Integer().subtype(value=512)),
92
+ namedtype.DefaultedNamedType('customizationString',
93
+ univ.OctetString().subtype(value=''))
94
+ )
95
+
96
+
97
+ maca_KMACwithSHAKE256 = AlgorithmIdentifier()
98
+ maca_KMACwithSHAKE256['algorithm'] = id_KMACWithSHAKE256
99
+ maca_KMACwithSHAKE256['parameters'] = KMACwithSHAKE256_params()
100
+
101
+
102
+ # Update the Algorithm Identifiers Map
103
+
104
+ _algorithmIdentifierMapUpdate = {
105
+ id_KMACWithSHAKE128: KMACwithSHAKE128_params(),
106
+ id_KMACWithSHAKE256: KMACwithSHAKE256_params(),
107
+ }
108
+
109
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,43 @@
1
+ # This file is part of pyasn1-alt-modules software.
2
+ #
3
+ # Created by Russ Housley
4
+ #
5
+ # Copyright (c) 2020-2024, 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/rfc8708.txt
12
+ # https://www.rfc-editor.org/errata/eid7963
13
+
14
+
15
+ from pyasn1.type import univ
16
+
17
+ from pyasn1_alt_modules import rfc5280
18
+
19
+
20
+ # Object Identifiers
21
+
22
+ id_alg_hss_lms_hashsig = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.17')
23
+
24
+ id_alg_mts_hashsig = id_alg_hss_lms_hashsig
25
+
26
+
27
+ # Signature Algorithm Identifier
28
+
29
+ sa_HSS_LMS_HashSig = rfc5280.AlgorithmIdentifier()
30
+ sa_HSS_LMS_HashSig['algorithm'] = id_alg_hss_lms_hashsig
31
+ # sa_HSS_LMS_HashSig['parameters'] is alway absent
32
+
33
+
34
+ # Public Key
35
+
36
+ class HSS_LMS_HashSig_PublicKey(univ.OctetString):
37
+ pass
38
+
39
+
40
+ pk_HSS_LMS_HashSig = rfc5280.SubjectPublicKeyInfo()
41
+ pk_HSS_LMS_HashSig['algorithm'] = sa_HSS_LMS_HashSig
42
+ # pk_HSS_LMS_HashSig['subjectPublicKey'] CONTAINS the
43
+ # HSS/LMS public key without any ASN.1 encoding
@@ -0,0 +1,36 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2020-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # ACME TLS ALPN Challenge Certificate Extension
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8737.txt
14
+ #
15
+
16
+ from pyasn1.type import univ
17
+ from pyasn1.type import constraint
18
+
19
+ from pyasn1_alt_modules import opentypemap
20
+
21
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
22
+
23
+
24
+ id_pe_acmeIdentifier = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 1, 31))
25
+
26
+ class Authorization(univ.OctetString):
27
+ subtypeSpec = constraint.ValueSizeConstraint(32, 32)
28
+
29
+
30
+ # Update the Certificate Extensions Map
31
+
32
+ _certificateExtensionsMapUpdate = {
33
+ id_pe_acmeIdentifier: Authorization(),
34
+ }
35
+
36
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
@@ -0,0 +1,21 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2020-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # CBOR Content for CMS
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc8769.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+
17
+
18
+ id_ct_cbor = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.44')
19
+
20
+
21
+ id_ct_cborSequence = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.45')
@@ -0,0 +1,52 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2020-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # Simple Certificate Enrolment Protocol
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc8894.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+ from pyasn1.type import namedtype
17
+
18
+ from pyasn1_alt_modules import rfc5280
19
+
20
+
21
+ # Object Identifiers
22
+
23
+ id_VeriSign = univ.ObjectIdentifier((2, 16, 840, 1, 113733))
24
+
25
+ id_pki = id_VeriSign + (1, )
26
+
27
+ id_attributes = id_pki + (9, )
28
+
29
+ id_transactionID = id_attributes + (7, )
30
+
31
+ id_messageType = id_attributes + (2, )
32
+
33
+ id_pkiStatus = id_attributes + (3, )
34
+
35
+ id_failInfo = id_attributes + (4, )
36
+
37
+ id_senderNonce = id_attributes + (5, )
38
+
39
+ id_recipientNonce = id_attributes + (6, )
40
+
41
+ id_scep = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 24))
42
+
43
+ id_scep_failInfoText = id_scep + (1, )
44
+
45
+
46
+ # Structures
47
+
48
+ class IssuerAndSubject(univ.Sequence):
49
+ componentType = namedtype.NamedTypes(
50
+ namedtype.NamedType('issuer', rfc5280.Name()),
51
+ namedtype.NamedType('subject', rfc5280.Name())
52
+ )
@@ -0,0 +1,42 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2020-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # Enrollment over Secure Transport (EST) Clarifications
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc8951.txt
13
+ #
14
+
15
+ from pyasn1_alt_modules import rfc5652
16
+ from pyasn1_alt_modules import rfc7030
17
+
18
+
19
+ # Imports from RFC 5652
20
+
21
+ Attribute = rfc5652.Attribute
22
+
23
+
24
+ # Imports from RFC 7030
25
+
26
+ id_aa_asymmDecryptKeyID = rfc7030.id_aa_asymmDecryptKeyID
27
+
28
+ AsymmetricDecryptKeyIdentifier = rfc7030.AsymmetricDecryptKeyIdentifier
29
+
30
+ AttrOrOID = rfc7030.AttrOrOID
31
+
32
+ CsrAttrs = rfc7030.CsrAttrs
33
+
34
+
35
+ # Asymmetric Decrypt Key Identifier Attribute
36
+
37
+ aa_asymmDecryptKeyID = Attribute()
38
+ aa_asymmDecryptKeyID['attrType'] = id_aa_asymmDecryptKeyID
39
+ aa_asymmDecryptKeyID['attrValues'][0] = AsymmetricDecryptKeyIdentifier()
40
+
41
+
42
+ # Note that the update CMS Attribute Map is handled by importing rfc7030
@@ -0,0 +1,238 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # Online Certificate Status Protocol (OCSP) with nonce size constraints
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc6960.txt
13
+ # https://www.rfc-editor.org/rfc/rfc8954.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 tag
20
+ from pyasn1.type import univ
21
+ from pyasn1.type import useful
22
+
23
+ from pyasn1_alt_modules import rfc2560
24
+ from pyasn1_alt_modules import rfc5280
25
+ from pyasn1_alt_modules import opentypemap
26
+
27
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
28
+
29
+ ocspResponseMap = opentypemap.get('ocspResponseMap')
30
+
31
+ MAX = float('inf')
32
+
33
+
34
+ # Imports from RFC 5280
35
+
36
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
37
+ AuthorityInfoAccessSyntax = rfc5280.AuthorityInfoAccessSyntax
38
+ Certificate = rfc5280.Certificate
39
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
40
+ CRLReason = rfc5280.CRLReason
41
+ Extensions = rfc5280.Extensions
42
+ GeneralName = rfc5280.GeneralName
43
+ Name = rfc5280.Name
44
+
45
+ id_kp = rfc5280.id_kp
46
+
47
+ id_ad_ocsp = rfc5280.id_ad_ocsp
48
+
49
+
50
+ # Imports from the original OCSP module in RFC 2560
51
+
52
+ AcceptableResponses = rfc2560.AcceptableResponses
53
+ ArchiveCutoff = rfc2560.ArchiveCutoff
54
+ CertStatus = rfc2560.CertStatus
55
+ KeyHash = rfc2560.KeyHash
56
+ OCSPResponse = rfc2560.OCSPResponse
57
+ OCSPResponseStatus = rfc2560.OCSPResponseStatus
58
+ ResponseBytes = rfc2560.ResponseBytes
59
+ RevokedInfo = rfc2560.RevokedInfo
60
+ UnknownInfo = rfc2560.UnknownInfo
61
+ Version = rfc2560.Version
62
+
63
+ id_kp_OCSPSigning = rfc2560.id_kp_OCSPSigning
64
+
65
+ id_pkix_ocsp = rfc2560.id_pkix_ocsp
66
+ id_pkix_ocsp_archive_cutoff = rfc2560.id_pkix_ocsp_archive_cutoff
67
+ id_pkix_ocsp_basic = rfc2560.id_pkix_ocsp_basic
68
+ id_pkix_ocsp_crl = rfc2560.id_pkix_ocsp_crl
69
+ id_pkix_ocsp_nocheck = rfc2560.id_pkix_ocsp_nocheck
70
+ id_pkix_ocsp_nonce = rfc2560.id_pkix_ocsp_nonce
71
+ id_pkix_ocsp_response = rfc2560.id_pkix_ocsp_response
72
+ id_pkix_ocsp_service_locator = rfc2560.id_pkix_ocsp_service_locator
73
+
74
+
75
+ # Additional object identifiers
76
+
77
+ id_pkix_ocsp_pref_sig_algs = id_pkix_ocsp + (8, )
78
+ id_pkix_ocsp_extended_revoke = id_pkix_ocsp + (9, )
79
+
80
+
81
+ # Updated structures (mostly to improve openTypes support)
82
+
83
+ class CertID(univ.Sequence):
84
+ componentType = namedtype.NamedTypes(
85
+ namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
86
+ namedtype.NamedType('issuerNameHash', univ.OctetString()),
87
+ namedtype.NamedType('issuerKeyHash', univ.OctetString()),
88
+ namedtype.NamedType('serialNumber', CertificateSerialNumber())
89
+ )
90
+
91
+
92
+ class SingleResponse(univ.Sequence):
93
+ componentType = namedtype.NamedTypes(
94
+ namedtype.NamedType('certID', CertID()),
95
+ namedtype.NamedType('certStatus', CertStatus()),
96
+ namedtype.NamedType('thisUpdate', useful.GeneralizedTime()),
97
+ namedtype.OptionalNamedType('nextUpdate', useful.GeneralizedTime().subtype(
98
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
99
+ namedtype.OptionalNamedType('singleExtensions', Extensions().subtype(
100
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
101
+ )
102
+
103
+
104
+ class ResponderID(univ.Choice):
105
+ componentType = namedtype.NamedTypes(
106
+ namedtype.NamedType('byName', Name().subtype(
107
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
108
+ namedtype.NamedType('byKey', KeyHash().subtype(
109
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
110
+ )
111
+
112
+
113
+ class ResponseData(univ.Sequence):
114
+ componentType = namedtype.NamedTypes(
115
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
116
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
117
+ namedtype.NamedType('responderID', ResponderID()),
118
+ namedtype.NamedType('producedAt', useful.GeneralizedTime()),
119
+ namedtype.NamedType('responses', univ.SequenceOf(
120
+ componentType=SingleResponse())),
121
+ namedtype.OptionalNamedType('responseExtensions', Extensions().subtype(
122
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
123
+ )
124
+
125
+
126
+ class BasicOCSPResponse(univ.Sequence):
127
+ componentType = namedtype.NamedTypes(
128
+ namedtype.NamedType('tbsResponseData', ResponseData()),
129
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
130
+ namedtype.NamedType('signature', univ.BitString()),
131
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(
132
+ componentType=Certificate()).subtype(explicitTag=tag.Tag(
133
+ tag.tagClassContext, tag.tagFormatSimple, 0)))
134
+ )
135
+
136
+
137
+ class Request(univ.Sequence):
138
+ componentType = namedtype.NamedTypes(
139
+ namedtype.NamedType('reqCert', CertID()),
140
+ namedtype.OptionalNamedType('singleRequestExtensions', Extensions().subtype(
141
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
142
+ )
143
+
144
+
145
+ class Signature(univ.Sequence):
146
+ componentType = namedtype.NamedTypes(
147
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
148
+ namedtype.NamedType('signature', univ.BitString()),
149
+ namedtype.OptionalNamedType('certs', univ.SequenceOf(
150
+ componentType=Certificate()).subtype(explicitTag=tag.Tag(
151
+ tag.tagClassContext, tag.tagFormatSimple, 0)))
152
+ )
153
+
154
+
155
+ class TBSRequest(univ.Sequence):
156
+ componentType = namedtype.NamedTypes(
157
+ namedtype.DefaultedNamedType('version', Version('v1').subtype(
158
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
159
+ namedtype.OptionalNamedType('requestorName', GeneralName().subtype(
160
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
161
+ namedtype.NamedType('requestList', univ.SequenceOf(
162
+ componentType=Request())),
163
+ namedtype.OptionalNamedType('requestExtensions', Extensions().subtype(
164
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
165
+ )
166
+
167
+
168
+ class OCSPRequest(univ.Sequence):
169
+ componentType = namedtype.NamedTypes(
170
+ namedtype.NamedType('tbsRequest', TBSRequest()),
171
+ namedtype.OptionalNamedType('optionalSignature', Signature().subtype(
172
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
173
+ )
174
+
175
+
176
+ # Previously omitted structure
177
+
178
+ class ServiceLocator(univ.Sequence):
179
+ componentType = namedtype.NamedTypes(
180
+ namedtype.NamedType('issuer', Name()),
181
+ namedtype.NamedType('locator', AuthorityInfoAccessSyntax())
182
+ )
183
+
184
+
185
+ # Additional structures
186
+
187
+ class CrlID(univ.Sequence):
188
+ componentType = namedtype.NamedTypes(
189
+ namedtype.OptionalNamedType('crlUrl', char.IA5String().subtype(
190
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
191
+ namedtype.OptionalNamedType('crlNum', univ.Integer().subtype(
192
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
193
+ namedtype.OptionalNamedType('crlTime', useful.GeneralizedTime().subtype(
194
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
195
+ )
196
+
197
+
198
+ class PreferredSignatureAlgorithm(univ.Sequence):
199
+ componentType = namedtype.NamedTypes(
200
+ namedtype.NamedType('sigIdentifier', AlgorithmIdentifier()),
201
+ namedtype.OptionalNamedType('certIdentifier', AlgorithmIdentifier())
202
+ )
203
+
204
+
205
+ class PreferredSignatureAlgorithms(univ.SequenceOf):
206
+ componentType = PreferredSignatureAlgorithm()
207
+
208
+
209
+ class Nonce(univ.OctetString):
210
+ subtypeSpec = constraint.ValueSizeConstraint(1, 32)
211
+
212
+
213
+ # Update the OCSP Response Map
214
+
215
+ _ocspResponseMapUpdate = {
216
+ id_pkix_ocsp_basic: BasicOCSPResponse(),
217
+ }
218
+
219
+ ocspResponseMap.update(_ocspResponseMapUpdate)
220
+
221
+
222
+ # Update the Certificate Extension Extensions Map
223
+
224
+ _certificateExtensionsMapUpdate = {
225
+ # Certificate Extension
226
+ id_pkix_ocsp_nocheck: univ.Null(""),
227
+ # OCSP Request Extensions
228
+ id_pkix_ocsp_nonce: Nonce(),
229
+ id_pkix_ocsp_response: AcceptableResponses(),
230
+ id_pkix_ocsp_service_locator: ServiceLocator(),
231
+ id_pkix_ocsp_pref_sig_algs: PreferredSignatureAlgorithms(),
232
+ # OCSP Response Extensions
233
+ id_pkix_ocsp_crl: CrlID(),
234
+ id_pkix_ocsp_archive_cutoff: ArchiveCutoff(),
235
+ id_pkix_ocsp_extended_revoke: univ.Null(""),
236
+ }
237
+
238
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
@@ -0,0 +1,52 @@
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
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2021-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Autonomic Control Plane (ACP) Node Name in X.509 Certificates
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8994.txt
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import constraint
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_alt_modules import rfc5280
21
+ from pyasn1_alt_modules import opentypemap
22
+
23
+ otherNamesMap = opentypemap.get('otherNamesMap')
24
+
25
+ MAX = float('inf')
26
+
27
+
28
+ # Autonomic Control Plane (ACP) Node Name
29
+
30
+ id_pkix = rfc5280.id_pkix
31
+
32
+ id_on = id_pkix + (8, )
33
+
34
+ id_on_AcpNodeName = id_on + (10, )
35
+
36
+
37
+ class AcpNodeName(char.IA5String):
38
+ subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
39
+
40
+
41
+ on_AcpNodeName = rfc5280.AnotherName()
42
+ on_AcpNodeName['type-id'] = id_on_AcpNodeName
43
+ on_AcpNodeName['value'] = AcpNodeName()
44
+
45
+
46
+ # Update the Other Names Map
47
+
48
+ _otherNamesMapUpdate = {
49
+ id_on_AcpNodeName: AcpNodeName(),
50
+ }
51
+
52
+ otherNamesMap.update(_otherNamesMapUpdate)