rfc5752.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. # Multiple Signatures in Cryptographic Message Syntax (CMS)
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc5752.txt
  13. # https://www.rfc-editor.org/errata/eid4444
  14. #
  15. from pyasn1.type import namedtype
  16. from pyasn1.type import univ
  17. from pyasn1_modules import rfc5035
  18. from pyasn1_modules import rfc5652
  19. class SignAttrsHash(univ.Sequence):
  20. componentType = namedtype.NamedTypes(
  21. namedtype.NamedType('algID', rfc5652.DigestAlgorithmIdentifier()),
  22. namedtype.NamedType('hash', univ.OctetString())
  23. )
  24. class MultipleSignatures(univ.Sequence):
  25. componentType = namedtype.NamedTypes(
  26. namedtype.NamedType('bodyHashAlg', rfc5652.DigestAlgorithmIdentifier()),
  27. namedtype.NamedType('signAlg', rfc5652.SignatureAlgorithmIdentifier()),
  28. namedtype.NamedType('signAttrsHash', SignAttrsHash()),
  29. namedtype.OptionalNamedType('cert', rfc5035.ESSCertIDv2())
  30. )
  31. id_aa_multipleSignatures = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.51')
  32. # Map of Attribute Type OIDs to Attributes added to the
  33. # ones that are in rfc5652.py
  34. _cmsAttributesMapUpdate = {
  35. id_aa_multipleSignatures: MultipleSignatures(),
  36. }
  37. rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)