aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hypothesis
diff options
context:
space:
mode:
authorCédric Krier <ced@b2ck.com>2016-02-26 18:40:20 +0100
committerCédric Krier <ced@b2ck.com>2016-02-27 19:24:40 +0100
commitbf0f464ab62d2e69ebfacd80fad2de46e862fcbc (patch)
tree84c009e637e2d93ebe293847240858a0984798d5 /tests/hypothesis
parentaf95980e394a27355531c9aad474d39253755f81 (diff)
downloadcryptography-bf0f464ab62d2e69ebfacd80fad2de46e862fcbc.tar.gz
cryptography-bf0f464ab62d2e69ebfacd80fad2de46e862fcbc.tar.bz2
cryptography-bf0f464ab62d2e69ebfacd80fad2de46e862fcbc.zip
Added support for padding ANSI X.923
Diffstat (limited to 'tests/hypothesis')
-rw-r--r--tests/hypothesis/test_padding.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/hypothesis/test_padding.py b/tests/hypothesis/test_padding.py
index 21c9a234..29d726f1 100644
--- a/tests/hypothesis/test_padding.py
+++ b/tests/hypothesis/test_padding.py
@@ -5,7 +5,7 @@
from hypothesis import given
from hypothesis.strategies import binary, integers
-from cryptography.hazmat.primitives.padding import PKCS7
+from cryptography.hazmat.primitives.padding import ANSIX923, PKCS7
@given(integers(min_value=1, max_value=31), binary())
@@ -19,3 +19,14 @@ def test_pkcs7(block_size, data):
padded = padder.update(data) + padder.finalize()
assert unpadder.update(padded) + unpadder.finalize() == data
+
+
+@given(integers(min_value=1, max_value=31), binary())
+def test_ansix923(block_size, data):
+ a = ANSIX923(block_size=block_size * 8)
+ padder = a.padder()
+ unpadder = a.unpadder()
+
+ padded = padder.update(data) + padder.finalize()
+
+ assert unpadder.update(padded) + unpadder.finalize() == data