__init__.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # -*- coding: utf-8 -*-
  2. #
  3. # SelfTest/PublicKey/__init__.py: Self-test for public key crypto
  4. #
  5. # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
  6. #
  7. # ===================================================================
  8. # The contents of this file are dedicated to the public domain. To
  9. # the extent that dedication to the public domain is not available,
  10. # everyone is granted a worldwide, perpetual, royalty-free,
  11. # non-exclusive license to exercise all rights associated with the
  12. # contents of this file for any purpose whatsoever.
  13. # No rights are reserved.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  19. # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  20. # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. # SOFTWARE.
  23. # ===================================================================
  24. """Self-test for public-key crypto"""
  25. import unittest
  26. from Crypto.SelfTest.PublicKey import (test_DSA, test_RSA,
  27. test_ECC_NIST,
  28. test_ECC_Ed25519,
  29. test_ECC_Curve25519,
  30. test_ECC_Ed448,
  31. test_ECC_Curve448,
  32. test_import_DSA, test_import_RSA,
  33. test_import_ECC, test_ElGamal,
  34. test_import_Curve25519,
  35. test_import_Curve448)
  36. def get_tests(config={}):
  37. tests = []
  38. tests += test_DSA.get_tests(config=config)
  39. tests += test_RSA.get_tests(config=config)
  40. tests += test_ECC_NIST.get_tests(config=config)
  41. tests += test_ECC_Ed25519.get_tests(config=config)
  42. tests += test_ECC_Curve25519.get_tests(config=config)
  43. tests += test_ECC_Ed448.get_tests(config=config)
  44. tests += test_ECC_Curve448.get_tests(config=config)
  45. tests += test_import_DSA.get_tests(config=config)
  46. tests += test_import_RSA.get_tests(config=config)
  47. tests += test_import_ECC.get_tests(config=config)
  48. tests += test_import_Curve25519.get_tests(config=config)
  49. tests += test_import_Curve448.get_tests(config=config)
  50. tests += test_ElGamal.get_tests(config=config)
  51. return tests
  52. if __name__ == '__main__':
  53. def suite():
  54. return unittest.TestSuite(get_tests())
  55. unittest.main(defaultTest='suite')