diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-22 11:37:34 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-10-22 11:40:22 -0500 |
commit | 68bab79cda9ce48d85e2611e9ada9d5f7f44321c (patch) | |
tree | 06a425bb485ff211794c0960b2dc46af77aa54f5 /tests/hazmat/primitives | |
parent | 5af3043b9f8ab5fa2b2e4aa16bba0c00d044055a (diff) | |
download | cryptography-68bab79cda9ce48d85e2611e9ada9d5f7f44321c.tar.gz cryptography-68bab79cda9ce48d85e2611e9ada9d5f7f44321c.tar.bz2 cryptography-68bab79cda9ce48d85e2611e9ada9d5f7f44321c.zip |
add comments on test cases to explain reasons a bit better
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_keywrap.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_keywrap.py b/tests/hazmat/primitives/test_keywrap.py index b1cf5ed8..f1238c9a 100644 --- a/tests/hazmat/primitives/test_keywrap.py +++ b/tests/hazmat/primitives/test_keywrap.py @@ -75,6 +75,7 @@ class TestAESKeyWrap(object): " is unsupported", ) def test_wrap_invalid_key_length(self, backend): + # The wrapping key must be of length [16, 24, 32] with pytest.raises(ValueError): keywrap.aes_key_wrap(b"badkey", b"sixteen_byte_key", backend) @@ -97,15 +98,19 @@ class TestAESKeyWrap(object): " is unsupported", ) def test_wrap_invalid_key_to_wrap_length(self, backend): + # Keys to wrap must be at least 16 bytes long with pytest.raises(ValueError): keywrap.aes_key_wrap(b"sixteen_byte_key", b"\x00" * 15, backend) + # Keys to wrap must be a multiple of 8 bytes with pytest.raises(ValueError): keywrap.aes_key_wrap(b"sixteen_byte_key", b"\x00" * 23, backend) def test_unwrap_invalid_wrapped_key_length(self, backend): + # Keys to unwrap must be at least 24 bytes with pytest.raises(ValueError): keywrap.aes_key_unwrap(b"sixteen_byte_key", b"\x00" * 16, backend) + # Keys to unwrap must be a multiple of 8 bytes with pytest.raises(ValueError): keywrap.aes_key_unwrap(b"sixteen_byte_key", b"\x00" * 27, backend) |