Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 1 | # This file is being contributed to of pyasn1-modules software. |
| 2 | # |
| 3 | # Created by Russ Housley without assistance from the asn1ate tool. |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 4 | # Modified by Russ Housley to add a map for use with opentypes and |
| 5 | # simplify the code for the object identifier assignment. |
| 6 | # |
| 7 | # Copyright (c) 2018, 2019 Vigil Security, LLC |
Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 8 | # License: http://snmplabs.com/pyasn1/license.html |
| 9 | # |
| 10 | # Authenticated-Enveloped-Data for the Cryptographic Message Syntax (CMS) |
| 11 | # |
| 12 | # ASN.1 source from: |
| 13 | # https://www.rfc-editor.org/rfc/rfc5083.txt |
| 14 | |
Ilya Etingof | 3d59f9a | 2019-04-25 08:36:39 +0200 | [diff] [blame] | 15 | from pyasn1.type import namedtype |
| 16 | from pyasn1.type import tag |
| 17 | from pyasn1.type import univ |
Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 18 | |
Ilya Etingof | 3d59f9a | 2019-04-25 08:36:39 +0200 | [diff] [blame] | 19 | from pyasn1_modules import rfc5652 |
Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 20 | |
| 21 | MAX = float('inf') |
| 22 | |
| 23 | |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 24 | # CMS Authenticated-Enveloped-Data Content Type |
Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 25 | |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 26 | id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23') |
Russ Housley | e397e97 | 2018-12-28 12:46:09 -0500 | [diff] [blame] | 27 | |
| 28 | class AuthEnvelopedData(univ.Sequence): |
| 29 | pass |
| 30 | |
| 31 | AuthEnvelopedData.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 | ) |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 43 | |
| 44 | |
Russ Housley | 15bc779 | 2019-09-08 09:41:53 -0400 | [diff] [blame] | 45 | # Map of Content Type OIDs to Content Types is added to the |
| 46 | # ones that are in rfc5652.py |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 47 | |
Russ Housley | 15bc779 | 2019-09-08 09:41:53 -0400 | [diff] [blame] | 48 | _cmsContentTypesMapUpdate = { |
Russ Housley | 23608be | 2019-07-20 06:58:55 -0400 | [diff] [blame] | 49 | id_ct_authEnvelopedData: AuthEnvelopedData(), |
Russ Housley | 15bc779 | 2019-09-08 09:41:53 -0400 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate) |