diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-09-25 16:56:11 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-09-27 10:18:25 -0500 |
commit | 07fa710a3e69329e999553244c04e98b85e1518c (patch) | |
tree | 200cf6248a9b68171758cb687f38d12ab8d9c396 /tests/hazmat | |
parent | 861ddfc57fefba33a200356722f329fbfdb4da87 (diff) | |
download | cryptography-07fa710a3e69329e999553244c04e98b85e1518c.tar.gz cryptography-07fa710a3e69329e999553244c04e98b85e1518c.tar.bz2 cryptography-07fa710a3e69329e999553244c04e98b85e1518c.zip |
fix test coverage on multibackend deprecated methods
Diffstat (limited to 'tests/hazmat')
-rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index f3893cd0..61bda54c 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -198,10 +198,12 @@ class DummyEllipticCurveBackend(object): raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE) def elliptic_curve_private_key_from_numbers(self, numbers): - return None + if not self.elliptic_curve_supported(numbers.public_numbers.curve): + raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE) def elliptic_curve_public_key_from_numbers(self, numbers): - return None + if not self.elliptic_curve_supported(numbers.curve): + raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE) def load_elliptic_curve_public_numbers(self, numbers): if not self.elliptic_curve_supported(numbers.curve): @@ -527,6 +529,12 @@ class TestMultiBackend(object): ec.SECT283K1 ]) ]) + + assert backend.elliptic_curve_signature_algorithm_supported( + ec.ECDSA(hashes.SHA256()), + ec.SECT163K1() + ) is False + pub_numbers = ec.EllipticCurvePublicNumbers(2, 3, ec.SECT283K1()) numbers = ec.EllipticCurvePrivateNumbers(1, pub_numbers) @@ -539,6 +547,27 @@ class TestMultiBackend(object): pub_numbers ) + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE): + backend.elliptic_curve_private_key_from_numbers( + ec.EllipticCurvePrivateNumbers( + 1, + ec.EllipticCurvePublicNumbers( + 2, + 3, + ec.SECT163K1() + ) + ) + ) + + with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE): + backend.elliptic_curve_public_key_from_numbers( + ec.EllipticCurvePublicNumbers( + 2, + 3, + ec.SECT163K1() + ) + ) + def test_pkcs8_serialization_backend(self): backend = MultiBackend([DummyPKCS8SerializationBackend()]) |