diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-17 15:04:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-17 15:04:11 +0100 |
| commit | a0c90120cb62cfbaf32eb32a7cb09891cb7c539a (patch) | |
| tree | 5d4207e79953610e42c9a61ad1fb4a6a6a33e3db /test | |
| parent | 194f38bccf78e51de0a35367590c2133bb093020 (diff) | |
Add verify() to CertificateChain.
Diffstat (limited to 'test')
| -rw-r--r-- | test/certificates_test.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc index 690afa77..538a0dae 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -81,3 +81,18 @@ BOOST_AUTO_TEST_CASE (certificates) dcp::Certificate test (c.root()->certificate (true)); BOOST_CHECK_EQUAL (test.certificate(), c.root()->certificate()); } + +/** Check that dcp::CertificateChain::validate() basically works */ +BOOST_AUTO_TEST_CASE (certificates_validation) +{ + dcp::CertificateChain good; + good.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (boost::filesystem::path ("test/ref/crypt/ca.self-signed.pem")))); + good.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (boost::filesystem::path ("test/ref/crypt/intermediate.signed.pem")))); + good.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (boost::filesystem::path ("test/ref/crypt/leaf.signed.pem")))); + BOOST_CHECK (good.verify ()); + + dcp::CertificateChain bad; + bad.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (boost::filesystem::path ("test/ref/crypt/intermediate.signed.pem")))); + bad.add (shared_ptr<dcp::Certificate> (new dcp::Certificate (boost::filesystem::path ("test/ref/crypt/leaf.signed.pem")))); + BOOST_CHECK (!bad.verify ()); +} |
