From af9a2cc7bc73129fcd807ac890be59dcc9672a4c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 7 Apr 2014 22:15:38 -0500 Subject: add InvalidDecryption exception, check for ct > key size --- tests/hazmat/primitives/test_rsa.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/hazmat/primitives/test_rsa.py') diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 7b658b69..9c6d6f87 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -1336,3 +1336,16 @@ class TestRSADecryption(object): padding.PKCS1v15(), backend ) + + def test_decrypt_ciphertext_too_large(self, backend): + private_key = rsa.RSAPrivateKey.generate( + public_exponent=65537, + key_size=512, + backend=backend + ) + with pytest.raises(ValueError): + private_key.decrypt( + b"\x00" * 65, + padding.PKCS1v15(), + backend + ) -- cgit v1.2.3