diff options
author | Philipp Weber <[email protected]> | 2016-05-30 11:17:01 +0200 |
---|---|---|
committer | Philipp Weber <[email protected]> | 2016-05-30 11:53:56 +0200 |
commit | b9c1cccda47aec29c7795f3df559caa55adfcb25 (patch) | |
tree | 2f951cf60d244ec933b418167b0cb80ca89b87f7 | |
parent | c3603924ab8d758831eefe8709e250b5be4088f5 (diff) |
ecies review change: test for exception if the ciphertext is invalid
-rw-r--r-- | src/tests/test_ecies.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tests/test_ecies.cpp b/src/tests/test_ecies.cpp index 4f24c3350..a4a669db8 100644 --- a/src/tests/test_ecies.cpp +++ b/src/tests/test_ecies.cpp @@ -74,6 +74,14 @@ void check_encrypt_decrypt(Test::Result& result, const Botan::ECDH_PrivateKey& p result.test_eq("encrypted data", encrypted, ciphertext); const Botan::secure_vector<byte> decrypted = ecies_dec.decrypt(encrypted); result.test_eq("decrypted data equals plaintext", decrypted, plaintext); + + std::vector<byte> invalid_encrypted = encrypted; + byte& last_byte = invalid_encrypted[invalid_encrypted.size() - 1]; + last_byte = ~last_byte; + result.test_throws("throw on invalid ciphertext", [&ecies_dec, &invalid_encrypted] + { + ecies_dec.decrypt(invalid_encrypted); + }); } catch(Botan::Lookup_Error& e) { |