Alex Gaynor | 77ae0cd | 2016-03-05 14:07:34 -0500 | [diff] [blame^] | 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 | |
| 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 | |
| 11 | |
| 12 | @utils.register_interface(CipherAlgorithm) |
| 13 | class DummyCipherAlgorithm(object): |
| 14 | name = "dummy-cipher" |
| 15 | block_size = 128 |
| 16 | key_size = None |
| 17 | |
| 18 | |
| 19 | @utils.register_interface(Mode) |
| 20 | class DummyMode(object): |
| 21 | name = "dummy-mode" |
| 22 | |
| 23 | def validate_for_algorithm(self, algorithm): |
| 24 | pass |
| 25 | |
| 26 | |
| 27 | @utils.register_interface(hashes.HashAlgorithm) |
| 28 | class DummyHashAlgorithm(object): |
| 29 | name = "dummy-hash" |
| 30 | block_size = None |
| 31 | digest_size = None |
| 32 | |
| 33 | |
| 34 | @utils.register_interface(serialization.KeySerializationEncryption) |
| 35 | class DummyKeySerializationEncryption(object): |
| 36 | pass |
| 37 | |
| 38 | |
| 39 | @utils.register_interface(padding.AsymmetricPadding) |
| 40 | class DummyAsymmetricPadding(object): |
| 41 | name = "dummy-padding" |