rfc5083.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 and
  5. # simplify the code for the object identifier assignment.
  6. #
  7. # Copyright (c) 2018, 2019 Vigil Security, LLC
  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. from pyasn1.type import namedtype
  15. from pyasn1.type import tag
  16. from pyasn1.type import univ
  17. from pyasn1_modules import rfc5652
  18. MAX = float('inf')
  19. # CMS Authenticated-Enveloped-Data Content Type
  20. id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23')
  21. class AuthEnvelopedData(univ.Sequence):
  22. pass
  23. AuthEnvelopedData.componentType = namedtype.NamedTypes(
  24. namedtype.NamedType('version', rfc5652.CMSVersion()),
  25. namedtype.OptionalNamedType('originatorInfo', rfc5652.OriginatorInfo().subtype(
  26. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
  27. namedtype.NamedType('recipientInfos', rfc5652.RecipientInfos()),
  28. namedtype.NamedType('authEncryptedContentInfo', rfc5652.EncryptedContentInfo()),
  29. namedtype.OptionalNamedType('authAttrs', rfc5652.AuthAttributes().subtype(
  30. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
  31. namedtype.NamedType('mac', rfc5652.MessageAuthenticationCode()),
  32. namedtype.OptionalNamedType('unauthAttrs', rfc5652.UnauthAttributes().subtype(
  33. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
  34. )
  35. # Map of Content Type OIDs to Content Types is added to the
  36. # ones that are in rfc5652.py
  37. _cmsContentTypesMapUpdate = {
  38. id_ct_authEnvelopedData: AuthEnvelopedData(),
  39. }
  40. rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)