aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/multibackend.py7
-rw-r--r--tests/hazmat/backends/test_multibackend.py11
2 files changed, 17 insertions, 1 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py
index b4cb6889..5acec333 100644
--- a/cryptography/hazmat/backends/multibackend.py
+++ b/cryptography/hazmat/backends/multibackend.py
@@ -178,6 +178,13 @@ class MultiBackend(object):
raise UnsupportedAlgorithm("RSA is not supported by the backend.",
_Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM)
+ def load_rsa_numbers(self, numbers):
+ for b in self._filtered_backends(RSABackend):
+ return b.load_rsa_numbers(numbers)
+
+ raise UnsupportedAlgorithm("RSA is not supported by the backend",
+ _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM)
+
def generate_dsa_parameters(self, key_size):
for b in self._filtered_backends(DSABackend):
return b.generate_dsa_parameters(key_size)
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index 3fa364e2..d4c89be3 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -23,7 +23,7 @@ from cryptography.hazmat.backends.interfaces import (
)
from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.primitives import cmac, hashes, hmac
-from cryptography.hazmat.primitives.asymmetric import padding
+from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from ...utils import raises_unsupported_algorithm
@@ -111,6 +111,8 @@ class DummyRSABackend(object):
pass
def encrypt_rsa(self, public_key, plaintext, padding):
+
+ def load_rsa_numbers(self, numbers):
pass
@@ -236,6 +238,8 @@ class TestMultiBackend(object):
backend.decrypt_rsa("private_key", "encrypted", padding.PKCS1v15())
+ backend.load_rsa_numbers(rsa.RSAPublicNumbers(e=3, n=1))
+
backend = MultiBackend([])
with raises_unsupported_algorithm(
_Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM
@@ -279,6 +283,11 @@ class TestMultiBackend(object):
):
backend.decrypt_rsa("private_key", "encrypted", padding.PKCS1v15())
+ with raises_unsupported_algorithm(
+ _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM
+ ):
+ backend.load_rsa_numbers(rsa.RSAPublicNumbers(e=3, n=1))
+
def test_dsa(self):
backend = MultiBackend([
DummyDSABackend()