aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 17:25:00 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 17:25:00 -0800
commit56e78a942e71faac27d1b6451d6c409ee559a1f1 (patch)
tree779facb26ec0abf9d3b25c6f9cb267733f56acaa /tests
parent033af15d5f8d98007834be4aac4f260327e3c0c1 (diff)
parent8cf523ead464e758d1aa22a7a8abbc2eae2c9404 (diff)
downloadcryptography-56e78a942e71faac27d1b6451d6c409ee559a1f1.tar.gz
cryptography-56e78a942e71faac27d1b6451d6c409ee559a1f1.tar.bz2
cryptography-56e78a942e71faac27d1b6451d6c409ee559a1f1.zip
Merge branch 'master' into fernet
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/bindings/test_openssl.py4
-rw-r--r--tests/hazmat/primitives/test_block.py16
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index 9f27aab7..7ad1ea75 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -70,3 +70,7 @@ class TestOpenSSL(object):
)
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()
+
+ def test_handle_unknown_error(self):
+ with pytest.raises(SystemError):
+ backend._handle_error_code(0, 0, 0)
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py
index 9460c53d..ea40127e 100644
--- a/tests/hazmat/primitives/test_block.py
+++ b/tests/hazmat/primitives/test_block.py
@@ -108,3 +108,19 @@ class TestCipherContext(object):
with pytest.raises(UnsupportedAlgorithm):
cipher.decryptor()
+
+ def test_incorrectly_padded(self, backend):
+ cipher = Cipher(
+ algorithms.AES(b"\x00" * 16),
+ modes.CBC(b"\x00" * 16),
+ backend
+ )
+ encryptor = cipher.encryptor()
+ encryptor.update(b"1")
+ with pytest.raises(ValueError):
+ encryptor.finalize()
+
+ decryptor = cipher.decryptor()
+ decryptor.update(b"1")
+ with pytest.raises(ValueError):
+ decryptor.finalize()