rfc7773.py 1.3 KB

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. # Authentication Context Certificate Extension
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc7773.txt
  13. #
  14. from pyasn1.type import char
  15. from pyasn1.type import constraint
  16. from pyasn1.type import namedtype
  17. from pyasn1.type import univ
  18. from pyasn1_modules import rfc5280
  19. MAX = float('inf')
  20. # Authentication Context Extension
  21. e_legnamnden = univ.ObjectIdentifier('1.2.752.201')
  22. id_eleg_ce = e_legnamnden + (5, )
  23. id_ce_authContext = id_eleg_ce + (1, )
  24. class AuthenticationContext(univ.Sequence):
  25. componentType = namedtype.NamedTypes(
  26. namedtype.NamedType('contextType', char.UTF8String()),
  27. namedtype.OptionalNamedType('contextInfo', char.UTF8String())
  28. )
  29. class AuthenticationContexts(univ.SequenceOf):
  30. componentType = AuthenticationContext()
  31. subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
  32. # Map of Certificate Extension OIDs to Extensions added to the
  33. # ones that are in rfc5280.py
  34. _certificateExtensionsMapUpdate = {
  35. id_ce_authContext: AuthenticationContexts(),
  36. }
  37. rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)