You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rfc8398.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. # Internationalized Email Addresses in X.509 Certificates
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc8398.txt
  13. # https://www.rfc-editor.org/errata/eid5418
  14. #
  15. from pyasn1.type import char
  16. from pyasn1.type import constraint
  17. from pyasn1.type import univ
  18. from pyasn1_modules import rfc5280
  19. MAX = float('inf')
  20. # SmtpUTF8Mailbox contains Mailbox as specified in Section 3.3 of RFC 6531
  21. id_pkix = rfc5280.id_pkix
  22. id_on = id_pkix + (8, )
  23. id_on_SmtpUTF8Mailbox = id_on + (9, )
  24. class SmtpUTF8Mailbox(char.UTF8String):
  25. pass
  26. SmtpUTF8Mailbox.subtypeSpec = constraint.ValueSizeConstraint(1, MAX)
  27. on_SmtpUTF8Mailbox = rfc5280.AnotherName()
  28. on_SmtpUTF8Mailbox['type-id'] = id_on_SmtpUTF8Mailbox
  29. on_SmtpUTF8Mailbox['value'] = SmtpUTF8Mailbox()
  30. # Map of Other Name OIDs to Other Name is added to the
  31. # ones that are in rfc5280.py
  32. _anotherNameMapUpdate = {
  33. id_on_SmtpUTF8Mailbox: SmtpUTF8Mailbox(),
  34. }
  35. rfc5280.anotherNameMap.update(_anotherNameMapUpdate)