diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2016-03-07 10:04:22 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2016-03-07 10:04:22 -0500 |
commit | b6e1f6f23f02dd9534688c5ca88b511894b90faa (patch) | |
tree | b00a50ef9397a5cc6a740852bd481fc0977c906f /tests/hazmat | |
parent | 83c9cdaf1d8cb0d1a60f89935e237fa5fffcc571 (diff) | |
parent | b352531220a2718ca5dddce09ff0cdda1a4bd227 (diff) | |
download | cryptography-b6e1f6f23f02dd9534688c5ca88b511894b90faa.tar.gz cryptography-b6e1f6f23f02dd9534688c5ca88b511894b90faa.tar.bz2 cryptography-b6e1f6f23f02dd9534688c5ca88b511894b90faa.zip |
Merge pull request #2769 from reaperhulk/enforce-more-bytes
require mode nonce/iv/tag data to be bytes
Diffstat (limited to 'tests/hazmat')
-rw-r--r-- | tests/hazmat/primitives/test_block.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py index 5d77877d..eb0a2c3b 100644 --- a/tests/hazmat/primitives/test_block.py +++ b/tests/hazmat/primitives/test_block.py @@ -177,3 +177,33 @@ class TestModeValidation(object): modes.CTR(b"abc"), backend, ) + + +class TestModesRequireBytes(object): + def test_cbc(self): + with pytest.raises(TypeError): + modes.CBC([1] * 16) + + def test_cfb(self): + with pytest.raises(TypeError): + modes.CFB([1] * 16) + + def test_cfb8(self): + with pytest.raises(TypeError): + modes.CFB8([1] * 16) + + def test_ofb(self): + with pytest.raises(TypeError): + modes.OFB([1] * 16) + + def test_ctr(self): + with pytest.raises(TypeError): + modes.CTR([1] * 16) + + def test_gcm_iv(self): + with pytest.raises(TypeError): + modes.GCM([1] * 16) + + def test_gcm_tag(self): + with pytest.raises(TypeError): + modes.GCM(b"\x00" * 16, [1] * 16) |