aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/__init__.py4
-rw-r--r--cryptography/hazmat/backends/multibackend.py2
-rw-r--r--docs/hazmat/backends/multibackend.rst14
-rw-r--r--tests/hazmat/backends/test_multibackend.py12
4 files changed, 23 insertions, 9 deletions
diff --git a/cryptography/hazmat/backends/__init__.py b/cryptography/hazmat/backends/__init__.py
index 0818033f..41d260a8 100644
--- a/cryptography/hazmat/backends/__init__.py
+++ b/cryptography/hazmat/backends/__init__.py
@@ -12,7 +12,7 @@
# limitations under the License.
from cryptography.hazmat.backends import openssl
-from cryptography.hazmat.backends.multibackend import PrioritizedMultiBackend
+from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.bindings.commoncrypto.binding import (
Binding as CommonCryptoBinding
)
@@ -24,7 +24,7 @@ if CommonCryptoBinding.is_available():
_ALL_BACKENDS.append(commoncrypto.backend)
-_default_backend = PrioritizedMultiBackend(_ALL_BACKENDS)
+_default_backend = MultiBackend(_ALL_BACKENDS)
def default_backend():
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py
index 94152370..49a4014d 100644
--- a/cryptography/hazmat/backends/multibackend.py
+++ b/cryptography/hazmat/backends/multibackend.py
@@ -24,7 +24,7 @@ from cryptography.hazmat.backends.interfaces import (
@utils.register_interface(HashBackend)
@utils.register_interface(HMACBackend)
@utils.register_interface(PBKDF2HMACBackend)
-class PrioritizedMultiBackend(object):
+class MultiBackend(object):
name = "multibackend"
def __init__(self, backends):
diff --git a/docs/hazmat/backends/multibackend.rst b/docs/hazmat/backends/multibackend.rst
new file mode 100644
index 00000000..23e6d48f
--- /dev/null
+++ b/docs/hazmat/backends/multibackend.rst
@@ -0,0 +1,14 @@
+.. hazmat::
+
+MultiBackend
+============
+
+.. currentmodule:: cryptography.hazmat.backends.multibackend
+
+.. class:: MultiBackend(backends)
+
+ This class allows you to combine multiple backends into a single backend
+ which offers the combined features of all of its constituents.
+
+ :param backends: A ``list`` of backend objects. Backends are checked for
+ feature support in the other they exist in this list.
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index f77d2680..ca21c9fc 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -18,7 +18,7 @@ from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.backends.interfaces import (
CipherBackend, HashBackend, HMACBackend, PBKDF2HMACBackend
)
-from cryptography.hazmat.backends.multibackend import PrioritizedMultiBackend
+from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.primitives import hashes, hmac
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
@@ -80,9 +80,9 @@ class DummyPBKDF2HMAC(object):
raise UnsupportedAlgorithm
-class TestPrioritizedMultiBackend(object):
+class TestMultiBackend(object):
def test_ciphers(self):
- backend = PrioritizedMultiBackend([
+ backend = MultiBackend([
DummyHashBackend([]),
DummyCipherBackend([
(algorithms.AES, modes.CBC),
@@ -111,7 +111,7 @@ class TestPrioritizedMultiBackend(object):
cipher.decryptor()
def test_hashes(self):
- backend = PrioritizedMultiBackend([
+ backend = MultiBackend([
DummyHashBackend([hashes.MD5])
])
assert backend.hash_supported(hashes.MD5())
@@ -122,7 +122,7 @@ class TestPrioritizedMultiBackend(object):
hashes.Hash(hashes.SHA1(), backend=backend)
def test_hmac(self):
- backend = PrioritizedMultiBackend([
+ backend = MultiBackend([
DummyHMACBackend([hashes.MD5])
])
assert backend.hmac_supported(hashes.MD5())
@@ -133,7 +133,7 @@ class TestPrioritizedMultiBackend(object):
hmac.HMAC(b"", hashes.SHA1(), backend=backend)
def test_pbkdf2(self):
- backend = PrioritizedMultiBackend([
+ backend = MultiBackend([
DummyPBKDF2HMAC([hashes.MD5])
])
assert backend.pbkdf2_hmac_supported(hashes.MD5())