diff options
author | Erik Trauschke <erik.trauschke@gmail.com> | 2015-10-20 08:18:00 -0700 |
---|---|---|
committer | Erik Trauschke <erik.trauschke@gmail.com> | 2015-10-20 08:18:00 -0700 |
commit | c8ab2ea92fe43d1ff64d7463c61fa9ef34cce7d8 (patch) | |
tree | d3ed0f8b77f4f978ee847585e5b1ae1a9994270b /tests/hazmat/backends/test_multibackend.py | |
parent | c219b962f8f02f85edf2a3452fe4136b1211f807 (diff) | |
parent | 018a9659924c5ffe548d716295a4292c6929c341 (diff) | |
download | cryptography-c8ab2ea92fe43d1ff64d7463c61fa9ef34cce7d8.tar.gz cryptography-c8ab2ea92fe43d1ff64d7463c61fa9ef34cce7d8.tar.bz2 cryptography-c8ab2ea92fe43d1ff64d7463c61fa9ef34cce7d8.zip |
Merge branch 'master' into crl_ossl_backend
Diffstat (limited to 'tests/hazmat/backends/test_multibackend.py')
-rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index 618d21b6..81a64ce0 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -152,10 +152,7 @@ class DummyEllipticCurveBackend(object): ): return ( isinstance(signature_algorithm, ec.ECDSA) and - any( - isinstance(curve, curve_type) - for curve_type in self._curves - ) + self.elliptic_curve_supported(curve) ) def generate_elliptic_curve_private_key(self, curve): @@ -170,6 +167,12 @@ class DummyEllipticCurveBackend(object): if not self.elliptic_curve_supported(numbers.curve): raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE) + def elliptic_curve_exchange_algorithm_supported(self, algorithm, curve): + return ( + isinstance(algorithm, ec.ECDH) and + self.elliptic_curve_supported(curve) + ) + @utils.register_interface(PEMSerializationBackend) class DummyPEMSerializationBackend(object): @@ -468,6 +471,14 @@ class TestMultiBackend(object): ) ) + assert backend.elliptic_curve_exchange_algorithm_supported( + ec.ECDH(), ec.SECT283K1() + ) + backend2 = MultiBackend([DummyEllipticCurveBackend([])]) + assert not backend2.elliptic_curve_exchange_algorithm_supported( + ec.ECDH(), ec.SECT163K1() + ) + def test_pem_serialization_backend(self): backend = MultiBackend([DummyPEMSerializationBackend()]) |