diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-21 11:28:19 -0700 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-21 11:28:19 -0700 |
commit | 6eed9d0f3d1eb36ff5a834ff52e06c80cbde0681 (patch) | |
tree | 3376de086478f0940c27557ea3c13bb4df39c30f | |
parent | 126afca70edc3fac2e493c6b7cd05219c8d8e373 (diff) | |
download | cryptography-6eed9d0f3d1eb36ff5a834ff52e06c80cbde0681.tar.gz cryptography-6eed9d0f3d1eb36ff5a834ff52e06c80cbde0681.tar.bz2 cryptography-6eed9d0f3d1eb36ff5a834ff52e06c80cbde0681.zip |
add load_dsa_parameter_numbers on multibackend
-rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 6 | ||||
-rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index db189787..e873f504 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -210,6 +210,12 @@ class MultiBackend(object): raise UnsupportedAlgorithm("DSA is not supported by the backend.", _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + def load_dsa_parameter_numbers(self, numbers): + for b in self._filtered_backends(DSABackend): + return b.load_dsa_parameter_numbers(numbers) + raise UnsupportedAlgorithm("DSA is not supported by the backend.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + def cmac_algorithm_supported(self, algorithm): return any( b.cmac_algorithm_supported(algorithm) diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index 93934ad6..c50b6cf6 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -131,6 +131,9 @@ class DummyDSABackend(object): def load_dsa_public_numbers(self, numbers): pass + def load_dsa_parameter_numbers(self, numbers): + pass + @utils.register_interface(CMACBackend) class DummyCMACBackend(object): @@ -330,6 +333,7 @@ class TestMultiBackend(object): backend.dsa_parameters_supported(1, 2, 3) backend.load_dsa_private_numbers("numbers") backend.load_dsa_public_numbers("numbers") + backend.load_dsa_parameter_numbers("numbers") backend = MultiBackend([]) with raises_unsupported_algorithm( @@ -367,6 +371,11 @@ class TestMultiBackend(object): ): backend.load_dsa_public_numbers("numbers") + with raises_unsupported_algorithm( + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM + ): + backend.load_dsa_parameter_numbers("numbers") + def test_cmac(self): backend = MultiBackend([ DummyCMACBackend([algorithms.AES]) |