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