diff options
author | Jack Lloyd <[email protected]> | 2017-03-03 22:24:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-03-03 22:24:06 -0500 |
commit | 6203025a02b052fbaebb4b309104497a22737187 (patch) | |
tree | e07b0c3b488ee44153ee4bc81225736fbf945cce /src | |
parent | 4519b036977264cc88ab82669c1d67e21667989a (diff) |
Change name constraint test to use a fixed reference time
Test certs have expired.
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/test_name_constraint.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tests/test_name_constraint.cpp b/src/tests/test_name_constraint.cpp index 95cb9f229..11336bb1f 100644 --- a/src/tests/test_name_constraint.cpp +++ b/src/tests/test_name_constraint.cpp @@ -8,7 +8,7 @@ #if defined(BOTAN_HAS_X509_CERTIFICATES) #include <botan/x509path.h> - #include <botan/internal/filesystem.h> + #include <botan/calendar.h> #endif #include <algorithm> @@ -65,6 +65,9 @@ class Name_Constraint_Tests : public Test std::vector<Test::Result> results; const Botan::Path_Validation_Restrictions restrictions(false, 80); + std::chrono::system_clock::time_point validation_time = + Botan::calendar_point(2016,10,21,4,20,0).to_std_timepoint(); + for(const auto& t: test_cases) { Botan::X509_Certificate root(Test::data_file("name_constraint/" + std::get<0>(t))); @@ -74,7 +77,8 @@ class Name_Constraint_Tests : public Test trusted.add_certificate(root); Botan::Path_Validation_Result path_result = Botan::x509_path_validate( - sub, restrictions, trusted, std::get<2>(t), Botan::Usage_Type::TLS_SERVER_AUTH); + sub, restrictions, trusted, std::get<2>(t), Botan::Usage_Type::TLS_SERVER_AUTH, + validation_time); if(path_result.successful_validation() && path_result.trust_root() != root) path_result = Botan::Path_Validation_Result(Botan::Certificate_Status_Code::CANNOT_ESTABLISH_TRUST); |