aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_x509.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/unit_x509.cpp')
-rw-r--r--src/tests/unit_x509.cpp18
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 */