diff options
-rw-r--r-- | tests/test_utils.py | 14 | ||||
-rw-r--r-- | tests/utils.py | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index a9bb6a87..3fe9e570 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -269,6 +269,20 @@ def test_load_cryptrec_vectors(): ] +def test_load_cryptrec_vectors_invalid(): + vector_data = textwrap.dedent(""" + # Vectors taken from http://info.isl.ntt.co.jp/crypt/eng/camellia/ + # Download is t_camelia.txt + + # Camellia with 128-bit key + + E No.001 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + """).splitlines() + + with pytest.raises(ValueError): + load_cryptrec_vectors(vector_data) + + def test_load_cryptrec_vectors_from_file_encrypt(): test_set = load_cryptrec_vectors_from_file( "Camellia/NTT/camellia-128-ecb.txt" diff --git a/tests/utils.py b/tests/utils.py index 03b780f8..fa7cc68d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -90,6 +90,8 @@ def load_cryptrec_vectors(vector_data): "plaintext": pt, "ciphertext": ct }) + else: + raise ValueError("Invalid line in file '{}'".format(line)) return cryptrec_list |