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,29 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2021-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # Identifiers for SHA-224
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc3874.txt
13
+ # https://www.rfc-editor.org/rfc/rfc5990.txt
14
+ #
15
+
16
+ from pyasn1_alt_modules import rfc5990
17
+
18
+
19
+ # Import from RFC 4055
20
+
21
+ id_sha224 = rfc5990.id_sha224
22
+
23
+
24
+ # The Algorithm Identifier map is updated by importing rfc5990.
25
+ # To save looking it up, the map is updated with this entry:
26
+ #
27
+ # _algorithmIdentifierMapUpdate = {
28
+ # id_sha224: univ.Null(),
29
+ # }
@@ -0,0 +1,58 @@
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
+ # SEED Encryption Algorithm in CMS
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4010.txt
13
+ #
14
+
15
+ from pyasn1.type import constraint
16
+ from pyasn1.type import univ
17
+
18
+ from pyasn1_alt_modules import rfc5280
19
+ from pyasn1_alt_modules import rfc5751
20
+
21
+
22
+ id_seedCBC = univ.ObjectIdentifier('1.2.410.200004.1.4')
23
+
24
+
25
+ id_npki_app_cmsSeed_wrap = univ.ObjectIdentifier('1.2.410.200004.7.1.1.1')
26
+
27
+
28
+ class SeedIV(univ.OctetString):
29
+ subtypeSpec = constraint.ValueSizeConstraint(16, 16)
30
+
31
+
32
+ class SeedCBCParameter(SeedIV):
33
+ pass
34
+
35
+
36
+ class SeedSMimeCapability(univ.Null):
37
+ pass
38
+
39
+
40
+ # Update the Algorithm Identifier map in rfc5280.py.
41
+
42
+ _algorithmIdentifierMapUpdate = {
43
+ id_seedCBC: SeedCBCParameter(),
44
+ id_npki_app_cmsSeed_wrap: univ.Null(""),
45
+ }
46
+
47
+ rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
48
+
49
+
50
+ # Update the SMIMECapabilities Attribute map in rfc5751.py
51
+
52
+ _smimeCapabilityMapUpdate = {
53
+ id_seedCBC: SeedSMimeCapability(),
54
+ id_npki_app_cmsSeed_wrap: SeedSMimeCapability(),
55
+
56
+ }
57
+
58
+ rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
@@ -0,0 +1,45 @@
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
+ # Internet X.509 Public Key Infrastructure Permanent Identifier
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4043.txt
14
+ #
15
+
16
+ from pyasn1.type import char
17
+ from pyasn1.type import namedtype
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_alt_modules import opentypemap
21
+
22
+ otherNamesMap = opentypemap.get('otherNamesMap')
23
+
24
+
25
+ id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
26
+
27
+ id_on = id_pkix + (8, )
28
+
29
+ id_on_permanentIdentifier = id_on + (3, )
30
+
31
+
32
+ class PermanentIdentifier(univ.Sequence):
33
+ componentType = namedtype.NamedTypes(
34
+ namedtype.OptionalNamedType('identifierValue', char.UTF8String()),
35
+ namedtype.OptionalNamedType('assigner', univ.ObjectIdentifier())
36
+ )
37
+
38
+
39
+ # Update the Other Names to Map
40
+
41
+ _otherNameMapUpdate = {
42
+ id_on_permanentIdentifier: PermanentIdentifier(),
43
+ }
44
+
45
+ otherNamesMap.update(_otherNameMapUpdate)
@@ -0,0 +1,285 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley with a very small amount of assistance from
5
+ # asn1ate v.0.6.0.
6
+ # Modified by Russ Housley to add maps for opentypes.
7
+ # Modified by Russ Housley to add PKCS#1 v1.5 algorithm identifiers, which
8
+ # are not in the ASN.1 module, but they are discussed in RFC 4055.
9
+ # Modified by Russ Housley to include the opentypemap manager.
10
+ #
11
+ # Copyright (c) 2019-2024, Vigil Security, LLC
12
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
13
+ #
14
+ # Additional Algorithms and Identifiers for RSA Cryptography
15
+ # for use in Certificates and CRLs
16
+ #
17
+ # ASN.1 source from:
18
+ # https://www.rfc-editor.org/rfc/rfc4055.txt
19
+ #
20
+ from pyasn1.type import namedtype
21
+ from pyasn1.type import tag
22
+ from pyasn1.type import univ
23
+
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
+ def _OID(*components):
32
+ output = []
33
+ for x in tuple(components):
34
+ if isinstance(x, univ.ObjectIdentifier):
35
+ output.extend(list(x))
36
+ else:
37
+ output.append(int(x))
38
+ return univ.ObjectIdentifier(output)
39
+
40
+
41
+ id_sha1 = _OID(1, 3, 14, 3, 2, 26)
42
+
43
+ id_sha256 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 1)
44
+
45
+ id_sha384 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 2)
46
+
47
+ id_sha512 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 3)
48
+
49
+ id_sha224 = _OID(2, 16, 840, 1, 101, 3, 4, 2, 4)
50
+
51
+ rsaEncryption = _OID(1, 2, 840, 113549, 1, 1, 1)
52
+
53
+ id_mgf1 = _OID(1, 2, 840, 113549, 1, 1, 8)
54
+
55
+ id_RSAES_OAEP = _OID(1, 2, 840, 113549, 1, 1, 7)
56
+
57
+ id_pSpecified = _OID(1, 2, 840, 113549, 1, 1, 9)
58
+
59
+ id_RSASSA_PSS = _OID(1, 2, 840, 113549, 1, 1, 10)
60
+
61
+ sha256WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 11)
62
+
63
+ sha384WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 12)
64
+
65
+ sha512WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 13)
66
+
67
+ sha224WithRSAEncryption = _OID(1, 2, 840, 113549, 1, 1, 14)
68
+
69
+ sha1Identifier = rfc5280.AlgorithmIdentifier()
70
+ sha1Identifier['algorithm'] = id_sha1
71
+ sha1Identifier['parameters'] = univ.Null("")
72
+
73
+ sha224Identifier = rfc5280.AlgorithmIdentifier()
74
+ sha224Identifier['algorithm'] = id_sha224
75
+ sha224Identifier['parameters'] = univ.Null("")
76
+
77
+ sha256Identifier = rfc5280.AlgorithmIdentifier()
78
+ sha256Identifier['algorithm'] = id_sha256
79
+ sha256Identifier['parameters'] = univ.Null("")
80
+
81
+ sha384Identifier = rfc5280.AlgorithmIdentifier()
82
+ sha384Identifier['algorithm'] = id_sha384
83
+ sha384Identifier['parameters'] = univ.Null("")
84
+
85
+ sha512Identifier = rfc5280.AlgorithmIdentifier()
86
+ sha512Identifier['algorithm'] = id_sha512
87
+ sha512Identifier['parameters'] = univ.Null("")
88
+
89
+ sha224WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
90
+ sha224WithRSAEncryptionIdentifier['algorithm'] = sha224WithRSAEncryption
91
+ sha224WithRSAEncryptionIdentifier['parameters'] = univ.Null("")
92
+
93
+ sha256WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
94
+ sha256WithRSAEncryptionIdentifier['algorithm'] = sha256WithRSAEncryption
95
+ sha256WithRSAEncryptionIdentifier['parameters'] = univ.Null("")
96
+
97
+ sha384WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
98
+ sha384WithRSAEncryptionIdentifier['algorithm'] = sha384WithRSAEncryption
99
+ sha384WithRSAEncryptionIdentifier['parameters'] = univ.Null("")
100
+
101
+ sha512WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
102
+ sha512WithRSAEncryptionIdentifier['algorithm'] = sha512WithRSAEncryption
103
+ sha512WithRSAEncryptionIdentifier['parameters'] = univ.Null("")
104
+
105
+ mgf1SHA1Identifier = rfc5280.AlgorithmIdentifier()
106
+ mgf1SHA1Identifier['algorithm'] = id_mgf1
107
+ mgf1SHA1Identifier['parameters'] = sha1Identifier
108
+
109
+ mgf1SHA224Identifier = rfc5280.AlgorithmIdentifier()
110
+ mgf1SHA224Identifier['algorithm'] = id_mgf1
111
+ mgf1SHA224Identifier['parameters'] = sha224Identifier
112
+
113
+ mgf1SHA256Identifier = rfc5280.AlgorithmIdentifier()
114
+ mgf1SHA256Identifier['algorithm'] = id_mgf1
115
+ mgf1SHA256Identifier['parameters'] = sha256Identifier
116
+
117
+ mgf1SHA384Identifier = rfc5280.AlgorithmIdentifier()
118
+ mgf1SHA384Identifier['algorithm'] = id_mgf1
119
+ mgf1SHA384Identifier['parameters'] = sha384Identifier
120
+
121
+ mgf1SHA512Identifier = rfc5280.AlgorithmIdentifier()
122
+ mgf1SHA512Identifier['algorithm'] = id_mgf1
123
+ mgf1SHA512Identifier['parameters'] = sha512Identifier
124
+
125
+ pSpecifiedEmptyIdentifier = rfc5280.AlgorithmIdentifier()
126
+ pSpecifiedEmptyIdentifier['algorithm'] = id_pSpecified
127
+ pSpecifiedEmptyIdentifier['parameters'] = univ.OctetString(value='')
128
+
129
+
130
+ class RSAPublicKey(univ.Sequence):
131
+ pass
132
+
133
+ RSAPublicKey.componentType = namedtype.NamedTypes(
134
+ namedtype.NamedType('modulus', univ.Integer()),
135
+ namedtype.NamedType('publicExponent', univ.Integer())
136
+ )
137
+
138
+
139
+ class HashAlgorithm(rfc5280.AlgorithmIdentifier):
140
+ pass
141
+
142
+
143
+ class MaskGenAlgorithm(rfc5280.AlgorithmIdentifier):
144
+ pass
145
+
146
+
147
+ class RSAES_OAEP_params(univ.Sequence):
148
+ pass
149
+
150
+ RSAES_OAEP_params.componentType = namedtype.NamedTypes(
151
+ namedtype.OptionalNamedType('hashFunc', rfc5280.AlgorithmIdentifier().subtype(
152
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
153
+ namedtype.OptionalNamedType('maskGenFunc', rfc5280.AlgorithmIdentifier().subtype(
154
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
155
+ namedtype.OptionalNamedType('pSourceFunc', rfc5280.AlgorithmIdentifier().subtype(
156
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
157
+ )
158
+
159
+ rSAES_OAEP_Default_Params = RSAES_OAEP_params()
160
+
161
+ rSAES_OAEP_Default_Identifier = rfc5280.AlgorithmIdentifier()
162
+ rSAES_OAEP_Default_Identifier['algorithm'] = id_RSAES_OAEP
163
+ rSAES_OAEP_Default_Identifier['parameters'] = rSAES_OAEP_Default_Params
164
+
165
+ rSAES_OAEP_SHA224_Params = RSAES_OAEP_params()
166
+ rSAES_OAEP_SHA224_Params['hashFunc'] = sha224Identifier.subtype(
167
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
168
+ rSAES_OAEP_SHA224_Params['maskGenFunc'] = mgf1SHA224Identifier.subtype(
169
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
170
+
171
+ rSAES_OAEP_SHA224_Identifier = rfc5280.AlgorithmIdentifier()
172
+ rSAES_OAEP_SHA224_Identifier['algorithm'] = id_RSAES_OAEP
173
+ rSAES_OAEP_SHA224_Identifier['parameters'] = rSAES_OAEP_SHA224_Params
174
+
175
+ rSAES_OAEP_SHA256_Params = RSAES_OAEP_params()
176
+ rSAES_OAEP_SHA256_Params['hashFunc'] = sha256Identifier.subtype(
177
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
178
+ rSAES_OAEP_SHA256_Params['maskGenFunc'] = mgf1SHA256Identifier.subtype(
179
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
180
+
181
+ rSAES_OAEP_SHA256_Identifier = rfc5280.AlgorithmIdentifier()
182
+ rSAES_OAEP_SHA256_Identifier['algorithm'] = id_RSAES_OAEP
183
+ rSAES_OAEP_SHA256_Identifier['parameters'] = rSAES_OAEP_SHA256_Params
184
+
185
+ rSAES_OAEP_SHA384_Params = RSAES_OAEP_params()
186
+ rSAES_OAEP_SHA384_Params['hashFunc'] = sha384Identifier.subtype(
187
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
188
+ rSAES_OAEP_SHA384_Params['maskGenFunc'] = mgf1SHA384Identifier.subtype(
189
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
190
+
191
+ rSAES_OAEP_SHA384_Identifier = rfc5280.AlgorithmIdentifier()
192
+ rSAES_OAEP_SHA384_Identifier['algorithm'] = id_RSAES_OAEP
193
+ rSAES_OAEP_SHA384_Identifier['parameters'] = rSAES_OAEP_SHA384_Params
194
+
195
+ rSAES_OAEP_SHA512_Params = RSAES_OAEP_params()
196
+ rSAES_OAEP_SHA512_Params['hashFunc'] = sha512Identifier.subtype(
197
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
198
+ rSAES_OAEP_SHA512_Params['maskGenFunc'] = mgf1SHA512Identifier.subtype(
199
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
200
+
201
+ rSAES_OAEP_SHA512_Identifier = rfc5280.AlgorithmIdentifier()
202
+ rSAES_OAEP_SHA512_Identifier['algorithm'] = id_RSAES_OAEP
203
+ rSAES_OAEP_SHA512_Identifier['parameters'] = rSAES_OAEP_SHA512_Params
204
+
205
+
206
+ class RSASSA_PSS_params(univ.Sequence):
207
+ pass
208
+
209
+ RSASSA_PSS_params.componentType = namedtype.NamedTypes(
210
+ namedtype.OptionalNamedType('hashAlgorithm', rfc5280.AlgorithmIdentifier().subtype(
211
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
212
+ namedtype.OptionalNamedType('maskGenAlgorithm', rfc5280.AlgorithmIdentifier().subtype(
213
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
214
+ namedtype.DefaultedNamedType('saltLength', univ.Integer(value=20).subtype(
215
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
216
+ namedtype.DefaultedNamedType('trailerField', univ.Integer(value=1).subtype(
217
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
218
+ )
219
+
220
+ rSASSA_PSS_Default_Params = RSASSA_PSS_params()
221
+
222
+ rSASSA_PSS_Default_Identifier = rfc5280.AlgorithmIdentifier()
223
+ rSASSA_PSS_Default_Identifier['algorithm'] = id_RSASSA_PSS
224
+ rSASSA_PSS_Default_Identifier['parameters'] = rSASSA_PSS_Default_Params
225
+
226
+ rSASSA_PSS_SHA224_Params = RSASSA_PSS_params()
227
+ rSASSA_PSS_SHA224_Params['hashAlgorithm'] = sha224Identifier.subtype(
228
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
229
+ rSASSA_PSS_SHA224_Params['maskGenAlgorithm'] = mgf1SHA224Identifier.subtype(
230
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
231
+
232
+ rSASSA_PSS_SHA224_Identifier = rfc5280.AlgorithmIdentifier()
233
+ rSASSA_PSS_SHA224_Identifier['algorithm'] = id_RSASSA_PSS
234
+ rSASSA_PSS_SHA224_Identifier['parameters'] = rSASSA_PSS_SHA224_Params
235
+
236
+ rSASSA_PSS_SHA256_Params = RSASSA_PSS_params()
237
+ rSASSA_PSS_SHA256_Params['hashAlgorithm'] = sha256Identifier.subtype(
238
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
239
+ rSASSA_PSS_SHA256_Params['maskGenAlgorithm'] = mgf1SHA256Identifier.subtype(
240
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
241
+
242
+ rSASSA_PSS_SHA256_Identifier = rfc5280.AlgorithmIdentifier()
243
+ rSASSA_PSS_SHA256_Identifier['algorithm'] = id_RSASSA_PSS
244
+ rSASSA_PSS_SHA256_Identifier['parameters'] = rSASSA_PSS_SHA256_Params
245
+
246
+ rSASSA_PSS_SHA384_Params = RSASSA_PSS_params()
247
+ rSASSA_PSS_SHA384_Params['hashAlgorithm'] = sha384Identifier.subtype(
248
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
249
+ rSASSA_PSS_SHA384_Params['maskGenAlgorithm'] = mgf1SHA384Identifier.subtype(
250
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
251
+
252
+ rSASSA_PSS_SHA384_Identifier = rfc5280.AlgorithmIdentifier()
253
+ rSASSA_PSS_SHA384_Identifier['algorithm'] = id_RSASSA_PSS
254
+ rSASSA_PSS_SHA384_Identifier['parameters'] = rSASSA_PSS_SHA384_Params
255
+
256
+ rSASSA_PSS_SHA512_Params = RSASSA_PSS_params()
257
+ rSASSA_PSS_SHA512_Params['hashAlgorithm'] = sha512Identifier.subtype(
258
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0), cloneValueFlag=True)
259
+ rSASSA_PSS_SHA512_Params['maskGenAlgorithm'] = mgf1SHA512Identifier.subtype(
260
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1), cloneValueFlag=True)
261
+
262
+ rSASSA_PSS_SHA512_Identifier = rfc5280.AlgorithmIdentifier()
263
+ rSASSA_PSS_SHA512_Identifier['algorithm'] = id_RSASSA_PSS
264
+ rSASSA_PSS_SHA512_Identifier['parameters'] = rSASSA_PSS_SHA512_Params
265
+
266
+
267
+ # Update the Algorithm Identifier Map
268
+
269
+ _algorithmIdentifierMapUpdate = {
270
+ id_sha1: univ.Null(),
271
+ id_sha224: univ.Null(),
272
+ id_sha256: univ.Null(),
273
+ id_sha384: univ.Null(),
274
+ id_sha512: univ.Null(),
275
+ sha224WithRSAEncryption: univ.Null(),
276
+ sha256WithRSAEncryption: univ.Null(),
277
+ sha384WithRSAEncryption: univ.Null(),
278
+ sha512WithRSAEncryption: univ.Null(),
279
+ id_mgf1: rfc5280.AlgorithmIdentifier(),
280
+ id_pSpecified: univ.OctetString(),
281
+ id_RSAES_OAEP: RSAES_OAEP_params(),
282
+ id_RSASSA_PSS: RSASSA_PSS_params(),
283
+ }
284
+
285
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,56 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2021-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # RSASSA-PSS Signature Algorithm in CMS
10
+ #
11
+ # ASN.1 source from:
12
+ # https://www.rfc-editor.org/rfc/rfc4056.txt
13
+ #
14
+
15
+ from pyasn1_alt_modules import rfc4055
16
+
17
+
18
+ # Imports from RFC 4055
19
+
20
+ rsaEncryption = rfc4055.rsaEncryption
21
+
22
+ id_RSASSA_PSS = rfc4055.id_RSASSA_PSS
23
+
24
+ RSAPublicKey = rfc4055.RSAPublicKey
25
+
26
+ RSASSA_PSS_params = rfc4055.RSASSA_PSS_params
27
+
28
+ rSASSA_PSS_Default_Params = rfc4055.rSASSA_PSS_Default_Params
29
+
30
+ rSASSA_PSS_Default_Identifier = rfc4055.rSASSA_PSS_Default_Identifier
31
+
32
+ rSASSA_PSS_SHA224_Params = rfc4055.rSASSA_PSS_SHA224_Params
33
+
34
+ rSASSA_PSS_SHA224_Identifier = rfc4055.rSASSA_PSS_SHA224_Identifier
35
+
36
+ rSASSA_PSS_SHA256_Params = rfc4055.rSASSA_PSS_SHA256_Params
37
+
38
+ rSASSA_PSS_SHA256_Identifier = rfc4055.rSASSA_PSS_SHA256_Identifier
39
+
40
+ rSASSA_PSS_SHA384_Params = rfc4055.rSASSA_PSS_SHA384_Params
41
+
42
+ rSASSA_PSS_SHA384_Identifier = rfc4055.rSASSA_PSS_SHA384_Identifier
43
+
44
+ rSASSA_PSS_SHA512_Params = rfc4055.rSASSA_PSS_SHA512_Params
45
+
46
+ rSASSA_PSS_SHA512_Identifier = rfc4055.rSASSA_PSS_SHA512_Identifier
47
+
48
+
49
+ # The Algorithm Identifiers Map is updated by importing rfc4055.
50
+ # As a reminder it includes:
51
+ #
52
+ # _algorithmIdentifierMapUpdate = {
53
+ # id_RSASSA_PSS: RSASSA_PSS_params(),
54
+ # }
55
+ #
56
+ # algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,101 @@
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) 2021-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Warranty Certificate Extension
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc4059.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 namedval
20
+ from pyasn1.type import useful
21
+ from pyasn1.type import univ
22
+
23
+ from pyasn1_alt_modules import opentypemap
24
+
25
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
26
+
27
+ MAX = float('inf')
28
+
29
+
30
+ class TermsAndConditionsURL(char.IA5String):
31
+ pass
32
+
33
+
34
+ class CurrencyAmount(univ.Sequence):
35
+ componentType = namedtype.NamedTypes(
36
+ namedtype.NamedType('currency', univ.Integer().subtype(
37
+ subtypeSpec=constraint.ValueRangeConstraint(1, 999))),
38
+ namedtype.NamedType('amount', univ.Integer().subtype(
39
+ subtypeSpec=constraint.ValueRangeConstraint(0, MAX))),
40
+ namedtype.NamedType('amtExp10', univ.Integer().subtype(
41
+ subtypeSpec=constraint.ValueRangeConstraint(0, MAX)))
42
+ )
43
+
44
+
45
+ class ValidityPeriod(univ.Sequence):
46
+ componentType = namedtype.NamedTypes(
47
+ namedtype.NamedType('notBefore', useful.GeneralizedTime()),
48
+ namedtype.NamedType('notAfter', useful.GeneralizedTime())
49
+ )
50
+
51
+
52
+ class WarrantyType(univ.Integer):
53
+ namedValues = namedval.NamedValues(
54
+ ('aggregated', 0),
55
+ ('perTransaction', 1)
56
+ )
57
+
58
+
59
+ class WarrantyValidityPeriod(univ.Choice):
60
+ componentType = namedtype.NamedTypes(
61
+ namedtype.NamedType('sameAsCertificate', univ.Null()),
62
+ namedtype.NamedType('explicitPeriod', ValidityPeriod())
63
+ )
64
+
65
+
66
+ class WarrantyInfo(univ.Sequence):
67
+ componentType = namedtype.NamedTypes(
68
+ namedtype.NamedType('validity', WarrantyValidityPeriod()),
69
+ namedtype.NamedType('amount', CurrencyAmount()),
70
+ namedtype.NamedType('wType', WarrantyType())
71
+ )
72
+
73
+
74
+ class WarrantyData(univ.Sequence):
75
+ componentType = namedtype.NamedTypes(
76
+ namedtype.NamedType('base', WarrantyInfo()),
77
+ namedtype.OptionalNamedType('extended', WarrantyInfo()),
78
+ namedtype.OptionalNamedType('tcURL', TermsAndConditionsURL())
79
+ )
80
+
81
+
82
+ class Warranty(univ.Choice):
83
+ componentType = namedtype.NamedTypes(
84
+ namedtype.NamedType('none', univ.Null()),
85
+ namedtype.NamedType('wData', WarrantyData())
86
+ )
87
+
88
+
89
+ id_pe = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, 1))
90
+
91
+
92
+ id_pe_warranty_extn = id_pe + (16,)
93
+
94
+
95
+ # Update the Certificate Extensions Map
96
+
97
+ _certificateExtensionsMap = {
98
+ id_pe_warranty_extn: Warranty(),
99
+ }
100
+
101
+ certificateExtensionsMap.update(_certificateExtensionsMap)
@@ -0,0 +1,62 @@
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 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
+ # Protecting Multiple Contents with the CMS
12
+ #
13
+ # ASN.1 source from:
14
+ # https://www.rfc-editor.org/rfc/rfc4073.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 rfc5652
22
+ from pyasn1_alt_modules import opentypemap
23
+
24
+ cmsContentTypesMap = opentypemap.get('cmsContentTypesMap')
25
+
26
+ MAX = float('inf')
27
+
28
+
29
+ # Content Collection Content Type and Object Identifier
30
+
31
+ id_ct_contentCollection = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.19')
32
+
33
+ class ContentCollection(univ.SequenceOf):
34
+ pass
35
+
36
+ ContentCollection.componentType = rfc5652.ContentInfo()
37
+ ContentCollection.sizeSpec = constraint.ValueSizeConstraint(1, MAX)
38
+
39
+
40
+ # Content With Attributes Content Type and Object Identifier
41
+
42
+ id_ct_contentWithAttrs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.20')
43
+
44
+ class ContentWithAttributes(univ.Sequence):
45
+ pass
46
+
47
+ ContentWithAttributes.componentType = namedtype.NamedTypes(
48
+ namedtype.NamedType('content', rfc5652.ContentInfo()),
49
+ namedtype.NamedType('attrs', univ.SequenceOf(
50
+ componentType=rfc5652.Attribute()).subtype(
51
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
52
+ )
53
+
54
+
55
+ # Update the CMS Content Types Map
56
+
57
+ _cmsContentTypesMapUpdate = {
58
+ id_ct_contentCollection: ContentCollection(),
59
+ id_ct_contentWithAttrs: ContentWithAttributes(),
60
+ }
61
+
62
+ cmsContentTypesMap.update(_cmsContentTypesMapUpdate)