blob: 119b13ae8b68768476aff4f54bfca1310f1fe783 [file] [log] [blame]
Alex Gaynor450bb4c2014-02-03 15:42:04 -08001.. hazmat::
2
3MultiBackend
4============
5
6.. currentmodule:: cryptography.hazmat.backends.multibackend
7
8.. class:: MultiBackend(backends)
9
Alex Gaynordb809542014-02-03 16:19:32 -080010 .. versionadded:: 0.2
11
Alex Gaynor450bb4c2014-02-03 15:42:04 -080012 This class allows you to combine multiple backends into a single backend
Alex Stapleton63b3de22014-02-08 09:43:16 +000013 that offers the combined features of all of its constituents.
Alex Gaynor450bb4c2014-02-03 15:42:04 -080014
Alex Gaynor55988502014-02-03 16:15:06 -080015 .. 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 Gaynor1fb45242014-02-03 16:53:35 -080021 >>> backend2.hash_supported(hashes.SHA256())
Alex Gaynor55988502014-02-03 16:15:06 -080022 True
23 >>> multi_backend = MultiBackend([backend1, backend2])
Alex Gaynor1fb45242014-02-03 16:53:35 -080024 >>> multi_backend.hash_supported(hashes.SHA256())
Alex Gaynor55988502014-02-03 16:15:06 -080025 True
26
Alex Gaynor450bb4c2014-02-03 15:42:04 -080027 :param backends: A ``list`` of backend objects. Backends are checked for
Alex Gaynor2b1752e2014-02-03 16:11:23 -080028 feature support in the order they appear in this list.