add multibackend support for new DSABackend method
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py
index 27ab063..800c350 100644
--- a/cryptography/hazmat/backends/multibackend.py
+++ b/cryptography/hazmat/backends/multibackend.py
@@ -205,6 +205,12 @@
raise UnsupportedAlgorithm("DSA is not supported by the backend.",
_Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM)
+ def generate_dsa_private_key_and_parameters(self, key_size):
+ for b in self._filtered_backends(DSABackend):
+ return b.generate_dsa_private_key_and_parameters(key_size)
+ raise UnsupportedAlgorithm("DSA is not supported by the backend.",
+ _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM)
+
def create_dsa_verification_ctx(self, public_key, signature, algorithm):
for b in self._filtered_backends(DSABackend):
return b.create_dsa_verification_ctx(public_key, signature,
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index 64dc062..a68fe56 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -128,6 +128,9 @@
def generate_dsa_private_key(self, parameters):
pass
+ def generate_dsa_private_key_and_parameters(self, key_size):
+ pass
+
def create_dsa_signature_ctx(self, private_key, algorithm):
pass
@@ -343,6 +346,7 @@
parameters = object()
backend.generate_dsa_private_key(parameters)
+ backend.generate_dsa_private_key_and_parameters(key_size=1024)
backend.create_dsa_verification_ctx("public_key", "sig", hashes.SHA1())
backend.create_dsa_signature_ctx("private_key", hashes.SHA1())
@@ -363,6 +367,11 @@
with raises_unsupported_algorithm(
_Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM
):
+ backend.generate_dsa_private_key_and_parameters(key_size=1024)
+
+ with raises_unsupported_algorithm(
+ _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM
+ ):
backend.create_dsa_signature_ctx("private_key", hashes.SHA1())
with raises_unsupported_algorithm(