From 68bab79cda9ce48d85e2611e9ada9d5f7f44321c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 22 Oct 2015 11:37:34 -0500 Subject: add comments on test cases to explain reasons a bit better --- tests/hazmat/primitives/test_keywrap.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3