diff options
Diffstat (limited to 'tests/test_rsa.py')
-rw-r--r-- | tests/test_rsa.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/test_rsa.py b/tests/test_rsa.py index 5e75d68..6842a1c 100644 --- a/tests/test_rsa.py +++ b/tests/test_rsa.py @@ -109,9 +109,8 @@ class RSATestCase(unittest.TestCase): # The other paddings. for padding in self.s_padding_nok: p = getattr(RSA, padding) - # Exception disabled as a part of mitigation against CVE-2020-25657 - # with self.assertRaises(RSA.RSAError): - priv.private_encrypt(self.data, p) + with self.assertRaises(RSA.RSAError): + priv.private_encrypt(self.data, p) # Type-check the data to be encrypted. with self.assertRaises(TypeError): priv.private_encrypt(self.gen_callback, RSA.pkcs1_padding) @@ -128,12 +127,10 @@ class RSATestCase(unittest.TestCase): self.assertEqual(ptxt, self.data) # no_padding - # Exception disabled as a part of mitigation against CVE-2020-25657 - # with six.assertRaisesRegex(self, RSA.RSAError, 'data too small'): - priv.public_encrypt(self.data, RSA.no_padding) + with six.assertRaisesRegex(self, RSA.RSAError, 'data too small'): + priv.public_encrypt(self.data, RSA.no_padding) # Type-check the data to be encrypted. - # Exception disabled as a part of mitigation against CVE-2020-25657 with self.assertRaises(TypeError): priv.public_encrypt(self.gen_callback, RSA.pkcs1_padding) @@ -149,6 +146,8 @@ class RSATestCase(unittest.TestCase): b'\000\000\000\003\001\000\001') # aka 65537 aka 0xf4 with self.assertRaises(RSA.RSAError): setattr(rsa, 'e', '\000\000\000\003\001\000\001') + with self.assertRaises(RSA.RSAError): + rsa.private_decrypt(1) assert rsa.check_key() def test_loadpub_bad(self): |