1
|
1 |
|
from ...utils import ScalarMap |
2
|
1 |
|
from ...xelement import XElement |
3
|
|
|
|
4
|
|
|
|
5
|
1 |
|
class RSAKeyValueType(ScalarMap): |
6
|
1 |
|
def __init__( |
7
|
|
|
self, |
8
|
|
|
modulus: str, |
9
|
|
|
exponent: str, |
10
|
|
|
): |
11
|
|
|
""" |
12
|
|
|
|
13
|
|
|
:param modulus: |
14
|
|
|
:param exponent: |
15
|
|
|
""" |
16
|
|
|
|
17
|
|
|
super().__init__({ |
18
|
|
|
'Modulus': modulus, |
19
|
|
|
'Exponent': exponent, |
20
|
|
|
}) |
21
|
|
|
|
22
|
|
|
|
23
|
1 |
|
class DSAKeyValueType(ScalarMap): |
24
|
1 |
|
def __init__( |
25
|
|
|
self, |
26
|
|
|
p: str, |
27
|
|
|
q: str, |
28
|
|
|
y: str, |
29
|
|
|
seed: str, |
30
|
|
|
pgen_counter: str, |
31
|
|
|
g: str = None, |
32
|
|
|
j: str = None, |
33
|
|
|
): |
34
|
|
|
""" |
35
|
|
|
|
36
|
|
|
:param p: |
37
|
|
|
:param q: |
38
|
|
|
:param y: |
39
|
|
|
:param seed: |
40
|
|
|
:param pgen_counter: |
41
|
|
|
:param g: |
42
|
|
|
:param j: |
43
|
|
|
""" |
44
|
|
|
|
45
|
|
|
super().__init__({ |
46
|
|
|
'P': p, |
47
|
|
|
'Q': q, |
48
|
|
|
'Y': y, |
49
|
|
|
'Seed': seed, |
50
|
|
|
'PgenCounter': pgen_counter, |
51
|
|
|
'G': g, |
52
|
|
|
'J': j, |
53
|
|
|
}) |
54
|
|
|
|
55
|
|
|
|
56
|
1 |
|
class SignaturePropertyType(ScalarMap): |
57
|
1 |
|
def __init__( |
58
|
|
|
self, |
59
|
|
|
target: str, |
60
|
|
|
id: str = None, |
61
|
|
|
): |
62
|
|
|
""" |
63
|
|
|
|
64
|
|
|
:param target: |
65
|
|
|
:param id: |
66
|
|
|
""" |
67
|
|
|
|
68
|
|
|
super().__init__({ |
69
|
|
|
'Target': target, |
70
|
|
|
'Id': id, |
71
|
|
|
}) |
72
|
|
|
|
73
|
|
|
|
74
|
1 |
|
class SignaturePropertiesType(ScalarMap): |
75
|
1 |
|
def __init__( |
76
|
|
|
self, |
77
|
|
|
signature_property: SignaturePropertyType | dict = None, |
78
|
|
|
id: str = None, |
79
|
|
|
): |
80
|
|
|
""" |
81
|
|
|
|
82
|
|
|
:param signature_property: |
83
|
|
|
:param id: |
84
|
|
|
""" |
85
|
|
|
|
86
|
|
|
super().__init__({ |
87
|
|
|
'SignatureProperty': signature_property, |
88
|
|
|
'Id': id, |
89
|
|
|
}) |
90
|
|
|
|
91
|
|
|
|
92
|
1 |
|
class ObjectType(ScalarMap): |
93
|
1 |
|
def __init__( |
94
|
|
|
self, |
95
|
|
|
id: str = None, |
96
|
|
|
mime_type: str = None, |
97
|
|
|
encoding: str = None, |
98
|
|
|
): |
99
|
|
|
""" |
100
|
|
|
|
101
|
|
|
:param id: |
102
|
|
|
:param mime_type: |
103
|
|
|
:param encoding: |
104
|
|
|
""" |
105
|
|
|
|
106
|
|
|
super().__init__({ |
107
|
|
|
'Id': id, |
108
|
|
|
'MimeType': mime_type, |
109
|
|
|
'Encoding': encoding, |
110
|
|
|
}) |
111
|
|
|
|
112
|
|
|
|
113
|
1 |
|
class SPKIDataType(ScalarMap): |
114
|
1 |
|
def __init__( |
115
|
|
|
self, |
116
|
|
|
spkisexp: str, |
117
|
|
|
): |
118
|
|
|
""" |
119
|
|
|
|
120
|
|
|
:param spkisexp: |
121
|
|
|
""" |
122
|
|
|
|
123
|
|
|
super().__init__({ |
124
|
|
|
'SPKISexp': spkisexp, |
125
|
|
|
}) |
126
|
|
|
|
127
|
|
|
|
128
|
1 |
|
class PGPDataType(ScalarMap): |
129
|
1 |
|
def __init__( |
130
|
|
|
self, |
131
|
|
|
pgpkey_id: str, |
132
|
|
|
pgpkey_packet: str = None, |
133
|
|
|
): |
134
|
|
|
""" |
135
|
|
|
|
136
|
|
|
:param pgpkey_id: |
137
|
|
|
:param pgpkey_packet: |
138
|
|
|
""" |
139
|
|
|
|
140
|
|
|
super().__init__({ |
141
|
|
|
'PGPKeyID': pgpkey_id, |
142
|
|
|
'PGPKeyPacket': pgpkey_packet, |
143
|
|
|
}) |
144
|
|
|
|
145
|
|
|
|
146
|
1 |
|
class X509IssuerSerialType(ScalarMap): |
147
|
1 |
|
def __init__( |
148
|
|
|
self, |
149
|
|
|
x509issuer_name: str, |
150
|
|
|
x509serial_number: int, |
151
|
|
|
): |
152
|
|
|
""" |
153
|
|
|
|
154
|
|
|
:param x509issuer_name: |
155
|
|
|
:param x509serial_number: |
156
|
|
|
""" |
157
|
|
|
|
158
|
1 |
|
super().__init__({ |
159
|
|
|
'X509IssuerName': x509issuer_name, |
160
|
|
|
'X509SerialNumber': x509serial_number, |
161
|
|
|
}) |
162
|
|
|
|
163
|
|
|
|
164
|
1 |
|
class X509DataType(ScalarMap): |
165
|
1 |
|
def __init__( |
166
|
|
|
self, |
167
|
|
|
x509issuer_serial: X509IssuerSerialType | dict = None, |
168
|
|
|
x509ski: str = None, |
169
|
|
|
x509subject_name: str = None, |
170
|
|
|
x509certificate: str = None, |
171
|
|
|
x509crl: str = None, |
172
|
|
|
): |
173
|
|
|
""" |
174
|
|
|
|
175
|
|
|
:param x509issuer_serial: |
176
|
|
|
:param x509ski: |
177
|
|
|
:param x509subject_name: |
178
|
|
|
:param x509certificate: |
179
|
|
|
:param x509crl: |
180
|
|
|
""" |
181
|
|
|
|
182
|
1 |
|
super().__init__({ |
183
|
|
|
'X509IssuerSerial': x509issuer_serial, |
184
|
|
|
'X509SKI': x509ski, |
185
|
|
|
'X509SubjectName': x509subject_name, |
186
|
|
|
'X509Certificate': x509certificate, |
187
|
|
|
'X509CRL': x509crl, |
188
|
|
|
}) |
189
|
|
|
|
190
|
|
|
|
191
|
1 |
|
class KeyValueType(ScalarMap): |
192
|
1 |
|
def __init__( |
193
|
|
|
self, |
194
|
|
|
dsakey_value: DSAKeyValueType | dict = None, |
195
|
|
|
rsakey_value: RSAKeyValueType | dict = None, |
196
|
|
|
): |
197
|
|
|
""" |
198
|
|
|
|
199
|
|
|
:param dsakey_value: |
200
|
|
|
:param rsakey_value: |
201
|
|
|
""" |
202
|
|
|
|
203
|
|
|
super().__init__({ |
204
|
|
|
'DSAKeyValue': dsakey_value, |
205
|
|
|
'RSAKeyValue': rsakey_value, |
206
|
|
|
}) |
207
|
|
|
|
208
|
|
|
|
209
|
1 |
|
class DigestMethodType(ScalarMap): |
210
|
1 |
|
def __init__( |
211
|
|
|
self, |
212
|
|
|
algorithm: str, |
213
|
|
|
): |
214
|
|
|
""" |
215
|
|
|
|
216
|
|
|
:param algorithm: |
217
|
|
|
""" |
218
|
|
|
|
219
|
1 |
|
super().__init__({ |
220
|
|
|
'Algorithm': algorithm, |
221
|
|
|
}) |
222
|
|
|
|
223
|
|
|
|
224
|
1 |
|
class TransformType(ScalarMap): |
225
|
1 |
|
def __init__( |
226
|
|
|
self, |
227
|
|
|
algorithm: str, |
228
|
|
|
xpath: str = None, |
229
|
|
|
): |
230
|
|
|
""" |
231
|
|
|
|
232
|
|
|
:param algorithm: |
233
|
|
|
:param xpath: |
234
|
|
|
""" |
235
|
|
|
|
236
|
1 |
|
super().__init__({ |
237
|
|
|
'Algorithm': algorithm, |
238
|
|
|
'XPath': xpath, |
239
|
|
|
}) |
240
|
|
|
|
241
|
|
|
|
242
|
1 |
|
class TransformsType(ScalarMap): |
243
|
1 |
|
def __init__( |
244
|
|
|
self, |
245
|
|
|
transform: TransformType | dict = None, |
246
|
|
|
): |
247
|
|
|
""" |
248
|
|
|
|
249
|
|
|
:param transform: |
250
|
|
|
""" |
251
|
|
|
|
252
|
1 |
|
super().__init__({ |
253
|
|
|
'Transform': transform, |
254
|
|
|
}) |
255
|
|
|
|
256
|
|
|
|
257
|
1 |
|
class RetrievalMethodType(ScalarMap): |
258
|
1 |
|
def __init__( |
259
|
|
|
self, |
260
|
|
|
uri: str = None, |
261
|
|
|
type: str = None, |
262
|
|
|
transforms: TransformsType | dict = None, |
263
|
|
|
): |
264
|
|
|
""" |
265
|
|
|
|
266
|
|
|
:param uri: |
267
|
|
|
:param type: |
268
|
|
|
:param transforms: |
269
|
|
|
""" |
270
|
|
|
|
271
|
|
|
super().__init__({ |
272
|
|
|
'URI': uri, |
273
|
|
|
'Type': type, |
274
|
|
|
'Transforms': transforms, |
275
|
|
|
}) |
276
|
|
|
|
277
|
|
|
|
278
|
1 |
|
class KeyInfoType(ScalarMap): |
279
|
1 |
|
def __init__( |
280
|
|
|
self, |
281
|
|
|
id: str = None, |
282
|
|
|
key_name: str = None, |
283
|
|
|
key_value: KeyValueType | dict = None, |
284
|
|
|
retrieval_method: RetrievalMethodType | dict = None, |
285
|
|
|
x509data: X509DataType | dict = None, |
286
|
|
|
pgpdata: PGPDataType | dict = None, |
287
|
|
|
spkid_ata: SPKIDataType | dict = None, |
288
|
|
|
mgmt_data: str = None, |
289
|
|
|
): |
290
|
|
|
""" |
291
|
|
|
|
292
|
|
|
:param id: |
293
|
|
|
:param key_name: |
294
|
|
|
:param key_value: |
295
|
|
|
:param retrieval_method: |
296
|
|
|
:param x509data: |
297
|
|
|
:param pgpdata: |
298
|
|
|
:param spkid_ata: |
299
|
|
|
:param mgmt_data: |
300
|
|
|
""" |
301
|
|
|
|
302
|
1 |
|
super().__init__({ |
303
|
|
|
'Id': id, |
304
|
|
|
'KeyName': key_name, |
305
|
|
|
'KeyValue': key_value, |
306
|
|
|
'RetrievalMethod': retrieval_method, |
307
|
|
|
'X509Data': x509data, |
308
|
|
|
'PGPData': pgpdata, |
309
|
|
|
'SPKIData': spkid_ata, |
310
|
|
|
'MgmtData': mgmt_data, |
311
|
|
|
}) |
312
|
|
|
|
313
|
|
|
|
314
|
1 |
|
class ReferenceType(ScalarMap): |
315
|
1 |
|
def __init__( |
316
|
|
|
self, |
317
|
|
|
digest_method: DigestMethodType | dict = None, |
318
|
|
|
digest_value: str = None, |
319
|
|
|
id: str = None, |
320
|
|
|
uri: str = None, |
321
|
|
|
type: str = None, |
322
|
|
|
transforms: TransformsType | dict = None, |
323
|
|
|
): |
324
|
|
|
""" |
325
|
|
|
|
326
|
|
|
:param digest_method: |
327
|
|
|
:param digest_value: |
328
|
|
|
:param id: |
329
|
|
|
:param uri: |
330
|
|
|
:param type: |
331
|
|
|
:param transforms: |
332
|
|
|
""" |
333
|
|
|
|
334
|
1 |
|
super().__init__({ |
335
|
|
|
'DigestMethod': digest_method, |
336
|
|
|
'DigestValue': digest_value, |
337
|
|
|
'Id': id, |
338
|
|
|
'URI': uri, |
339
|
|
|
'Type': type, |
340
|
|
|
'Transforms': transforms, |
341
|
|
|
}) |
342
|
|
|
|
343
|
|
|
|
344
|
1 |
|
class ManifestType(ScalarMap): |
345
|
1 |
|
def __init__( |
346
|
|
|
self, |
347
|
|
|
reference: ReferenceType | dict = None, |
348
|
|
|
id: str = None, |
349
|
|
|
): |
350
|
|
|
""" |
351
|
|
|
|
352
|
|
|
:param reference: |
353
|
|
|
:param id: |
354
|
|
|
""" |
355
|
|
|
|
356
|
|
|
super().__init__({ |
357
|
|
|
'Reference': reference, |
358
|
|
|
'Id': id, |
359
|
|
|
}) |
360
|
|
|
|
361
|
|
|
|
362
|
1 |
|
class SignatureMethodType(ScalarMap): |
363
|
1 |
|
def __init__( |
364
|
|
|
self, |
365
|
|
|
algorithm: str, |
366
|
|
|
hmacoutput_length: int = None, |
367
|
|
|
): |
368
|
|
|
""" |
369
|
|
|
|
370
|
|
|
:param algorithm: |
371
|
|
|
:param hmacoutput_length: |
372
|
|
|
""" |
373
|
|
|
|
374
|
1 |
|
super().__init__({ |
375
|
|
|
'Algorithm': algorithm, |
376
|
|
|
'HMACOutputLength': hmacoutput_length, |
377
|
|
|
}) |
378
|
|
|
|
379
|
|
|
|
380
|
1 |
|
class CanonicalizationMethodType(ScalarMap): |
381
|
1 |
|
def __init__( |
382
|
|
|
self, |
383
|
|
|
algorithm: str, |
384
|
|
|
): |
385
|
|
|
""" |
386
|
|
|
|
387
|
|
|
:param algorithm: |
388
|
|
|
""" |
389
|
|
|
|
390
|
1 |
|
super().__init__({ |
391
|
|
|
'Algorithm': algorithm, |
392
|
|
|
}) |
393
|
|
|
|
394
|
|
|
|
395
|
1 |
|
class SignedInfoType(ScalarMap): |
396
|
1 |
|
def __init__( |
397
|
|
|
self, |
398
|
|
|
canonicalization_method: CanonicalizationMethodType | dict = None, |
399
|
|
|
signature_method: SignatureMethodType | dict = None, |
400
|
|
|
reference: ReferenceType | dict = None, |
401
|
|
|
id: str = None, |
402
|
|
|
): |
403
|
|
|
""" |
404
|
|
|
|
405
|
|
|
:param canonicalization_method: |
406
|
|
|
:param signature_method: |
407
|
|
|
:param reference: |
408
|
|
|
:param id: |
409
|
|
|
""" |
410
|
|
|
|
411
|
1 |
|
super().__init__({ |
412
|
|
|
'CanonicalizationMethod': canonicalization_method, |
413
|
|
|
'SignatureMethod': signature_method, |
414
|
|
|
'Reference': reference, |
415
|
|
|
'Id': id, |
416
|
|
|
}) |
417
|
|
|
|
418
|
|
|
|
419
|
1 |
|
class SignatureValueType(ScalarMap): |
420
|
1 |
|
def __init__( |
421
|
|
|
self, |
422
|
|
|
_text: str, |
423
|
|
|
id: str = None, |
424
|
|
|
): |
425
|
|
|
""" |
426
|
|
|
|
427
|
|
|
:param _text: |
428
|
|
|
:param id: |
429
|
|
|
""" |
430
|
|
|
|
431
|
1 |
|
super().__init__({ |
432
|
|
|
'_text': _text, |
433
|
|
|
'Id': id, |
434
|
|
|
}) |
435
|
|
|
|
436
|
|
|
|
437
|
1 |
|
class SignatureType(ScalarMap): |
438
|
1 |
|
def __init__( |
439
|
|
|
self, |
440
|
|
|
signed_info: SignedInfoType | dict = None, |
441
|
|
|
signature_value: SignatureValueType | dict = None, |
442
|
|
|
id: str = None, |
443
|
|
|
key_info: KeyInfoType | dict = None, |
444
|
|
|
object: ObjectType | dict = None, |
445
|
|
|
): |
446
|
|
|
""" |
447
|
|
|
|
448
|
|
|
:param signed_info: |
449
|
|
|
:param signature_value: |
450
|
|
|
:param id: |
451
|
|
|
:param key_info: |
452
|
|
|
:param object: |
453
|
|
|
""" |
454
|
|
|
|
455
|
1 |
|
super().__init__({ |
456
|
|
|
'SignedInfo': signed_info, |
457
|
|
|
'SignatureValue': signature_value, |
458
|
|
|
'Id': id, |
459
|
|
|
'KeyInfo': key_info, |
460
|
|
|
'Object': object, |
461
|
|
|
}) |
462
|
|
|
|
463
|
|
|
|
464
|
1 |
|
class RSAKeyValue(RSAKeyValueType, XElement): |
465
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}RSAKeyValue' |
466
|
|
|
|
467
|
|
|
|
468
|
1 |
|
class DSAKeyValue(DSAKeyValueType, XElement): |
469
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}DSAKeyValue' |
470
|
|
|
|
471
|
|
|
|
472
|
1 |
|
class SignatureProperty(SignaturePropertyType, XElement): |
473
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SignatureProperty' |
474
|
|
|
|
475
|
|
|
|
476
|
1 |
|
class SignatureProperties(SignaturePropertiesType, XElement): |
477
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SignatureProperties' |
478
|
|
|
|
479
|
|
|
|
480
|
1 |
|
class Manifest(ManifestType, XElement): |
481
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Manifest' |
482
|
|
|
|
483
|
|
|
|
484
|
1 |
|
class Object(ObjectType, XElement): |
485
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Object' |
486
|
|
|
|
487
|
|
|
|
488
|
1 |
|
class SPKIData(SPKIDataType, XElement): |
489
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SPKIData' |
490
|
|
|
|
491
|
|
|
|
492
|
1 |
|
class PGPData(PGPDataType, XElement): |
493
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}PGPData' |
494
|
|
|
|
495
|
|
|
|
496
|
1 |
|
class X509Data(X509DataType, XElement): |
497
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}X509Data' |
498
|
|
|
|
499
|
|
|
|
500
|
1 |
|
class RetrievalMethod(RetrievalMethodType, XElement): |
501
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}RetrievalMethod' |
502
|
|
|
|
503
|
|
|
|
504
|
1 |
|
class KeyValue(KeyValueType, XElement): |
505
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}KeyValue' |
506
|
|
|
|
507
|
|
|
|
508
|
1 |
|
class KeyInfo(KeyInfoType, XElement): |
509
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}KeyInfo' |
510
|
|
|
|
511
|
|
|
|
512
|
1 |
|
class DigestMethod(DigestMethodType, XElement): |
513
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}DigestMethod' |
514
|
|
|
|
515
|
|
|
|
516
|
1 |
|
class Transform(TransformType, XElement): |
517
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Transform' |
518
|
|
|
|
519
|
|
|
|
520
|
1 |
|
class Transforms(TransformsType, XElement): |
521
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Transforms' |
522
|
|
|
|
523
|
|
|
|
524
|
1 |
|
class Reference(ReferenceType, XElement): |
525
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Reference' |
526
|
|
|
|
527
|
|
|
|
528
|
1 |
|
class SignatureMethod(SignatureMethodType, XElement): |
529
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SignatureMethod' |
530
|
|
|
|
531
|
|
|
|
532
|
1 |
|
class CanonicalizationMethod(CanonicalizationMethodType, XElement): |
533
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod' |
534
|
|
|
|
535
|
|
|
|
536
|
1 |
|
class SignedInfo(SignedInfoType, XElement): |
537
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SignedInfo' |
538
|
|
|
|
539
|
|
|
|
540
|
1 |
|
class SignatureValue(SignatureValueType, XElement): |
541
|
1 |
|
tag = '{http://www.w3.org/2000/09/xmldsig#}SignatureValue' |
542
|
|
|
|
543
|
|
|
|
544
|
1 |
|
class Signature(SignatureType, XElement): |
545
|
|
|
tag = '{http://www.w3.org/2000/09/xmldsig#}Signature' |
546
|
|
|
|