diff options
author | Simon Warta <[email protected]> | 2015-07-11 12:28:33 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-07-15 13:51:20 +0200 |
commit | 60435bf070247a5fa0d149874c03f4c10fa8f134 (patch) | |
tree | 05a3ee49153337d5da026624a7401204997a41d3 | |
parent | 7f3c4b1ab3837e75e890232bd2c3ecb9f6390732 (diff) |
Construct X509_Time from date integers in test x509
-rw-r--r-- | src/tests/unit_x509.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp index 8776305e3..95890b9e9 100644 --- a/src/tests/unit_x509.cpp +++ b/src/tests/unit_x509.cpp @@ -10,13 +10,13 @@ #if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_DSA) +#include <botan/calendar.h> #include <botan/filters.h> #include <botan/x509self.h> #include <botan/x509path.h> #include <botan/x509_ca.h> #include <botan/pkcs10.h> - #if defined(BOTAN_HAS_RSA) #include <botan/rsa.h> #endif @@ -29,13 +29,19 @@ #include <botan/ecdsa.h> #endif -using namespace Botan; - #include <iostream> #include <memory> +using namespace Botan; + namespace { +X509_Time from_date(const int y, const int m, const int d) + { + auto t = calendar_point(y, m, d, 0, 0, 0); + return X509_Time(t.to_std_timepoint()); + } + u64bit key_id(const Public_Key* key) { Pipe pipe(new Hash_Filter("SHA-1", 8)); @@ -166,11 +172,11 @@ size_t test_x509() /* Sign the requests to create the certs */ X509_Certificate user1_cert = ca.sign_request(user1_req, rng, - X509_Time("2008-01-01"), X509_Time("2100-01-01")); + from_date(2008, 01, 01), from_date(2100, 01, 01)); X509_Certificate user2_cert = ca.sign_request(user2_req, rng, - X509_Time("2008-01-01"), - X509_Time("2100-01-01")); + from_date(2008, 01, 01), + from_date(2100, 01, 01)); X509_CRL crl1 = ca.new_crl(rng); /* Verify the certs */ |