Alex Gaynor | 450bb4c | 2014-02-03 15:42:04 -0800 | [diff] [blame] | 1 | .. hazmat:: |
| 2 | |
| 3 | MultiBackend |
| 4 | ============ |
| 5 | |
| 6 | .. currentmodule:: cryptography.hazmat.backends.multibackend |
| 7 | |
| 8 | .. class:: MultiBackend(backends) |
| 9 | |
Alex Gaynor | db80954 | 2014-02-03 16:19:32 -0800 | [diff] [blame] | 10 | .. versionadded:: 0.2 |
| 11 | |
Alex Gaynor | 450bb4c | 2014-02-03 15:42:04 -0800 | [diff] [blame] | 12 | This class allows you to combine multiple backends into a single backend |
| 13 | which offers the combined features of all of its constituents. |
| 14 | |
Alex Gaynor | 5598850 | 2014-02-03 16:15:06 -0800 | [diff] [blame] | 15 | .. code-block:: pycon |
| 16 | |
| 17 | >>> from cryptography.hazmat.backends.multibackend import MultiBackend |
| 18 | >>> from cryptography.hazmat.primitives import hashes |
| 19 | >>> backend1.hash_supported(hashes.SHA256()) |
| 20 | False |
Alex Gaynor | 1fb4524 | 2014-02-03 16:53:35 -0800 | [diff] [blame^] | 21 | >>> backend2.hash_supported(hashes.SHA256()) |
Alex Gaynor | 5598850 | 2014-02-03 16:15:06 -0800 | [diff] [blame] | 22 | True |
| 23 | >>> multi_backend = MultiBackend([backend1, backend2]) |
Alex Gaynor | 1fb4524 | 2014-02-03 16:53:35 -0800 | [diff] [blame^] | 24 | >>> multi_backend.hash_supported(hashes.SHA256()) |
Alex Gaynor | 5598850 | 2014-02-03 16:15:06 -0800 | [diff] [blame] | 25 | True |
| 26 | |
Alex Gaynor | 450bb4c | 2014-02-03 15:42:04 -0800 | [diff] [blame] | 27 | :param backends: A ``list`` of backend objects. Backends are checked for |
Alex Gaynor | 2b1752e | 2014-02-03 16:11:23 -0800 | [diff] [blame] | 28 | feature support in the order they appear in this list. |