From db62ec9967d95e666eb6898766944d9e50532b2d Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 18 Jul 2018 00:06:10 +0800 Subject: also check iv length for GCM nonce in AEAD (#4350) * also check iv length for GCM nonce in AEAD * ugh --- tests/hazmat/primitives/test_aead.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/hazmat/primitives/test_aead.py b/tests/hazmat/primitives/test_aead.py index a0cc79e1..5a518558 100644 --- a/tests/hazmat/primitives/test_aead.py +++ b/tests/hazmat/primitives/test_aead.py @@ -383,6 +383,12 @@ class TestAESGCM(object): with pytest.raises(TypeError): aesgcm.decrypt(nonce, data, associated_data) + def test_invalid_nonce_length(self, backend): + key = AESGCM.generate_key(128) + aesgcm = AESGCM(key) + with pytest.raises(ValueError): + aesgcm.encrypt(b"", b"hi", None) + def test_bad_key(self, backend): with pytest.raises(TypeError): AESGCM(object()) -- cgit v1.2.3