codekingpro/portable-devtools
114k
1# This file is being contributed to of pyasn1-modules software.2#3# Created by Russ Housley without assistance from the asn1ate tool.4# Modified by Russ Housley to add a map for use with opentypes and5# simplify the code for the object identifier assignment.6#7# Copyright (c) 2018, 2019 Vigil Security, LLC8# License: http://snmplabs.com/pyasn1/license.html9#10# Authenticated-Enveloped-Data for the Cryptographic Message Syntax (CMS)11#12# ASN.1 source from:13# https://www.rfc-editor.org/rfc/rfc5083.txt14 15from pyasn1.type import namedtype16from pyasn1.type import tag17from pyasn1.type import univ18 19from pyasn1_modules import rfc565220 21MAX = float('inf')22 23 24# CMS Authenticated-Enveloped-Data Content Type25 26id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23')27 28class AuthEnvelopedData(univ.Sequence):29 pass30 31AuthEnvelopedData.componentType = namedtype.NamedTypes(32 namedtype.NamedType('version', rfc5652.CMSVersion()),33 namedtype.OptionalNamedType('originatorInfo', rfc5652.OriginatorInfo().subtype(34 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),35 namedtype.NamedType('recipientInfos', rfc5652.RecipientInfos()),36 namedtype.NamedType('authEncryptedContentInfo', rfc5652.EncryptedContentInfo()),37 namedtype.OptionalNamedType('authAttrs', rfc5652.AuthAttributes().subtype(38 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),39 namedtype.NamedType('mac', rfc5652.MessageAuthenticationCode()),40 namedtype.OptionalNamedType('unauthAttrs', rfc5652.UnauthAttributes().subtype(41 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))42)43 44 45# Map of Content Type OIDs to Content Types is added to the46# ones that are in rfc5652.py47 48_cmsContentTypesMapUpdate = {49 id_ct_authEnvelopedData: AuthEnvelopedData(),50}51 52rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)53 