aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-24 11:39:14 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-11-29 17:19:46 -0600
commit0092c205657789e15848c7848eec768720de468f (patch)
tree331ac997c5689fa0b7fc6c962371a7f72a8d826c /tests/hazmat/primitives/utils.py
parent4664108ac1771b694f917b9ef70d358638371c04 (diff)
downloadcryptography-0092c205657789e15848c7848eec768720de468f.tar.gz
cryptography-0092c205657789e15848c7848eec768720de468f.tar.bz2
cryptography-0092c205657789e15848c7848eec768720de468f.zip
raise TypeError if you attempt to get the tag attribute on a decrypt
* To support this the _AEADCipherContext in base.py now needs to be aware of whether it is encrypting/decrypting
Diffstat (limited to 'tests/hazmat/primitives/utils.py')
-rw-r--r--tests/hazmat/primitives/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index b6f9e0f5..58b9a917 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -344,3 +344,12 @@ def aead_exception_test(backend, cipher_factory, mode_factory,
encryptor.update(b"b" * 16)
with pytest.raises(AlreadyFinalized):
encryptor.finalize()
+ cipher = Cipher(
+ cipher_factory(binascii.unhexlify(b"0" * 32)),
+ mode_factory(binascii.unhexlify(b"0" * 24), b"0" * 16),
+ backend
+ )
+ decryptor = cipher.decryptor()
+ decryptor.update(b"a" * 16)
+ with pytest.raises(TypeError):
+ decryptor.tag