diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2019-06-07 11:43:03 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2019-06-07 23:24:10 +0200 |
commit | 0b22d79082afd7c564b2ac07fb0ef5d76d692586 (patch) | |
tree | 49558fb2a3604a2b153eb3a6af4e910ad1598aee /tests | |
parent | 83d4d9bc3aa4466e540fa00f8cc6891c0301ec82 (diff) | |
download | m2crypto-0b22d79082afd7c564b2ac07fb0ef5d76d692586.tar.gz |
Limit tests.test_rsa.RSATestCase.test_public_encrypt just to OpenSSL which sustains it.
Fixes #258
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_rsa.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_rsa.py b/tests/test_rsa.py index 875b59c..7028b60 100644 --- a/tests/test_rsa.py +++ b/tests/test_rsa.py @@ -113,6 +113,8 @@ class RSATestCase(unittest.TestCase): with self.assertRaises(TypeError): priv.private_encrypt(self.gen_callback, RSA.pkcs1_padding) + @unittest.skipIf(m2.OPENSSL_VERSION_NUMBER < 0x1010103f, + 'Relies on fix which happened only in OpenSSL 1.1.1c') def test_public_encrypt(self): priv = RSA.load_key(self.privkey) # pkcs1_padding, pkcs1_oaep_padding @@ -124,11 +126,11 @@ class RSATestCase(unittest.TestCase): # sslv23_padding ctxt = priv.public_encrypt(self.data, RSA.sslv23_padding) - with self.assertRaises(RSA.RSAError): - priv.private_decrypt(ctxt, RSA.sslv23_padding) + res = priv.private_decrypt(ctxt, RSA.sslv23_padding) + self.assertEqual(res, self.data) # no_padding - with self.assertRaises(RSA.RSAError): + with six.assertRaisesRegex(self, TypeError, 'data too small'): priv.public_encrypt(self.data, RSA.no_padding) # Type-check the data to be encrypted. |