rfc3657.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. # Camellia Algorithm in CMS
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc3657.txt
  13. #
  14. from pyasn1.type import constraint
  15. from pyasn1.type import univ
  16. from pyasn1_modules import rfc5280
  17. from pyasn1_modules import rfc5751
  18. id_camellia128_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.2')
  19. id_camellia192_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.3')
  20. id_camellia256_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.4')
  21. id_camellia128_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.2')
  22. id_camellia192_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.3')
  23. id_camellia256_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.4')
  24. class Camellia_IV(univ.OctetString):
  25. subtypeSpec = constraint.ValueSizeConstraint(16, 16)
  26. class CamelliaSMimeCapability(univ.Null):
  27. pass
  28. # Update the Algorithm Identifier map in rfc5280.py.
  29. _algorithmIdentifierMapUpdate = {
  30. id_camellia128_cbc: Camellia_IV(),
  31. id_camellia192_cbc: Camellia_IV(),
  32. id_camellia256_cbc: Camellia_IV(),
  33. }
  34. rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
  35. # Update the SMIMECapabilities Attribute map in rfc5751.py
  36. _smimeCapabilityMapUpdate = {
  37. id_camellia128_cbc: CamelliaSMimeCapability(),
  38. id_camellia192_cbc: CamelliaSMimeCapability(),
  39. id_camellia256_cbc: CamelliaSMimeCapability(),
  40. id_camellia128_wrap: CamelliaSMimeCapability(),
  41. id_camellia192_wrap: CamelliaSMimeCapability(),
  42. id_camellia256_wrap: CamelliaSMimeCapability(),
  43. }
  44. rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)