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,325 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Modified by Russ Housley to import from RFC 5280 instead of RFC 2459.
5
+ #
6
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
7
+ # Copyright (c) 2021-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # PKCS#7 message syntax
11
+ #
12
+ # ASN.1 source from:
13
+ # https://opensource.apple.com/source/Security/Security-55179.1/libsecurity_asn1/asn1/pkcs7.asn.auto.html
14
+ #
15
+ # Sample captures from:
16
+ # openssl crl2pkcs7 -nocrl -certfile cert1.cer -out outfile.p7b
17
+ #
18
+ from pyasn1.type import namedtype
19
+ from pyasn1.type import opentype
20
+ from pyasn1.type import tag
21
+ from pyasn1.type import univ
22
+ from pyasn1.type import useful
23
+
24
+ from pyasn1_alt_modules import rfc5280
25
+
26
+
27
+ # Keep the original maps so that anyone using this old module has the
28
+ # same interface as with pyasn-modules. Thus, opentypemap is not used.
29
+
30
+ from pyasn1_alt_modules.rfc2459 import certificateAttributesMap
31
+
32
+ contentTypeMap = {}
33
+
34
+
35
+ # Imports from RFC 5280
36
+
37
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
38
+
39
+ AttributeType = rfc5280.AttributeType
40
+
41
+ AttributeValue = rfc5280.AttributeValue
42
+
43
+ Certificate = rfc5280.Certificate
44
+
45
+ CertificateSerialNumber = rfc5280.CertificateSerialNumber
46
+
47
+ Name = rfc5280.Name
48
+
49
+
50
+ # PKCS#7
51
+
52
+ class Attribute(univ.Sequence):
53
+ componentType = namedtype.NamedTypes(
54
+ namedtype.NamedType('type', AttributeType()),
55
+ namedtype.NamedType('values', univ.SetOf(componentType=AttributeValue()))
56
+ )
57
+
58
+
59
+ class AttributeValueAssertion(univ.Sequence):
60
+ componentType = namedtype.NamedTypes(
61
+ namedtype.NamedType('attributeType', AttributeType()),
62
+ namedtype.NamedType('attributeValue', AttributeValue(),
63
+ openType=opentype.OpenType('type', certificateAttributesMap))
64
+ )
65
+
66
+
67
+ pkcs_7 = univ.ObjectIdentifier('1.2.840.113549.1.7')
68
+ data = univ.ObjectIdentifier('1.2.840.113549.1.7.1')
69
+ signedData = univ.ObjectIdentifier('1.2.840.113549.1.7.2')
70
+ envelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.3')
71
+ signedAndEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.4')
72
+ digestedData = univ.ObjectIdentifier('1.2.840.113549.1.7.5')
73
+ encryptedData = univ.ObjectIdentifier('1.2.840.113549.1.7.6')
74
+
75
+
76
+ class ContentType(univ.ObjectIdentifier):
77
+ pass
78
+
79
+
80
+ class ContentEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
81
+ pass
82
+
83
+
84
+ class EncryptedContent(univ.OctetString):
85
+ pass
86
+
87
+
88
+ class EncryptedContentInfo(univ.Sequence):
89
+ componentType = namedtype.NamedTypes(
90
+ namedtype.NamedType('contentType', ContentType()),
91
+ namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
92
+ namedtype.OptionalNamedType(
93
+ 'encryptedContent', EncryptedContent().subtype(
94
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
95
+ ),
96
+ openType=opentype.OpenType('contentType', contentTypeMap)
97
+ )
98
+ )
99
+
100
+
101
+ class Version(univ.Integer):
102
+ pass
103
+
104
+
105
+ class EncryptedData(univ.Sequence):
106
+ componentType = namedtype.NamedTypes(
107
+ namedtype.NamedType('version', Version()),
108
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())
109
+ )
110
+
111
+
112
+ class DigestAlgorithmIdentifier(AlgorithmIdentifier):
113
+ pass
114
+
115
+
116
+ class DigestAlgorithmIdentifiers(univ.SetOf):
117
+ componentType = DigestAlgorithmIdentifier()
118
+
119
+
120
+ class Digest(univ.OctetString):
121
+ pass
122
+
123
+
124
+ class ContentInfo(univ.Sequence):
125
+ componentType = namedtype.NamedTypes(
126
+ namedtype.NamedType('contentType', ContentType()),
127
+ namedtype.OptionalNamedType(
128
+ 'content',
129
+ univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)),
130
+ openType=opentype.OpenType('contentType', contentTypeMap)
131
+ )
132
+ )
133
+
134
+
135
+ class DigestedData(univ.Sequence):
136
+ componentType = namedtype.NamedTypes(
137
+ namedtype.NamedType('version', Version()),
138
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
139
+ namedtype.NamedType('contentInfo', ContentInfo()),
140
+ namedtype.NamedType('digest', Digest())
141
+ )
142
+
143
+
144
+ class IssuerAndSerialNumber(univ.Sequence):
145
+ componentType = namedtype.NamedTypes(
146
+ namedtype.NamedType('issuer', Name()),
147
+ namedtype.NamedType('serialNumber', CertificateSerialNumber())
148
+ )
149
+
150
+
151
+ class KeyEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
152
+ pass
153
+
154
+
155
+ class EncryptedKey(univ.OctetString):
156
+ pass
157
+
158
+
159
+ class RecipientInfo(univ.Sequence):
160
+ componentType = namedtype.NamedTypes(
161
+ namedtype.NamedType('version', Version()),
162
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
163
+ namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
164
+ namedtype.NamedType('encryptedKey', EncryptedKey())
165
+ )
166
+
167
+
168
+ class RecipientInfos(univ.SetOf):
169
+ componentType = RecipientInfo()
170
+
171
+
172
+ class Attributes(univ.SetOf):
173
+ componentType = Attribute()
174
+
175
+
176
+ class ExtendedCertificateInfo(univ.Sequence):
177
+ componentType = namedtype.NamedTypes(
178
+ namedtype.NamedType('version', Version()),
179
+ namedtype.NamedType('certificate', Certificate()),
180
+ namedtype.NamedType('attributes', Attributes())
181
+ )
182
+
183
+
184
+ class SignatureAlgorithmIdentifier(AlgorithmIdentifier):
185
+ pass
186
+
187
+
188
+ class Signature(univ.BitString):
189
+ pass
190
+
191
+
192
+ class ExtendedCertificate(univ.Sequence):
193
+ componentType = namedtype.NamedTypes(
194
+ namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
195
+ namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
196
+ namedtype.NamedType('signature', Signature())
197
+ )
198
+
199
+
200
+ class ExtendedCertificateOrCertificate(univ.Choice):
201
+ componentType = namedtype.NamedTypes(
202
+ namedtype.NamedType('certificate', Certificate()),
203
+ namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
204
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
205
+ )
206
+
207
+
208
+ class ExtendedCertificatesAndCertificates(univ.SetOf):
209
+ componentType = ExtendedCertificateOrCertificate()
210
+
211
+
212
+ class SerialNumber(univ.Integer):
213
+ pass
214
+
215
+
216
+ class CRLEntry(univ.Sequence):
217
+ componentType = namedtype.NamedTypes(
218
+ namedtype.NamedType('userCertificate', SerialNumber()),
219
+ namedtype.NamedType('revocationDate', useful.UTCTime())
220
+ )
221
+
222
+
223
+ class TBSCertificateRevocationList(univ.Sequence):
224
+ componentType = namedtype.NamedTypes(
225
+ namedtype.NamedType('signature', AlgorithmIdentifier()),
226
+ namedtype.NamedType('issuer', Name()),
227
+ namedtype.NamedType('lastUpdate', useful.UTCTime()),
228
+ namedtype.NamedType('nextUpdate', useful.UTCTime()),
229
+ namedtype.OptionalNamedType('revokedCertificates', univ.SequenceOf(componentType=CRLEntry()))
230
+ )
231
+
232
+
233
+ class CertificateRevocationList(univ.Sequence):
234
+ componentType = namedtype.NamedTypes(
235
+ namedtype.NamedType('tbsCertificateRevocationList', TBSCertificateRevocationList()),
236
+ namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()),
237
+ namedtype.NamedType('signature', univ.BitString())
238
+ )
239
+
240
+
241
+ class CertificateRevocationLists(univ.SetOf):
242
+ componentType = CertificateRevocationList()
243
+
244
+
245
+ class DigestEncryptionAlgorithmIdentifier(AlgorithmIdentifier):
246
+ pass
247
+
248
+
249
+ class EncryptedDigest(univ.OctetString):
250
+ pass
251
+
252
+
253
+ class SignerInfo(univ.Sequence):
254
+ componentType = namedtype.NamedTypes(
255
+ namedtype.NamedType('version', Version()),
256
+ namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
257
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
258
+ namedtype.OptionalNamedType('authenticatedAttributes', Attributes().subtype(
259
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
260
+ namedtype.NamedType('digestEncryptionAlgorithm', DigestEncryptionAlgorithmIdentifier()),
261
+ namedtype.NamedType('encryptedDigest', EncryptedDigest()),
262
+ namedtype.OptionalNamedType('unauthenticatedAttributes', Attributes().subtype(
263
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
264
+ )
265
+
266
+
267
+ class SignerInfos(univ.SetOf):
268
+ componentType = SignerInfo()
269
+
270
+
271
+ class SignedAndEnvelopedData(univ.Sequence):
272
+ componentType = namedtype.NamedTypes(
273
+ namedtype.NamedType('version', Version()),
274
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
275
+ namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
276
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
277
+ namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(
278
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
279
+ namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(
280
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
281
+ namedtype.NamedType('signerInfos', SignerInfos())
282
+ )
283
+
284
+
285
+ class EnvelopedData(univ.Sequence):
286
+ componentType = namedtype.NamedTypes(
287
+ namedtype.NamedType('version', Version()),
288
+ namedtype.NamedType('recipientInfos', RecipientInfos()),
289
+ namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())
290
+ )
291
+
292
+
293
+ class DigestInfo(univ.Sequence):
294
+ componentType = namedtype.NamedTypes(
295
+ namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
296
+ namedtype.NamedType('digest', Digest())
297
+ )
298
+
299
+
300
+ class SignedData(univ.Sequence):
301
+ componentType = namedtype.NamedTypes(
302
+ namedtype.NamedType('version', Version()),
303
+ namedtype.OptionalNamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
304
+ namedtype.NamedType('contentInfo', ContentInfo()),
305
+ namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(
306
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
307
+ namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(
308
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
309
+ namedtype.OptionalNamedType('signerInfos', SignerInfos())
310
+ )
311
+
312
+
313
+ class Data(univ.OctetString):
314
+ pass
315
+
316
+ _contentTypeMapUpdate = {
317
+ data: Data(),
318
+ signedData: SignedData(),
319
+ envelopedData: EnvelopedData(),
320
+ signedAndEnvelopedData: SignedAndEnvelopedData(),
321
+ digestedData: DigestedData(),
322
+ encryptedData: EncryptedData()
323
+ }
324
+
325
+ contentTypeMap.update(_contentTypeMapUpdate)
@@ -0,0 +1,70 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
5
+ # Copyright (c) 2021-2024, Vigil Security, LLC
6
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
7
+ #
8
+ # PKCS#1 syntax
9
+ #
10
+ # ASN.1 source from:
11
+ # ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2.asn
12
+ #
13
+ # Sample captures could be obtained with "openssl genrsa" command
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.rfc2459 import AlgorithmIdentifier
20
+
21
+ pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
22
+ rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
23
+ md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.2')
24
+ md4WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.3')
25
+ md5WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.4')
26
+ sha1WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.5')
27
+ rsaOAEPEncryptionSET = univ.ObjectIdentifier('1.2.840.113549.1.1.6')
28
+ id_RSAES_OAEP = univ.ObjectIdentifier('1.2.840.113549.1.1.7')
29
+ id_mgf1 = univ.ObjectIdentifier('1.2.840.113549.1.1.8')
30
+ id_pSpecified = univ.ObjectIdentifier('1.2.840.113549.1.1.9')
31
+ id_sha1 = univ.ObjectIdentifier('1.3.14.3.2.26')
32
+
33
+ MAX = float('inf')
34
+
35
+
36
+ class Version(univ.Integer):
37
+ pass
38
+
39
+
40
+ class RSAPrivateKey(univ.Sequence):
41
+ componentType = namedtype.NamedTypes(
42
+ namedtype.NamedType('version', Version()),
43
+ namedtype.NamedType('modulus', univ.Integer()),
44
+ namedtype.NamedType('publicExponent', univ.Integer()),
45
+ namedtype.NamedType('privateExponent', univ.Integer()),
46
+ namedtype.NamedType('prime1', univ.Integer()),
47
+ namedtype.NamedType('prime2', univ.Integer()),
48
+ namedtype.NamedType('exponent1', univ.Integer()),
49
+ namedtype.NamedType('exponent2', univ.Integer()),
50
+ namedtype.NamedType('coefficient', univ.Integer())
51
+ )
52
+
53
+
54
+ class RSAPublicKey(univ.Sequence):
55
+ componentType = namedtype.NamedTypes(
56
+ namedtype.NamedType('modulus', univ.Integer()),
57
+ namedtype.NamedType('publicExponent', univ.Integer())
58
+ )
59
+
60
+
61
+ # XXX defaults not set
62
+ class RSAES_OAEP_params(univ.Sequence):
63
+ componentType = namedtype.NamedTypes(
64
+ namedtype.NamedType('hashFunc', AlgorithmIdentifier().subtype(
65
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
66
+ namedtype.NamedType('maskGenFunc', AlgorithmIdentifier().subtype(
67
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
68
+ namedtype.NamedType('pSourceFunc', AlgorithmIdentifier().subtype(
69
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
70
+ )