aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tests/test_pkcs11_high_level.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index 2e87af69d..1aa08ad58 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -806,13 +806,20 @@ Test::Result test_rsa_encrypt_decrypt()
auto encrypt_and_decrypt = [&keypair, &result](const std::vector<uint8_t>& plaintext, const std::string& padding)
{
- Botan::PK_Encryptor_EME encryptor(keypair.first, Test::rng(), padding);
- auto encrypted = encryptor.encrypt(plaintext, Test::rng());
+ try
+ {
+ Botan::PK_Encryptor_EME encryptor(keypair.first, Test::rng(), padding);
+ auto encrypted = encryptor.encrypt(plaintext, Test::rng());
- Botan::PK_Decryptor_EME decryptor(keypair.second, Test::rng(), padding);
- auto decrypted = decryptor.decrypt(encrypted);
+ Botan::PK_Decryptor_EME decryptor(keypair.second, Test::rng(), padding);
+ auto decrypted = decryptor.decrypt(encrypted);
- result.test_eq("RSA PKCS11 encrypt and decrypt: " + padding, decrypted, plaintext);
+ result.test_eq("RSA PKCS11 encrypt and decrypt: " + padding, decrypted, plaintext);
+ }
+ catch(Botan::PKCS11::PKCS11_ReturnError& e)
+ {
+ result.test_failure("PKCS11 RSA " + padding, e.what());
+ }
};
std::vector<uint8_t> plaintext(256);