rfc4985.py 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # This file is part of pyasn1-modules software.
  3. #
  4. # Created by Russ Housley.
  5. #
  6. # Copyright (c) 2019, Vigil Security, LLC
  7. # License: http://snmplabs.com/pyasn1/license.html
  8. #
  9. # Expression of Service Names in X.509 Certificates
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc4985.txt
  13. #
  14. from pyasn1.type import char
  15. from pyasn1.type import constraint
  16. from pyasn1.type import univ
  17. from pyasn1_modules import rfc5280
  18. MAX = float('inf')
  19. # As specified in Appendix A.2 of RFC 4985
  20. id_pkix = rfc5280.id_pkix
  21. id_on = id_pkix + (8, )
  22. id_on_dnsSRV = id_on + (7, )
  23. class SRVName(char.IA5String):
  24. subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
  25. srvName = rfc5280.AnotherName()
  26. srvName['type-id'] = id_on_dnsSRV
  27. srvName['value'] = SRVName()
  28. # Map of Other Name OIDs to Other Name is added to the
  29. # ones that are in rfc5280.py
  30. _anotherNameMapUpdate = {
  31. id_on_dnsSRV: SRVName(),
  32. }
  33. rfc5280.anotherNameMap.update(_anotherNameMapUpdate)