aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_rsa.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-04-07 22:15:38 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-04-20 16:53:03 -0500
commitaf9a2cc7bc73129fcd807ac890be59dcc9672a4c (patch)
treebeffb48565b4b5db89e5dfc2f7a90fe09b7af780 /tests/hazmat/primitives/test_rsa.py
parente1c89f3d25c381f945db9de45c4782b123b7fe49 (diff)
downloadcryptography-af9a2cc7bc73129fcd807ac890be59dcc9672a4c.tar.gz
cryptography-af9a2cc7bc73129fcd807ac890be59dcc9672a4c.tar.bz2
cryptography-af9a2cc7bc73129fcd807ac890be59dcc9672a4c.zip
add InvalidDecryption exception, check for ct > key size
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r--tests/hazmat/primitives/test_rsa.py13
1 files changed, 13 insertions, 0 deletions
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
+ )