From a43964a0e90d7788b81521c9e7b949cdc2b555a0 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 7 Dec 2014 11:44:04 -0600 Subject: catch PyAsn1Error for encoding signature as well --- tests/hazmat/primitives/test_asym_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/hazmat/primitives/test_asym_utils.py') diff --git a/tests/hazmat/primitives/test_asym_utils.py b/tests/hazmat/primitives/test_asym_utils.py index 1a945f3a..3598f78a 100644 --- a/tests/hazmat/primitives/test_asym_utils.py +++ b/tests/hazmat/primitives/test_asym_utils.py @@ -36,6 +36,14 @@ def test_rfc6979_signature(): assert decode_rfc6979_signature(sig4) == (-1, 0) +def test_encode_rfc6979_non_integer(): + with pytest.raises(ValueError): + encode_rfc6979_signature("h", 3) + encode_rfc6979_signature(3, "h") + encode_rfc6979_signature(3.3, 1.2) + encode_rfc6979_signature("hello", "world") + + def test_decode_rfc6979_trailing_bytes(): with pytest.raises(ValueError): decode_rfc6979_signature(b"0\x06\x02\x01\x01\x02\x01\x01\x00\x00\x00") -- cgit v1.2.3