rfc7030.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. # Enrollment over Secure Transport (EST)
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc7030.txt
  13. #
  14. from pyasn1.type import constraint
  15. from pyasn1.type import namedtype
  16. from pyasn1.type import univ
  17. from pyasn1_modules import rfc5652
  18. MAX = float('inf')
  19. # Imports from RFC 5652
  20. Attribute = rfc5652.Attribute
  21. # Asymmetric Decrypt Key Identifier Attribute
  22. id_aa_asymmDecryptKeyID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.54')
  23. class AsymmetricDecryptKeyIdentifier(univ.OctetString):
  24. pass
  25. aa_asymmDecryptKeyID = Attribute()
  26. aa_asymmDecryptKeyID['attrType'] = id_aa_asymmDecryptKeyID
  27. aa_asymmDecryptKeyID['attrValues'][0] = AsymmetricDecryptKeyIdentifier()
  28. # CSR Attributes
  29. class AttrOrOID(univ.Choice):
  30. pass
  31. AttrOrOID.componentType = namedtype.NamedTypes(
  32. namedtype.NamedType('oid', univ.ObjectIdentifier()),
  33. namedtype.NamedType('attribute', Attribute())
  34. )
  35. class CsrAttrs(univ.SequenceOf):
  36. pass
  37. CsrAttrs.componentType = AttrOrOID()
  38. CsrAttrs.subtypeSpec=constraint.ValueSizeConstraint(0, MAX)
  39. # Update CMS Attribute Map
  40. _cmsAttributesMapUpdate = {
  41. id_aa_asymmDecryptKeyID: AsymmetricDecryptKeyIdentifier(),
  42. }
  43. rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)