aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/multibackend.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py
index 9b91ff45..210efbe8 100644
--- a/cryptography/hazmat/backends/multibackend.py
+++ b/cryptography/hazmat/backends/multibackend.py
@@ -15,10 +15,11 @@ from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import UnsupportedAlgorithm
-from cryptography.hazmat.backends.interfaces import CipherBackend
+from cryptography.hazmat.backends.interfaces import CipherBackend, HashBackend
@utils.register_interface(CipherBackend)
+@utils.register_interface(HashBackend)
class PrioritizedMultiBackend(object):
name = "multibackend"
@@ -43,3 +44,14 @@ class PrioritizedMultiBackend(object):
except UnsupportedAlgorithm:
pass
raise UnsupportedAlgorithm
+
+ def hash_supported(self, algorithm):
+ return any(b.hash_supported(algorithm) for b in self._backends)
+
+ def create_hash_ctx(self, algorithm):
+ for b in self._backends:
+ try:
+ return b.create_hash_ctx(algorithm)
+ except UnsupportedAlgorithm:
+ pass
+ raise UnsupportedAlgorithm