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,55 @@
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) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # The scrypt Password-Based Key Derivation Function
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8520.txt
14
+ # https://www.rfc-editor.org/errata/eid5871
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 opentypemap
22
+
23
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
24
+
25
+ MAX = float('inf')
26
+
27
+
28
+ # Algorithm identifier and parameters for the
29
+ # scrypt Password-Based Key Derivation Function
30
+
31
+ id_scrypt = univ.ObjectIdentifier('1.3.6.1.4.1.11591.4.11')
32
+
33
+
34
+ class Scrypt_params(univ.Sequence):
35
+ componentType = namedtype.NamedTypes(
36
+ namedtype.NamedType('salt',
37
+ univ.OctetString()),
38
+ namedtype.NamedType('costParameter',
39
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
40
+ namedtype.NamedType('blockSize',
41
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
42
+ namedtype.NamedType('parallelizationParameter',
43
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
44
+ namedtype.OptionalNamedType('keyLength',
45
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX)))
46
+ )
47
+
48
+
49
+ # Update the Algorithm Identifier Map and the S/MIME Capability Map
50
+
51
+ _algorithmIdentifierMapUpdate = {
52
+ id_scrypt: Scrypt_params(),
53
+ }
54
+
55
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,159 @@
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) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # PKCS #1: RSA Cryptography Specifications Version 2.2
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8017.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 univ
20
+
21
+ from pyasn1_alt_modules import rfc2437
22
+ from pyasn1_alt_modules import rfc3447
23
+ from pyasn1_alt_modules import rfc4055
24
+ from pyasn1_alt_modules import rfc5280
25
+ from pyasn1_alt_modules import opentypemap
26
+
27
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
28
+
29
+ smimeCapabilityMap = opentypemap.get('smimeCapabilityMap')
30
+
31
+ MAX = float('inf')
32
+
33
+
34
+ # Import Algorithm Identifier from RFC 5280
35
+
36
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
37
+
38
+ class DigestAlgorithm(AlgorithmIdentifier):
39
+ pass
40
+
41
+ class HashAlgorithm(AlgorithmIdentifier):
42
+ pass
43
+
44
+ class MaskGenAlgorithm(AlgorithmIdentifier):
45
+ pass
46
+
47
+ class PSourceAlgorithm(AlgorithmIdentifier):
48
+ pass
49
+
50
+
51
+ # Object identifiers from NIST SHA2
52
+
53
+ hashAlgs = univ.ObjectIdentifier('2.16.840.1.101.3.4.2')
54
+ id_sha256 = rfc4055.id_sha256
55
+ id_sha384 = rfc4055.id_sha384
56
+ id_sha512 = rfc4055.id_sha512
57
+ id_sha224 = rfc4055.id_sha224
58
+ id_sha512_224 = hashAlgs + (5, )
59
+ id_sha512_256 = hashAlgs + (6, )
60
+
61
+
62
+ # Basic object identifiers
63
+
64
+ pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
65
+ rsaEncryption = rfc2437.rsaEncryption
66
+ id_RSAES_OAEP = rfc2437.id_RSAES_OAEP
67
+ id_pSpecified = rfc2437.id_pSpecified
68
+ id_RSASSA_PSS = rfc4055.id_RSASSA_PSS
69
+ md2WithRSAEncryption = rfc2437.md2WithRSAEncryption
70
+ md5WithRSAEncryption = rfc2437.md5WithRSAEncryption
71
+ sha1WithRSAEncryption = rfc2437.sha1WithRSAEncryption
72
+ sha224WithRSAEncryption = rfc4055.sha224WithRSAEncryption
73
+ sha256WithRSAEncryption = rfc4055.sha256WithRSAEncryption
74
+ sha384WithRSAEncryption = rfc4055.sha384WithRSAEncryption
75
+ sha512WithRSAEncryption = rfc4055.sha512WithRSAEncryption
76
+ sha512_224WithRSAEncryption = pkcs_1 + (15, )
77
+ sha512_256WithRSAEncryption = pkcs_1 + (16, )
78
+ id_sha1 = rfc2437.id_sha1
79
+ id_md2 = univ.ObjectIdentifier('1.2.840.113549.2.2')
80
+ id_md5 = univ.ObjectIdentifier('1.2.840.113549.2.5')
81
+ id_mgf1 = rfc2437.id_mgf1
82
+
83
+
84
+ # Default parameter values
85
+
86
+ sha1 = rfc4055.sha1Identifier
87
+ SHA1Parameters = univ.Null("")
88
+
89
+ mgf1SHA1 = rfc4055.mgf1SHA1Identifier
90
+
91
+ class EncodingParameters(univ.OctetString):
92
+ subtypeSpec = constraint.ValueSizeConstraint(0, MAX)
93
+
94
+ pSpecifiedEmpty = rfc4055.pSpecifiedEmptyIdentifier
95
+
96
+ emptyString = EncodingParameters(value='')
97
+
98
+
99
+ # Main structures
100
+
101
+ class Version(univ.Integer):
102
+ namedValues = namedval.NamedValues(
103
+ ('two-prime', 0),
104
+ ('multi', 1)
105
+ )
106
+
107
+ class TrailerField(univ.Integer):
108
+ namedValues = namedval.NamedValues(
109
+ ('trailerFieldBC', 1)
110
+ )
111
+
112
+ RSAPublicKey = rfc2437.RSAPublicKey
113
+
114
+ OtherPrimeInfo = rfc3447.OtherPrimeInfo
115
+ OtherPrimeInfos = rfc3447.OtherPrimeInfos
116
+ RSAPrivateKey = rfc3447.RSAPrivateKey
117
+
118
+ RSAES_OAEP_params = rfc4055.RSAES_OAEP_params
119
+ rSAES_OAEP_Default_Identifier = rfc4055.rSAES_OAEP_Default_Identifier
120
+
121
+ RSASSA_PSS_params = rfc4055.RSASSA_PSS_params
122
+ rSASSA_PSS_Default_Identifier = rfc4055.rSASSA_PSS_Default_Identifier
123
+
124
+
125
+ # Syntax for the EMSA-PKCS1-v1_5 hash identifier
126
+
127
+ class DigestInfo(univ.Sequence):
128
+ componentType = namedtype.NamedTypes(
129
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithm()),
130
+ namedtype.NamedType('digest', univ.OctetString())
131
+ )
132
+
133
+
134
+ # Update the Algorithm Identifier Map and the S/MIME Capability Map
135
+
136
+ _algorithmIdentifierMapUpdate = {
137
+ id_sha1: univ.Null(),
138
+ id_sha224: univ.Null(),
139
+ id_sha256: univ.Null(),
140
+ id_sha384: univ.Null(),
141
+ id_sha512: univ.Null(),
142
+ id_sha512_224: univ.Null(),
143
+ id_sha512_256: univ.Null(),
144
+ id_mgf1: AlgorithmIdentifier(),
145
+ id_pSpecified: univ.OctetString(),
146
+ id_RSAES_OAEP: RSAES_OAEP_params(),
147
+ id_RSASSA_PSS: RSASSA_PSS_params(),
148
+ md2WithRSAEncryption: univ.Null(),
149
+ md5WithRSAEncryption: univ.Null(),
150
+ sha1WithRSAEncryption: univ.Null(),
151
+ sha224WithRSAEncryption: univ.Null(),
152
+ sha256WithRSAEncryption: univ.Null(),
153
+ sha384WithRSAEncryption: univ.Null(),
154
+ sha512WithRSAEncryption: univ.Null(),
155
+ sha512_224WithRSAEncryption: univ.Null(),
156
+ sha512_256WithRSAEncryption: univ.Null(),
157
+ }
158
+
159
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,269 @@
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 and
6
+ # update the S/MIME Capabilities map.
7
+ #
8
+ # Copyright (c) 2019-2024, Vigil Security, LLC
9
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
10
+ #
11
+ # PKCS #5: Password-Based Cryptography Specification, Version 2.1
12
+ #
13
+ # ASN.1 source from:
14
+ # https://www.rfc-editor.org/rfc/rfc8018.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 rfc3565
23
+ from pyasn1_alt_modules import rfc5280
24
+ from pyasn1_alt_modules import opentypemap
25
+
26
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
27
+
28
+ smimeCapabilityMap = opentypemap.get('smimeCapabilityMap')
29
+
30
+ MAX = float('inf')
31
+
32
+ def _OID(*components):
33
+ output = []
34
+ for x in tuple(components):
35
+ if isinstance(x, univ.ObjectIdentifier):
36
+ output.extend(list(x))
37
+ else:
38
+ output.append(int(x))
39
+
40
+ return univ.ObjectIdentifier(output)
41
+
42
+
43
+ # Import from RFC 3565
44
+
45
+ AES_IV = rfc3565.AES_IV
46
+
47
+
48
+ # Import from RFC 5280
49
+
50
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
51
+
52
+
53
+ # Basic object identifiers
54
+
55
+ nistAlgorithms = _OID(2, 16, 840, 1, 101, 3, 4)
56
+
57
+ aes = _OID(nistAlgorithms, 1)
58
+
59
+ oiw = _OID(1, 3, 14)
60
+
61
+ rsadsi = _OID(1, 2, 840, 113549)
62
+
63
+ pkcs = _OID(rsadsi, 1)
64
+
65
+ digestAlgorithm = _OID(rsadsi, 2)
66
+
67
+ encryptionAlgorithm = _OID(rsadsi, 3)
68
+
69
+ pkcs_5 = _OID(pkcs, 5)
70
+
71
+
72
+
73
+ # HMAC object identifiers
74
+
75
+ id_hmacWithSHA1 = _OID(digestAlgorithm, 7)
76
+
77
+ id_hmacWithSHA224 = _OID(digestAlgorithm, 8)
78
+
79
+ id_hmacWithSHA256 = _OID(digestAlgorithm, 9)
80
+
81
+ id_hmacWithSHA384 = _OID(digestAlgorithm, 10)
82
+
83
+ id_hmacWithSHA512 = _OID(digestAlgorithm, 11)
84
+
85
+ id_hmacWithSHA512_224 = _OID(digestAlgorithm, 12)
86
+
87
+ id_hmacWithSHA512_256 = _OID(digestAlgorithm, 13)
88
+
89
+
90
+ # PBES1 object identifiers
91
+
92
+ pbeWithMD2AndDES_CBC = _OID(pkcs_5, 1)
93
+
94
+ pbeWithMD2AndRC2_CBC = _OID(pkcs_5, 4)
95
+
96
+ pbeWithMD5AndDES_CBC = _OID(pkcs_5, 3)
97
+
98
+ pbeWithMD5AndRC2_CBC = _OID(pkcs_5, 6)
99
+
100
+ pbeWithSHA1AndDES_CBC = _OID(pkcs_5, 10)
101
+
102
+ pbeWithSHA1AndRC2_CBC = _OID(pkcs_5, 11)
103
+
104
+
105
+ # Supporting techniques object identifiers
106
+
107
+ desCBC = _OID(oiw, 3, 2, 7)
108
+
109
+ des_EDE3_CBC = _OID(encryptionAlgorithm, 7)
110
+
111
+ rc2CBC = _OID(encryptionAlgorithm, 2)
112
+
113
+ rc5_CBC_PAD = _OID(encryptionAlgorithm, 9)
114
+
115
+ aes128_CBC_PAD = _OID(aes, 2)
116
+
117
+ aes192_CBC_PAD = _OID(aes, 22)
118
+
119
+ aes256_CBC_PAD = _OID(aes, 42)
120
+
121
+
122
+ # PBES1
123
+
124
+ class PBEParameter(univ.Sequence):
125
+ pass
126
+
127
+ PBEParameter.componentType = namedtype.NamedTypes(
128
+ namedtype.NamedType('salt', univ.OctetString().subtype(
129
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8))),
130
+ namedtype.NamedType('iterationCount', univ.Integer())
131
+ )
132
+
133
+
134
+ # PBES2
135
+
136
+ id_PBES2 = _OID(pkcs_5, 13)
137
+
138
+
139
+ class PBES2_params(univ.Sequence):
140
+ pass
141
+
142
+ PBES2_params.componentType = namedtype.NamedTypes(
143
+ namedtype.NamedType('keyDerivationFunc', AlgorithmIdentifier()),
144
+ namedtype.NamedType('encryptionScheme', AlgorithmIdentifier())
145
+ )
146
+
147
+
148
+ # PBMAC1
149
+
150
+ id_PBMAC1 = _OID(pkcs_5, 14)
151
+
152
+
153
+ class PBMAC1_params(univ.Sequence):
154
+ pass
155
+
156
+ PBMAC1_params.componentType = namedtype.NamedTypes(
157
+ namedtype.NamedType('keyDerivationFunc', AlgorithmIdentifier()),
158
+ namedtype.NamedType('messageAuthScheme', AlgorithmIdentifier())
159
+ )
160
+
161
+
162
+ # PBKDF2
163
+
164
+ id_PBKDF2 = _OID(pkcs_5, 12)
165
+
166
+
167
+ algid_hmacWithSHA1 = AlgorithmIdentifier()
168
+ algid_hmacWithSHA1['algorithm'] = id_hmacWithSHA1
169
+ algid_hmacWithSHA1['parameters'] = univ.Null("")
170
+
171
+
172
+ class PBKDF2_params(univ.Sequence):
173
+ pass
174
+
175
+ PBKDF2_params.componentType = namedtype.NamedTypes(
176
+ namedtype.NamedType('salt', univ.Choice(componentType=namedtype.NamedTypes(
177
+ namedtype.NamedType('specified', univ.OctetString()),
178
+ namedtype.NamedType('otherSource', AlgorithmIdentifier())
179
+ ))),
180
+ namedtype.NamedType('iterationCount', univ.Integer().subtype(
181
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
182
+ namedtype.OptionalNamedType('keyLength', univ.Integer().subtype(
183
+ subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),
184
+ namedtype.DefaultedNamedType('prf', algid_hmacWithSHA1)
185
+ )
186
+
187
+
188
+ # RC2 CBC algorithm parameter
189
+
190
+ class RC2_CBC_Parameter(univ.Sequence):
191
+ pass
192
+
193
+ RC2_CBC_Parameter.componentType = namedtype.NamedTypes(
194
+ namedtype.OptionalNamedType('rc2ParameterVersion', univ.Integer()),
195
+ namedtype.NamedType('iv', univ.OctetString().subtype(
196
+ subtypeSpec=constraint.ValueSizeConstraint(8, 8)))
197
+ )
198
+
199
+
200
+ # RC5 CBC algorithm parameter
201
+
202
+ class RC5_CBC_Parameters(univ.Sequence):
203
+ pass
204
+
205
+ RC5_CBC_Parameters.componentType = namedtype.NamedTypes(
206
+ namedtype.NamedType('version',
207
+ univ.Integer(namedValues=namedval.NamedValues(('v1_0', 16))).subtype(
208
+ subtypeSpec=constraint.SingleValueConstraint(16))),
209
+ namedtype.NamedType('rounds',
210
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(8, 127))),
211
+ namedtype.NamedType('blockSizeInBits',
212
+ univ.Integer().subtype(subtypeSpec=constraint.SingleValueConstraint(64, 128))),
213
+ namedtype.OptionalNamedType('iv', univ.OctetString())
214
+ )
215
+
216
+
217
+ # Initialization Vector for AES: OCTET STRING (SIZE(16))
218
+
219
+ class AES_IV(univ.OctetString):
220
+ pass
221
+
222
+ AES_IV.subtypeSpec = constraint.ValueSizeConstraint(16, 16)
223
+
224
+
225
+ # Initialization Vector for DES: OCTET STRING (SIZE(8))
226
+
227
+ class DES_IV(univ.OctetString):
228
+ pass
229
+
230
+ DES_IV.subtypeSpec = constraint.ValueSizeConstraint(8, 8)
231
+
232
+
233
+ # Update the Algorithm Identifier map
234
+
235
+ _algorithmIdentifierMapUpdate = {
236
+ # PBKDF2-PRFs
237
+ id_hmacWithSHA1: univ.Null(),
238
+ id_hmacWithSHA224: univ.Null(),
239
+ id_hmacWithSHA256: univ.Null(),
240
+ id_hmacWithSHA384: univ.Null(),
241
+ id_hmacWithSHA512: univ.Null(),
242
+ id_hmacWithSHA512_224: univ.Null(),
243
+ id_hmacWithSHA512_256: univ.Null(),
244
+ # PBES1Algorithms
245
+ pbeWithMD2AndDES_CBC: PBEParameter(),
246
+ pbeWithMD2AndRC2_CBC: PBEParameter(),
247
+ pbeWithMD5AndDES_CBC: PBEParameter(),
248
+ pbeWithMD5AndRC2_CBC: PBEParameter(),
249
+ pbeWithSHA1AndDES_CBC: PBEParameter(),
250
+ pbeWithSHA1AndRC2_CBC: PBEParameter(),
251
+ # PBES2Algorithms
252
+ id_PBES2: PBES2_params(),
253
+ # PBES2-KDFs
254
+ id_PBKDF2: PBKDF2_params(),
255
+ # PBMAC1Algorithms
256
+ id_PBMAC1: PBMAC1_params(),
257
+ # SupportingAlgorithms
258
+ desCBC: DES_IV(),
259
+ des_EDE3_CBC: DES_IV(),
260
+ rc2CBC: RC2_CBC_Parameter(),
261
+ rc5_CBC_PAD: RC5_CBC_Parameters(),
262
+ aes128_CBC_PAD: AES_IV(),
263
+ aes192_CBC_PAD: AES_IV(),
264
+ aes256_CBC_PAD: AES_IV(),
265
+ }
266
+
267
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
268
+
269
+ smimeCapabilityMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,36 @@
1
+ # This file is part of pyasn1-alt-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from the asn1ate tool.
4
+ # Auto-generated by asn1ate v.0.6.0 from rfc8103.asn.
5
+ #
6
+ # Copyright (c) 2019-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # ChaCha20Poly1305 algorithm fo use with the Authenticated-Enveloped-Data
10
+ # protecting content type for the Cryptographic Message Syntax (CMS)
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc8103.txt
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import univ
17
+
18
+
19
+ def _OID(*components):
20
+ output = []
21
+ for x in tuple(components):
22
+ if isinstance(x, univ.ObjectIdentifier):
23
+ output.extend(list(x))
24
+ else:
25
+ output.append(int(x))
26
+
27
+ return univ.ObjectIdentifier(output)
28
+
29
+
30
+ class AEADChaCha20Poly1305Nonce(univ.OctetString):
31
+ pass
32
+
33
+
34
+ AEADChaCha20Poly1305Nonce.subtypeSpec = constraint.ValueSizeConstraint(12, 12)
35
+
36
+ id_alg_AEADChaCha20Poly1305 = _OID(1, 2, 840, 113549, 1, 9, 16, 3, 18)
@@ -0,0 +1,20 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # BGPsec Router PKI Profile
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc8209.txt
13
+ #
14
+
15
+ from pyasn1.type import univ
16
+
17
+
18
+ id_kp = univ.ObjectIdentifier('1.3.6.1.5.5.7.3')
19
+
20
+ id_kp_bgpsec_router = id_kp + (30, )
@@ -0,0 +1,151 @@
1
+ # This file is part of pyasn1-alt-modules software.
2
+ #
3
+ # Created by Russ Housley with assistance from the asn1ate tool, with manual
4
+ # changes to implement appropriate constraints and added comments.
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
+ # JWT Claim Constraints and TN Authorization List for certificate extensions.
12
+ #
13
+ # ASN.1 source from:
14
+ # https://www.rfc-editor.org/rfc/rfc8226.txt (with errata corrected)
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
+
22
+ from pyasn1_alt_modules import opentypemap
23
+
24
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
25
+
26
+ MAX = float('inf')
27
+
28
+
29
+ def _OID(*components):
30
+ output = []
31
+ for x in tuple(components):
32
+ if isinstance(x, univ.ObjectIdentifier):
33
+ output.extend(list(x))
34
+ else:
35
+ output.append(int(x))
36
+
37
+ return univ.ObjectIdentifier(output)
38
+
39
+
40
+ class JWTClaimName(char.IA5String):
41
+ pass
42
+
43
+
44
+ class JWTClaimNames(univ.SequenceOf):
45
+ pass
46
+
47
+ JWTClaimNames.componentType = JWTClaimName()
48
+ JWTClaimNames.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
49
+
50
+
51
+ class JWTClaimPermittedValues(univ.Sequence):
52
+ pass
53
+
54
+ JWTClaimPermittedValues.componentType = namedtype.NamedTypes(
55
+ namedtype.NamedType('claim', JWTClaimName()),
56
+ namedtype.NamedType('permitted', univ.SequenceOf(
57
+ componentType=char.UTF8String()).subtype(
58
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
59
+ )
60
+
61
+
62
+ class JWTClaimPermittedValuesList(univ.SequenceOf):
63
+ pass
64
+
65
+ JWTClaimPermittedValuesList.componentType = JWTClaimPermittedValues()
66
+ JWTClaimPermittedValuesList.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
67
+
68
+
69
+ class JWTClaimConstraints(univ.Sequence):
70
+ pass
71
+
72
+ JWTClaimConstraints.componentType = namedtype.NamedTypes(
73
+ namedtype.OptionalNamedType('mustInclude',
74
+ JWTClaimNames().subtype(explicitTag=tag.Tag(tag.tagClassContext,
75
+ tag.tagFormatSimple, 0))),
76
+ namedtype.OptionalNamedType('permittedValues',
77
+ JWTClaimPermittedValuesList().subtype(explicitTag=tag.Tag(tag.tagClassContext,
78
+ tag.tagFormatSimple, 1)))
79
+ )
80
+
81
+ JWTClaimConstraints.subtypeSpec = constraint.ConstraintsUnion(
82
+ constraint.WithComponentsConstraint(
83
+ ('mustInclude', constraint.ComponentPresentConstraint())),
84
+ constraint.WithComponentsConstraint(
85
+ ('permittedValues', constraint.ComponentPresentConstraint()))
86
+ )
87
+
88
+
89
+ id_pe_JWTClaimConstraints = _OID(1, 3, 6, 1, 5, 5, 7, 1, 27)
90
+
91
+
92
+ class ServiceProviderCode(char.IA5String):
93
+ pass
94
+
95
+
96
+ class TelephoneNumber(char.IA5String):
97
+ pass
98
+
99
+ TelephoneNumber.subtypeSpec = constraint.ConstraintsIntersection(
100
+ constraint.ValueSizeConstraint(1, 15),
101
+ constraint.PermittedAlphabetConstraint(
102
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '#', '*')
103
+ )
104
+
105
+
106
+ class TelephoneNumberRange(univ.Sequence):
107
+ pass
108
+
109
+ TelephoneNumberRange.componentType = namedtype.NamedTypes(
110
+ namedtype.NamedType('start', TelephoneNumber()),
111
+ namedtype.NamedType('count',
112
+ univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(2, MAX)))
113
+ )
114
+
115
+
116
+ class TNEntry(univ.Choice):
117
+ pass
118
+
119
+ TNEntry.componentType = namedtype.NamedTypes(
120
+ namedtype.NamedType('spc',
121
+ ServiceProviderCode().subtype(explicitTag=tag.Tag(tag.tagClassContext,
122
+ tag.tagFormatSimple, 0))),
123
+ namedtype.NamedType('range',
124
+ TelephoneNumberRange().subtype(explicitTag=tag.Tag(tag.tagClassContext,
125
+ tag.tagFormatConstructed, 1))),
126
+ namedtype.NamedType('one',
127
+ TelephoneNumber().subtype(explicitTag=tag.Tag(tag.tagClassContext,
128
+ tag.tagFormatSimple, 2)))
129
+ )
130
+
131
+
132
+ class TNAuthorizationList(univ.SequenceOf):
133
+ pass
134
+
135
+ TNAuthorizationList.componentType = TNEntry()
136
+ TNAuthorizationList.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
137
+
138
+ id_pe_TNAuthList = _OID(1, 3, 6, 1, 5, 5, 7, 1, 26)
139
+
140
+
141
+ id_ad_stirTNList = _OID(1, 3, 6, 1, 5, 5, 7, 48, 14)
142
+
143
+
144
+ # Update the Certificate Extension Map
145
+
146
+ _certificateExtensionsMapUpdate = {
147
+ id_pe_TNAuthList: TNAuthorizationList(),
148
+ id_pe_JWTClaimConstraints: JWTClaimConstraints(),
149
+ }
150
+
151
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)