1# coding: utf-8
2#
3# This file is part of pyasn1-modules software.
4#
5# Created by Stanisław Pitucha with asn1ate tool.
6# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
7# License: http://pyasn1.sf.net/license.html
8#
9# Cryptographic Message Syntax (CMS)
10#
11# ASN.1 source from:
12# http://www.ietf.org/rfc/rfc5652.txt
13#
14from pyasn1.type import constraint
15from pyasn1.type import namedtype
16from pyasn1.type import namedval
17from pyasn1.type import tag
18from pyasn1.type import univ
19from pyasn1.type import useful
20
21from pyasn1_modules import rfc3281
22from pyasn1_modules import rfc5280
23
24MAX = float('inf')
25
26
27def _buildOid(*components):
28    output = []
29    for x in tuple(components):
30        if isinstance(x, univ.ObjectIdentifier):
31            output.extend(list(x))
32        else:
33            output.append(int(x))
34
35    return univ.ObjectIdentifier(output)
36
37
38class AttCertVersionV1(univ.Integer):
39    pass
40
41
42AttCertVersionV1.namedValues = namedval.NamedValues(
43    ('v1', 0)
44)
45
46
47class AttributeCertificateInfoV1(univ.Sequence):
48    pass
49
50
51AttributeCertificateInfoV1.componentType = namedtype.NamedTypes(
52    namedtype.DefaultedNamedType('version', AttCertVersionV1().subtype(value="v1")),
53    namedtype.NamedType(
54        'subject', univ.Choice(
55            componentType=namedtype.NamedTypes(
56                namedtype.NamedType('baseCertificateID', rfc3281.IssuerSerial().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
57                namedtype.NamedType('subjectName', rfc5280.GeneralNames().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
58            )
59        )
60    ),
61    namedtype.NamedType('issuer', rfc5280.GeneralNames()),
62    namedtype.NamedType('signature', rfc5280.AlgorithmIdentifier()),
63    namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber()),
64    namedtype.NamedType('attCertValidityPeriod', rfc3281.AttCertValidityPeriod()),
65    namedtype.NamedType('attributes', univ.SequenceOf(componentType=rfc5280.Attribute())),
66    namedtype.OptionalNamedType('issuerUniqueID', rfc5280.UniqueIdentifier()),
67    namedtype.OptionalNamedType('extensions', rfc5280.Extensions())
68)
69
70
71class AttributeCertificateV1(univ.Sequence):
72    pass
73
74
75AttributeCertificateV1.componentType = namedtype.NamedTypes(
76    namedtype.NamedType('acInfo', AttributeCertificateInfoV1()),
77    namedtype.NamedType('signatureAlgorithm', rfc5280.AlgorithmIdentifier()),
78    namedtype.NamedType('signature', univ.BitString())
79)
80
81
82class AttributeValue(univ.Any):
83    pass
84
85
86class Attribute(univ.Sequence):
87    pass
88
89
90Attribute.componentType = namedtype.NamedTypes(
91    namedtype.NamedType('attrType', univ.ObjectIdentifier()),
92    namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()))
93)
94
95
96class SignedAttributes(univ.SetOf):
97    pass
98
99
100SignedAttributes.componentType = Attribute()
101SignedAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
102
103
104class AttributeCertificateV2(rfc3281.AttributeCertificate):
105    pass
106
107
108class OtherKeyAttribute(univ.Sequence):
109    pass
110
111
112OtherKeyAttribute.componentType = namedtype.NamedTypes(
113    namedtype.NamedType('keyAttrId', univ.ObjectIdentifier()),
114    namedtype.OptionalNamedType('keyAttr', univ.Any())
115)
116
117
118class UnauthAttributes(univ.SetOf):
119    pass
120
121
122UnauthAttributes.componentType = Attribute()
123UnauthAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
124
125id_encryptedData = _buildOid(1, 2, 840, 113549, 1, 7, 6)
126
127
128class SignatureValue(univ.OctetString):
129    pass
130
131
132class IssuerAndSerialNumber(univ.Sequence):
133    pass
134
135
136IssuerAndSerialNumber.componentType = namedtype.NamedTypes(
137    namedtype.NamedType('issuer', rfc5280.Name()),
138    namedtype.NamedType('serialNumber', rfc5280.CertificateSerialNumber())
139)
140
141
142class SubjectKeyIdentifier(univ.OctetString):
143    pass
144
145
146class RecipientKeyIdentifier(univ.Sequence):
147    pass
148
149
150RecipientKeyIdentifier.componentType = namedtype.NamedTypes(
151    namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier()),
152    namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
153    namedtype.OptionalNamedType('other', OtherKeyAttribute())
154)
155
156
157class KeyAgreeRecipientIdentifier(univ.Choice):
158    pass
159
160
161KeyAgreeRecipientIdentifier.componentType = namedtype.NamedTypes(
162    namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
163    namedtype.NamedType('rKeyId', RecipientKeyIdentifier().subtype(
164        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
165)
166
167
168class EncryptedKey(univ.OctetString):
169    pass
170
171
172class RecipientEncryptedKey(univ.Sequence):
173    pass
174
175
176RecipientEncryptedKey.componentType = namedtype.NamedTypes(
177    namedtype.NamedType('rid', KeyAgreeRecipientIdentifier()),
178    namedtype.NamedType('encryptedKey', EncryptedKey())
179)
180
181
182class RecipientEncryptedKeys(univ.SequenceOf):
183    pass
184
185
186RecipientEncryptedKeys.componentType = RecipientEncryptedKey()
187
188
189class MessageAuthenticationCode(univ.OctetString):
190    pass
191
192
193class CMSVersion(univ.Integer):
194    pass
195
196
197CMSVersion.namedValues = namedval.NamedValues(
198    ('v0', 0),
199    ('v1', 1),
200    ('v2', 2),
201    ('v3', 3),
202    ('v4', 4),
203    ('v5', 5)
204)
205
206
207class OtherCertificateFormat(univ.Sequence):
208    pass
209
210
211OtherCertificateFormat.componentType = namedtype.NamedTypes(
212    namedtype.NamedType('otherCertFormat', univ.ObjectIdentifier()),
213    namedtype.NamedType('otherCert', univ.Any())
214)
215
216
217class ExtendedCertificateInfo(univ.Sequence):
218    pass
219
220
221ExtendedCertificateInfo.componentType = namedtype.NamedTypes(
222    namedtype.NamedType('version', CMSVersion()),
223    namedtype.NamedType('certificate', rfc5280.Certificate()),
224    namedtype.NamedType('attributes', UnauthAttributes())
225)
226
227
228class Signature(univ.BitString):
229    pass
230
231
232class SignatureAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
233    pass
234
235
236class ExtendedCertificate(univ.Sequence):
237    pass
238
239
240ExtendedCertificate.componentType = namedtype.NamedTypes(
241    namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()),
242    namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
243    namedtype.NamedType('signature', Signature())
244)
245
246
247class CertificateChoices(univ.Choice):
248    pass
249
250
251CertificateChoices.componentType = namedtype.NamedTypes(
252    namedtype.NamedType('certificate', rfc5280.Certificate()),
253    namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
254        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
255    namedtype.NamedType('v1AttrCert', AttributeCertificateV1().subtype(
256        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
257    namedtype.NamedType('v2AttrCert', AttributeCertificateV2().subtype(
258        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
259    namedtype.NamedType('other', OtherCertificateFormat().subtype(
260        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)))
261)
262
263
264class CertificateSet(univ.SetOf):
265    pass
266
267
268CertificateSet.componentType = CertificateChoices()
269
270
271class OtherRevocationInfoFormat(univ.Sequence):
272    pass
273
274
275OtherRevocationInfoFormat.componentType = namedtype.NamedTypes(
276    namedtype.NamedType('otherRevInfoFormat', univ.ObjectIdentifier()),
277    namedtype.NamedType('otherRevInfo', univ.Any())
278)
279
280
281class RevocationInfoChoice(univ.Choice):
282    pass
283
284
285RevocationInfoChoice.componentType = namedtype.NamedTypes(
286    namedtype.NamedType('crl', rfc5280.CertificateList()),
287    namedtype.NamedType('other', OtherRevocationInfoFormat().subtype(
288        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
289)
290
291
292class RevocationInfoChoices(univ.SetOf):
293    pass
294
295
296RevocationInfoChoices.componentType = RevocationInfoChoice()
297
298
299class OriginatorInfo(univ.Sequence):
300    pass
301
302
303OriginatorInfo.componentType = namedtype.NamedTypes(
304    namedtype.OptionalNamedType('certs', CertificateSet().subtype(
305        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
306    namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
307        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
308)
309
310
311class ContentType(univ.ObjectIdentifier):
312    pass
313
314
315class EncryptedContent(univ.OctetString):
316    pass
317
318
319class ContentEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
320    pass
321
322
323class EncryptedContentInfo(univ.Sequence):
324    pass
325
326
327EncryptedContentInfo.componentType = namedtype.NamedTypes(
328    namedtype.NamedType('contentType', ContentType()),
329    namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()),
330    namedtype.OptionalNamedType('encryptedContent', EncryptedContent().subtype(
331        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
332)
333
334
335class UnprotectedAttributes(univ.SetOf):
336    pass
337
338
339UnprotectedAttributes.componentType = Attribute()
340UnprotectedAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
341
342
343class KeyEncryptionAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
344    pass
345
346
347class KEKIdentifier(univ.Sequence):
348    pass
349
350
351KEKIdentifier.componentType = namedtype.NamedTypes(
352    namedtype.NamedType('keyIdentifier', univ.OctetString()),
353    namedtype.OptionalNamedType('date', useful.GeneralizedTime()),
354    namedtype.OptionalNamedType('other', OtherKeyAttribute())
355)
356
357
358class KEKRecipientInfo(univ.Sequence):
359    pass
360
361
362KEKRecipientInfo.componentType = namedtype.NamedTypes(
363    namedtype.NamedType('version', CMSVersion()),
364    namedtype.NamedType('kekid', KEKIdentifier()),
365    namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
366    namedtype.NamedType('encryptedKey', EncryptedKey())
367)
368
369
370class KeyDerivationAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
371    pass
372
373
374class PasswordRecipientInfo(univ.Sequence):
375    pass
376
377
378PasswordRecipientInfo.componentType = namedtype.NamedTypes(
379    namedtype.NamedType('version', CMSVersion()),
380    namedtype.OptionalNamedType('keyDerivationAlgorithm', KeyDerivationAlgorithmIdentifier().subtype(
381        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
382    namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
383    namedtype.NamedType('encryptedKey', EncryptedKey())
384)
385
386
387class RecipientIdentifier(univ.Choice):
388    pass
389
390
391RecipientIdentifier.componentType = namedtype.NamedTypes(
392    namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
393    namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
394        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
395)
396
397
398class KeyTransRecipientInfo(univ.Sequence):
399    pass
400
401
402KeyTransRecipientInfo.componentType = namedtype.NamedTypes(
403    namedtype.NamedType('version', CMSVersion()),
404    namedtype.NamedType('rid', RecipientIdentifier()),
405    namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
406    namedtype.NamedType('encryptedKey', EncryptedKey())
407)
408
409
410class UserKeyingMaterial(univ.OctetString):
411    pass
412
413
414class OriginatorPublicKey(univ.Sequence):
415    pass
416
417
418OriginatorPublicKey.componentType = namedtype.NamedTypes(
419    namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()),
420    namedtype.NamedType('publicKey', univ.BitString())
421)
422
423
424class OriginatorIdentifierOrKey(univ.Choice):
425    pass
426
427
428OriginatorIdentifierOrKey.componentType = namedtype.NamedTypes(
429    namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
430    namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
431        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
432    namedtype.NamedType('originatorKey', OriginatorPublicKey().subtype(
433        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))
434)
435
436
437class KeyAgreeRecipientInfo(univ.Sequence):
438    pass
439
440
441KeyAgreeRecipientInfo.componentType = namedtype.NamedTypes(
442    namedtype.NamedType('version', CMSVersion()),
443    namedtype.NamedType('originator', OriginatorIdentifierOrKey().subtype(
444        explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
445    namedtype.OptionalNamedType('ukm', UserKeyingMaterial().subtype(
446        explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
447    namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()),
448    namedtype.NamedType('recipientEncryptedKeys', RecipientEncryptedKeys())
449)
450
451
452class OtherRecipientInfo(univ.Sequence):
453    pass
454
455
456OtherRecipientInfo.componentType = namedtype.NamedTypes(
457    namedtype.NamedType('oriType', univ.ObjectIdentifier()),
458    namedtype.NamedType('oriValue', univ.Any())
459)
460
461
462class RecipientInfo(univ.Choice):
463    pass
464
465
466RecipientInfo.componentType = namedtype.NamedTypes(
467    namedtype.NamedType('ktri', KeyTransRecipientInfo()),
468    namedtype.NamedType('kari', KeyAgreeRecipientInfo().subtype(
469        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
470    namedtype.NamedType('kekri', KEKRecipientInfo().subtype(
471        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
472    namedtype.NamedType('pwri', PasswordRecipientInfo().subtype(
473        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3))),
474    namedtype.NamedType('ori', OtherRecipientInfo().subtype(
475        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
476)
477
478
479class RecipientInfos(univ.SetOf):
480    pass
481
482
483RecipientInfos.componentType = RecipientInfo()
484RecipientInfos.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
485
486
487class EnvelopedData(univ.Sequence):
488    pass
489
490
491EnvelopedData.componentType = namedtype.NamedTypes(
492    namedtype.NamedType('version', CMSVersion()),
493    namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
494        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
495    namedtype.NamedType('recipientInfos', RecipientInfos()),
496    namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
497    namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
498        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
499)
500
501
502class DigestAlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
503    pass
504
505
506id_ct_contentInfo = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 6)
507
508id_digestedData = _buildOid(1, 2, 840, 113549, 1, 7, 5)
509
510
511class EncryptedData(univ.Sequence):
512    pass
513
514
515EncryptedData.componentType = namedtype.NamedTypes(
516    namedtype.NamedType('version', CMSVersion()),
517    namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()),
518    namedtype.OptionalNamedType('unprotectedAttrs', UnprotectedAttributes().subtype(
519        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
520)
521
522id_messageDigest = _buildOid(1, 2, 840, 113549, 1, 9, 4)
523
524id_signedData = _buildOid(1, 2, 840, 113549, 1, 7, 2)
525
526
527class MessageAuthenticationCodeAlgorithm(rfc5280.AlgorithmIdentifier):
528    pass
529
530
531class UnsignedAttributes(univ.SetOf):
532    pass
533
534
535UnsignedAttributes.componentType = Attribute()
536UnsignedAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
537
538
539class SignerIdentifier(univ.Choice):
540    pass
541
542
543SignerIdentifier.componentType = namedtype.NamedTypes(
544    namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()),
545    namedtype.NamedType('subjectKeyIdentifier', SubjectKeyIdentifier().subtype(
546        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
547)
548
549
550class SignerInfo(univ.Sequence):
551    pass
552
553
554SignerInfo.componentType = namedtype.NamedTypes(
555    namedtype.NamedType('version', CMSVersion()),
556    namedtype.NamedType('sid', SignerIdentifier()),
557    namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
558    namedtype.OptionalNamedType('signedAttrs', SignedAttributes().subtype(
559        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
560    namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()),
561    namedtype.NamedType('signature', SignatureValue()),
562    namedtype.OptionalNamedType('unsignedAttrs', UnsignedAttributes().subtype(
563        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
564)
565
566
567class SignerInfos(univ.SetOf):
568    pass
569
570
571SignerInfos.componentType = SignerInfo()
572
573
574class Countersignature(SignerInfo):
575    pass
576
577
578class ContentInfo(univ.Sequence):
579    pass
580
581
582ContentInfo.componentType = namedtype.NamedTypes(
583    namedtype.NamedType('contentType', ContentType()),
584    namedtype.NamedType('content', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
585)
586
587
588class EncapsulatedContentInfo(univ.Sequence):
589    pass
590
591
592EncapsulatedContentInfo.componentType = namedtype.NamedTypes(
593    namedtype.NamedType('eContentType', ContentType()),
594    namedtype.OptionalNamedType('eContent', univ.OctetString().subtype(
595        explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)))
596)
597
598id_countersignature = _buildOid(1, 2, 840, 113549, 1, 9, 6)
599
600id_data = _buildOid(1, 2, 840, 113549, 1, 7, 1)
601
602
603class MessageDigest(univ.OctetString):
604    pass
605
606
607class AuthAttributes(univ.SetOf):
608    pass
609
610
611AuthAttributes.componentType = Attribute()
612AuthAttributes.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
613
614
615class Time(univ.Choice):
616    pass
617
618
619Time.componentType = namedtype.NamedTypes(
620    namedtype.NamedType('utcTime', useful.UTCTime()),
621    namedtype.NamedType('generalTime', useful.GeneralizedTime())
622)
623
624
625class AuthenticatedData(univ.Sequence):
626    pass
627
628
629AuthenticatedData.componentType = namedtype.NamedTypes(
630    namedtype.NamedType('version', CMSVersion()),
631    namedtype.OptionalNamedType('originatorInfo', OriginatorInfo().subtype(
632        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
633    namedtype.NamedType('recipientInfos', RecipientInfos()),
634    namedtype.NamedType('macAlgorithm', MessageAuthenticationCodeAlgorithm()),
635    namedtype.OptionalNamedType('digestAlgorithm', DigestAlgorithmIdentifier().subtype(
636        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
637    namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
638    namedtype.OptionalNamedType('authAttrs', AuthAttributes().subtype(
639        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
640    namedtype.NamedType('mac', MessageAuthenticationCode()),
641    namedtype.OptionalNamedType('unauthAttrs', UnauthAttributes().subtype(
642        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
643)
644
645id_contentType = _buildOid(1, 2, 840, 113549, 1, 9, 3)
646
647
648class ExtendedCertificateOrCertificate(univ.Choice):
649    pass
650
651
652ExtendedCertificateOrCertificate.componentType = namedtype.NamedTypes(
653    namedtype.NamedType('certificate', rfc5280.Certificate()),
654    namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(
655        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))
656)
657
658
659class Digest(univ.OctetString):
660    pass
661
662
663class DigestedData(univ.Sequence):
664    pass
665
666
667DigestedData.componentType = namedtype.NamedTypes(
668    namedtype.NamedType('version', CMSVersion()),
669    namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()),
670    namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
671    namedtype.NamedType('digest', Digest())
672)
673
674id_envelopedData = _buildOid(1, 2, 840, 113549, 1, 7, 3)
675
676
677class DigestAlgorithmIdentifiers(univ.SetOf):
678    pass
679
680
681DigestAlgorithmIdentifiers.componentType = DigestAlgorithmIdentifier()
682
683
684class SignedData(univ.Sequence):
685    pass
686
687
688SignedData.componentType = namedtype.NamedTypes(
689    namedtype.NamedType('version', CMSVersion()),
690    namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()),
691    namedtype.NamedType('encapContentInfo', EncapsulatedContentInfo()),
692    namedtype.OptionalNamedType('certificates', CertificateSet().subtype(
693        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
694    namedtype.OptionalNamedType('crls', RevocationInfoChoices().subtype(
695        implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
696    namedtype.NamedType('signerInfos', SignerInfos())
697)
698
699id_signingTime = _buildOid(1, 2, 840, 113549, 1, 9, 5)
700
701
702class SigningTime(Time):
703    pass
704
705
706id_ct_authData = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 2)
707