From cd95f3c0355d684082fdc8ad38a00850259c517d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 8 Aug 2013 22:08:26 -0700 Subject: Tests now running against the NIST vectors --- tests/primitives/test_block.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tests/primitives/test_block.py') diff --git a/tests/primitives/test_block.py b/tests/primitives/test_block.py index e22d05ef..b976e217 100644 --- a/tests/primitives/test_block.py +++ b/tests/primitives/test_block.py @@ -4,16 +4,13 @@ import pytest from cryptography.primitives.block import BlockCipher, ciphers, modes, padding +from ..utils import load_nist_vectors_from_file + class TestBlockCipher(object): - @pytest.mark.parametrize(("key", "iv", "plaintext", "ciphertext"), [ - ( - b"9dc2c84a37850c11699818605f47958c", - b"256953b2feab2a04ae0180d8335bbed6", - b"2e586692e647f5028ec6fa47a55a2aab", - b"1b1ebd1fc45ec43037fd4844241a437f" - ), - ]) + @pytest.mark.parametrize(("key", "iv", "plaintext", "ciphertext"), + load_nist_vectors_from_file("AES/KAT/CBCGFSbox256.rsp", "ENCRYPT", ["key", "iv", "plaintext", "ciphertext"]) + ) def test_aes_cbc_nopadding(self, key, iv, plaintext, ciphertext): cipher = BlockCipher( ciphers.AES(binascii.unhexlify(key)), -- cgit v1.2.3