aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorChristopher Grebs <cg@webshox.org>2015-09-04 23:46:40 +0200
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-27 22:53:23 -0600
commit525f713629a181e7dbaf3e8a84fc4373dbaeb4e4 (patch)
tree396b3fc0e01b998e6bd277ee56072167595e1439 /tests/hazmat
parent6b22d6663dcba1a08a3662d9d0205005be6bcd86 (diff)
downloadcryptography-525f713629a181e7dbaf3e8a84fc4373dbaeb4e4.tar.gz
cryptography-525f713629a181e7dbaf3e8a84fc4373dbaeb4e4.tar.bz2
cryptography-525f713629a181e7dbaf3e8a84fc4373dbaeb4e4.zip
Add simple test that would fail on decryption
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/backends/test_openssl.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index ad2daf7d..98023e9d 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -456,6 +456,29 @@ class TestOpenSSLRSA(object):
)
)
+ def test_supported_oaep_decrypt(self):
+ private_key = RSA_KEY_512.private_key(backend)
+
+ ciphertext = private_key.public_key().encrypt(
+ b'secure data',
+ padding.OAEP(
+ mgf=padding.MGF1(algorithm=hashes.SHA1()),
+ algorithm=hashes.SHA1(),
+ label=None
+ )
+ )
+
+ decrypted = private_key.decrypt(
+ ciphertext,
+ padding.OAEP(
+ mgf=padding.MGF1(algorithm=hashes.SHA1()),
+ algorithm=hashes.SHA1(),
+ label=None
+ )
+ )
+
+ assert decrypted == b'secure data'
+
@pytest.mark.skipif(
backend._lib.OPENSSL_VERSION_NUMBER <= 0x10001000,