diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-16 12:58:27 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-16 12:58:27 -0400 |
commit | f790b4289ed026cab590fd98aca4d6777f62d719 (patch) | |
tree | a5a4a589545c9332fdd9f00c60781f57bb00fc8e /tests/hypothesis/test_padding.py | |
parent | 1c6e624631cb339b9e5e437083bca971530bba9f (diff) | |
parent | 70b3a7dd5ce2a953da1ce19534bcedbb53a8c2bf (diff) | |
download | cryptography-f790b4289ed026cab590fd98aca4d6777f62d719.tar.gz cryptography-f790b4289ed026cab590fd98aca4d6777f62d719.tar.bz2 cryptography-f790b4289ed026cab590fd98aca4d6777f62d719.zip |
Merge pull request #2736 from cedk/ANSI_X.923
Added support for padding ANSI X.923
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 |