diff options
Diffstat (limited to 'tests/hypothesis/test_padding.py')
-rw-r--r-- | tests/hypothesis/test_padding.py | 13 |
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 |