aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_multibackend.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index 1cd87336..319edf7d 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -27,6 +27,12 @@ class DummyBackend(object):
pass
+@utils.register_interface(ec.EllipticCurve)
+class DummyCurve(object):
+ name = "dummy-curve"
+ key_size = 1
+
+
@utils.register_interface(CipherBackend)
class DummyCipherBackend(object):
def __init__(self, supported_ciphers):
@@ -179,6 +185,10 @@ class DummyEllipticCurveBackend(object):
self.elliptic_curve_supported(curve)
)
+ def derive_elliptic_curve_public_point(self, private_value, curve):
+ if not self.elliptic_curve_supported(curve):
+ raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
+
@utils.register_interface(PEMSerializationBackend)
class DummyPEMSerializationBackend(object):
@@ -501,6 +511,12 @@ class TestMultiBackend(object):
ec.ECDH(), ec.SECT163K1()
)
+ with pytest.raises(UnsupportedAlgorithm):
+ backend.derive_elliptic_curve_public_point(123, DummyCurve())
+
+ assert backend.derive_elliptic_curve_public_point(
+ 123, ec.SECT283K1()) is None
+
def test_pem_serialization_backend(self):
backend = MultiBackend([DummyPEMSerializationBackend()])