rfc7585.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #
  2. # This file is part of pyasn1-modules software.
  3. #
  4. # Created by Russ Housley with some 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. # Network Access Identifier (NAI) Realm Name for Certificates
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc7585.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. # NAI Realm Name for Certificates
  19. id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
  20. id_on = id_pkix + (8, )
  21. id_on_naiRealm = id_on + (8, )
  22. ub_naiRealm_length = univ.Integer(255)
  23. class NAIRealm(char.UTF8String):
  24. subtypeSpec = constraint.ValueSizeConstraint(1, ub_naiRealm_length)
  25. naiRealm = rfc5280.AnotherName()
  26. naiRealm['type-id'] = id_on_naiRealm
  27. naiRealm['value'] = NAIRealm()
  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_naiRealm: NAIRealm(),
  32. }
  33. rfc5280.anotherNameMap.update(_anotherNameMapUpdate)