rfc3820.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # Diffie-Hellman Key Agreement
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc3820.txt
  13. #
  14. from pyasn1.type import namedtype
  15. from pyasn1.type import univ
  16. from pyasn1_modules import rfc5280
  17. class ProxyCertPathLengthConstraint(univ.Integer):
  18. pass
  19. class ProxyPolicy(univ.Sequence):
  20. componentType = namedtype.NamedTypes(
  21. namedtype.NamedType('policyLanguage', univ.ObjectIdentifier()),
  22. namedtype.OptionalNamedType('policy', univ.OctetString())
  23. )
  24. class ProxyCertInfoExtension(univ.Sequence):
  25. componentType = namedtype.NamedTypes(
  26. namedtype.OptionalNamedType('pCPathLenConstraint',
  27. ProxyCertPathLengthConstraint()),
  28. namedtype.NamedType('proxyPolicy', ProxyPolicy())
  29. )
  30. id_pkix = univ.ObjectIdentifier((1, 3, 6, 1, 5, 5, 7, ))
  31. id_pe = id_pkix + (1, )
  32. id_pe_proxyCertInfo = id_pe + (14, )
  33. id_ppl = id_pkix + (21, )
  34. id_ppl_anyLanguage = id_ppl + (0, )
  35. id_ppl_inheritAll = id_ppl + (1, )
  36. id_ppl_independent = id_ppl + (2, )
  37. # Map of Certificate Extension OIDs to Extensions added to the
  38. # ones that are in rfc5280.py
  39. _certificateExtensionsMapUpdate = {
  40. id_pe_proxyCertInfo: ProxyCertInfoExtension(),
  41. }
  42. rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)