aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-07-18 00:06:10 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2018-07-17 12:06:10 -0400
commitdb62ec9967d95e666eb6898766944d9e50532b2d (patch)
tree9cf70453fad72b31c074d45e43d33298e2640166 /tests/hazmat/primitives
parent12a1cacb6ae6de51a003dcc884e769854a1345a8 (diff)
downloadcryptography-db62ec9967d95e666eb6898766944d9e50532b2d.tar.gz
cryptography-db62ec9967d95e666eb6898766944d9e50532b2d.tar.bz2
cryptography-db62ec9967d95e666eb6898766944d9e50532b2d.zip
also check iv length for GCM nonce in AEAD (#4350)
* also check iv length for GCM nonce in AEAD * ugh
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/test_aead.py6
1 files changed, 6 insertions, 0 deletions
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())