Debian Codegraph @

third_party/python/pyasn1_modules/pyasn1_modules/rfc6032.py

raw
1 #
2 # This file is part of pyasn1-modules software.
3 #
4 # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5 #
6 # Copyright (c) 2019, Vigil Security, LLC
7 # License: http://snmplabs.com/pyasn1/license.html
8 #
9 # CMS Encrypted Key Package Content Type
10 #
11 # ASN.1 source from:
12 # https://www.rfc-editor.org/rfc/rfc6032.txt
13 #
14
15 from pyasn1.type import namedtype
16 from pyasn1.type import tag
17 from pyasn1.type import univ
18
19 from pyasn1_modules import rfc5652
20 from pyasn1_modules import rfc5083
21
22
23 # Content Decryption Key Identifier attribute
24
25 id_aa_KP_contentDecryptKeyID = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.66')
26
27 class ContentDecryptKeyID(univ.OctetString):
28 pass
29
30 aa_content_decrypt_key_identifier = rfc5652.Attribute()
31 aa_content_decrypt_key_identifier['attrType'] = id_aa_KP_contentDecryptKeyID
32 aa_content_decrypt_key_identifier['attrValues'][0] = ContentDecryptKeyID()
33
34
35 # Encrypted Key Package Content Type
36
37 id_ct_KP_encryptedKeyPkg = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.2')
38
39 class EncryptedKeyPackage(univ.Choice):
40 pass
41
42 EncryptedKeyPackage.componentType = namedtype.NamedTypes(
43 namedtype.NamedType('encrypted', rfc5652.EncryptedData()),
44 namedtype.NamedType('enveloped', rfc5652.EnvelopedData().subtype(
45 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
46 namedtype.NamedType('authEnveloped', rfc5083.AuthEnvelopedData().subtype(
47 implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
48 )
49
50
51 # Map of Attribute Type OIDs to Attributes are
52 # added to the ones that are in rfc5652.py
53
54 _cmsAttributesMapUpdate = {
55 id_aa_KP_contentDecryptKeyID: ContentDecryptKeyID(),
56 }
57
58 rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)
59
60
61 # Map of Content Type OIDs to Content Types are
62 # added to the ones that are in rfc5652.py
63
64 _cmsContentTypesMapUpdate = {
65 id_ct_KP_encryptedKeyPkg: EncryptedKeyPackage(),
66 }
67
68 rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)