aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-08-20 21:23:04 +0200
committerMichał Górny <mgorny@gentoo.org>2013-08-20 23:17:43 +0200
commite0d91305b904e61e967afb2fa53636807e9b608d (patch)
tree023bd4bcb75d6869543911c2381541d6e7c315dd
parentRaise ValueError on short ciphertext. (diff)
downloadidentity.gentoo.org-e0d91305b904e61e967afb2fa53636807e9b608d.tar.gz
identity.gentoo.org-e0d91305b904e61e967afb2fa53636807e9b608d.tar.bz2
identity.gentoo.org-e0d91305b904e61e967afb2fa53636807e9b608d.zip
test_cipher: check if wrong ciphertext length triggers ValueError.
-rw-r--r--okupy/tests/unit/test_cipher.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/okupy/tests/unit/test_cipher.py b/okupy/tests/unit/test_cipher.py
index a0eaab1..8a8f043 100644
--- a/okupy/tests/unit/test_cipher.py
+++ b/okupy/tests/unit/test_cipher.py
@@ -39,3 +39,8 @@ class OkupyCipherTests(TestCase):
data = self._random_string[:cipher.block_size*2]
hash = cipher.encrypt(data)[:cipher.block_size]
self.assertRaises(ValueError, cipher.decrypt, hash, len(data))
+
+ def test_ciphertext_not_multiple_of_block_size_raises_valueerror(self):
+ data = self._random_string[:cipher.block_size/2]
+ hash = cipher.encrypt(data)[:cipher.block_size/2]
+ self.assertRaises(ValueError, cipher.decrypt, hash, len(data))