rfc4010.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # SEED Encryption Algorithm in CMS
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc4010.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_seedCBC = univ.ObjectIdentifier('1.2.410.200004.1.4')
  19. id_npki_app_cmsSeed_wrap = univ.ObjectIdentifier('1.2.410.200004.7.1.1.1')
  20. class SeedIV(univ.OctetString):
  21. subtypeSpec = constraint.ValueSizeConstraint(16, 16)
  22. class SeedCBCParameter(SeedIV):
  23. pass
  24. class SeedSMimeCapability(univ.Null):
  25. pass
  26. # Update the Algorithm Identifier map in rfc5280.py.
  27. _algorithmIdentifierMapUpdate = {
  28. id_seedCBC: SeedCBCParameter(),
  29. id_npki_app_cmsSeed_wrap: univ.Null(""),
  30. }
  31. rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
  32. # Update the SMIMECapabilities Attribute map in rfc5751.py
  33. _smimeCapabilityMapUpdate = {
  34. id_seedCBC: SeedSMimeCapability(),
  35. id_npki_app_cmsSeed_wrap: SeedSMimeCapability(),
  36. }
  37. rfc5751.smimeCapabilityMap.update(_smimeCapabilityMapUpdate)