rfc5940.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # Modified by Russ Housley to add map for use with opentypes.
  6. #
  7. # Copyright (c) 2019, Vigil Security, LLC
  8. # License: http://snmplabs.com/pyasn1/license.html
  9. #
  10. # Additional CMS Revocation Information Choices
  11. #
  12. # ASN.1 source from:
  13. # https://www.rfc-editor.org/rfc/rfc5940.txt
  14. #
  15. from pyasn1.type import namedtype
  16. from pyasn1.type import tag
  17. from pyasn1.type import univ
  18. from pyasn1_modules import rfc2560
  19. from pyasn1_modules import rfc5652
  20. # RevocationInfoChoice for OCSP response:
  21. # The OID is included in otherRevInfoFormat, and
  22. # signed OCSPResponse is included in otherRevInfo
  23. id_ri_ocsp_response = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.2')
  24. OCSPResponse = rfc2560.OCSPResponse
  25. # RevocationInfoChoice for SCVP request/response:
  26. # The OID is included in otherRevInfoFormat, and
  27. # SCVPReqRes is included in otherRevInfo
  28. id_ri_scvp = univ.ObjectIdentifier('1.3.6.1.5.5.7.16.4')
  29. ContentInfo = rfc5652.ContentInfo
  30. class SCVPReqRes(univ.Sequence):
  31. pass
  32. SCVPReqRes.componentType = namedtype.NamedTypes(
  33. namedtype.OptionalNamedType('request',
  34. ContentInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  35. namedtype.NamedType('response', ContentInfo())
  36. )
  37. # Map of Revocation Info Format OIDs to Revocation Info Format
  38. # is added to the ones that are in rfc5652.py
  39. _otherRevInfoFormatMapUpdate = {
  40. id_ri_ocsp_response: OCSPResponse(),
  41. id_ri_scvp: SCVPReqRes(),
  42. }
  43. rfc5652.otherRevInfoFormatMap.update(_otherRevInfoFormatMapUpdate)