summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-12-01 23:11:02 +0100
committerCarl Hetherington <cth@carlh.net>2019-12-01 23:12:54 +0100
commitc78523806e89e4c43015816fcd20db2549992464 (patch)
treee04a9a230002451d7db7ea9941589ccab7b6bc59 /test
parent9ec8f4724969c789c3add7edc7c548827f73d8a3 (diff)
Fix incorrect month when returning not-before/not-after.
Diffstat (limited to 'test')
-rw-r--r--test/certificates_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc
index fccc667c..692b169e 100644
--- a/test/certificates_test.cc
+++ b/test/certificates_test.cc
@@ -258,3 +258,23 @@ BOOST_AUTO_TEST_CASE (certificate_chain_from_string)
dcp::CertificateChain b (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"));
BOOST_CHECK_EQUAL (b.root_to_leaf().size(), 1);
}
+
+/** Check not_before and not_after */
+BOOST_AUTO_TEST_CASE (certificate_not_before_after)
+{
+ dcp::Certificate c (dcp::file_to_string("test/ref/crypt/ca.self-signed.pem"));
+ struct tm not_before = c.not_before();
+ BOOST_CHECK_EQUAL (not_before.tm_sec, 8);
+ BOOST_CHECK_EQUAL (not_before.tm_min, 20);
+ BOOST_CHECK_EQUAL (not_before.tm_hour, 13);
+ BOOST_CHECK_EQUAL (not_before.tm_mday, 5);
+ BOOST_CHECK_EQUAL (not_before.tm_mon, 5);
+ BOOST_CHECK_EQUAL (not_before.tm_year, 115);
+ struct tm not_after = c.not_after();
+ BOOST_CHECK_EQUAL (not_after.tm_sec, 8);
+ BOOST_CHECK_EQUAL (not_after.tm_min, 20);
+ BOOST_CHECK_EQUAL (not_after.tm_hour, 13);
+ BOOST_CHECK_EQUAL (not_after.tm_mday, 2);
+ BOOST_CHECK_EQUAL (not_after.tm_mon, 5);
+ BOOST_CHECK_EQUAL (not_after.tm_year, 125);
+}