1# 2# This file is part of pyasn1-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# 7# Copyright (c) 2019, Vigil Security, LLC 8# License: http://snmplabs.com/pyasn1/license.html 9# 10# Protecting Multiple Contents with the CMS 11# 12# ASN.1 source from: 13# https://www.rfc-editor.org/rfc/rfc4073.txt 14# 15 16from pyasn1.type import constraint 17from pyasn1.type import namedtype 18from pyasn1.type import univ 19 20from pyasn1_modules import rfc5652 21 22MAX = float('inf') 23 24 25# Content Collection Content Type and Object Identifier 26 27id_ct_contentCollection = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.19') 28 29class ContentCollection(univ.SequenceOf): 30 pass 31 32ContentCollection.componentType = rfc5652.ContentInfo() 33ContentCollection.sizeSpec = constraint.ValueSizeConstraint(1, MAX) 34 35 36# Content With Attributes Content Type and Object Identifier 37 38id_ct_contentWithAttrs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.20') 39 40class ContentWithAttributes(univ.Sequence): 41 pass 42 43ContentWithAttributes.componentType = namedtype.NamedTypes( 44 namedtype.NamedType('content', rfc5652.ContentInfo()), 45 namedtype.NamedType('attrs', univ.SequenceOf( 46 componentType=rfc5652.Attribute()).subtype( 47 sizeSpec=constraint.ValueSizeConstraint(1, MAX))) 48) 49 50 51# Map of Content Type OIDs to Content Types is added to the 52# ones that are in rfc5652.py 53 54_cmsContentTypesMapUpdate = { 55 id_ct_contentCollection: ContentCollection(), 56 id_ct_contentWithAttrs: ContentWithAttributes(), 57} 58 59rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate) 60