aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_block.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-14 08:33:54 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-14 08:33:54 -0800
commit4b0f9ab4e733f7183fc0f67acbc251b5d9a56758 (patch)
treead18caf3b26bd57a7cadfbdba4e5edd97d3c49f8 /tests/hazmat/primitives/test_block.py
parent554df80072ede5e154020af39ce0c664de0582b5 (diff)
parentca4a22b4dea8243d02bc4a2699048694e591ae75 (diff)
downloadcryptography-4b0f9ab4e733f7183fc0f67acbc251b5d9a56758.tar.gz
cryptography-4b0f9ab4e733f7183fc0f67acbc251b5d9a56758.tar.bz2
cryptography-4b0f9ab4e733f7183fc0f67acbc251b5d9a56758.zip
Merge branch 'master' into fernet
Diffstat (limited to 'tests/hazmat/primitives/test_block.py')
-rw-r--r--tests/hazmat/primitives/test_block.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_block.py b/tests/hazmat/primitives/test_block.py
index f6c44b47..02de3861 100644
--- a/tests/hazmat/primitives/test_block.py
+++ b/tests/hazmat/primitives/test_block.py
@@ -18,12 +18,18 @@ import binascii
import pytest
from cryptography import utils
-from cryptography.exceptions import UnsupportedAlgorithm, AlreadyFinalized
+from cryptography.exceptions import (
+ UnsupportedAlgorithm, AlreadyFinalized,
+)
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.ciphers import (
Cipher, algorithms, modes
)
+from .utils import (
+ generate_aead_exception_test, generate_aead_tag_exception_test
+)
+
@utils.register_interface(interfaces.CipherAlgorithm)
class DummyCipher(object):
@@ -120,3 +126,22 @@ class TestCipherContext(object):
decryptor.update(b"1")
with pytest.raises(ValueError):
decryptor.finalize()
+
+
+class TestAEADCipherContext(object):
+ test_aead_exceptions = generate_aead_exception_test(
+ algorithms.AES,
+ modes.GCM,
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.AES("\x00" * 16), modes.GCM("\x00" * 12)
+ ),
+ skip_message="Does not support AES GCM",
+ )
+ test_aead_tag_exceptions = generate_aead_tag_exception_test(
+ algorithms.AES,
+ modes.GCM,
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.AES("\x00" * 16), modes.GCM("\x00" * 12)
+ ),
+ skip_message="Does not support AES GCM",
+ )