From 8583c92f502c616dbf8358b350b0d3f0f8f8d1b8 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 22 Jan 2017 14:46:57 -0500 Subject: Add a test for trusted_hashes on path validation result --- src/tests/unit_x509.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/tests/unit_x509.cpp') diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp index dbaf88cd8..b51914ee8 100644 --- a/src/tests/unit_x509.cpp +++ b/src/tests/unit_x509.cpp @@ -375,6 +375,15 @@ Test::Result test_x509_cert(const std::string& sig_algo, const std::string& hash { result.test_note("user 1 validation result was " + result_u1.result_string()); } + else + { + const std::set u1_hashes = result_u1.trusted_hashes(); + + if(result.test_eq("Single trusted hash", u1_hashes.size(), 1)) + { + result.test_eq("Hash matches test", *u1_hashes.begin(), hash_fn); + } + } Botan::Path_Validation_Result result_u2 = Botan::x509_path_validate(user2_cert, restrictions, store); if(!result.confirm("user 2 validates", result_u2.successful_validation())) -- cgit v1.2.3