doubles.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. from __future__ import absolute_import, division, print_function
  5. from cryptography import utils
  6. from cryptography.hazmat.primitives import hashes, serialization
  7. from cryptography.hazmat.primitives.asymmetric import padding
  8. from cryptography.hazmat.primitives.ciphers import CipherAlgorithm
  9. from cryptography.hazmat.primitives.ciphers.modes import Mode
  10. @utils.register_interface(CipherAlgorithm)
  11. class DummyCipherAlgorithm(object):
  12. name = "dummy-cipher"
  13. block_size = 128
  14. key_size = None
  15. @utils.register_interface(Mode)
  16. class DummyMode(object):
  17. name = "dummy-mode"
  18. def validate_for_algorithm(self, algorithm):
  19. pass
  20. @utils.register_interface(hashes.HashAlgorithm)
  21. class DummyHashAlgorithm(object):
  22. name = "dummy-hash"
  23. block_size = None
  24. digest_size = None
  25. @utils.register_interface(serialization.KeySerializationEncryption)
  26. class DummyKeySerializationEncryption(object):
  27. pass
  28. @utils.register_interface(padding.AsymmetricPadding)
  29. class DummyAsymmetricPadding(object):
  30. name = "dummy-padding"