aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2016-03-06 21:09:16 -0430
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-03-07 10:15:32 -0400
commitacfb618f1016bdd8333f3a4f41c0cc5955c8a1a4 (patch)
treef47dbf0d87441a76dea773d3bea84c54f8c745a6 /tests/hazmat
parent83c9cdaf1d8cb0d1a60f89935e237fa5fffcc571 (diff)
downloadcryptography-acfb618f1016bdd8333f3a4f41c0cc5955c8a1a4.tar.gz
cryptography-acfb618f1016bdd8333f3a4f41c0cc5955c8a1a4.tar.bz2
cryptography-acfb618f1016bdd8333f3a4f41c0cc5955c8a1a4.zip
require mode nonce/iv/tag data to be bytes
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/primitives/test_block.py30
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)