diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-08 11:58:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-08 11:58:38 +0100 |
| commit | a353528b070fe264ce60220b4af07d0561494def (patch) | |
| tree | 341e62026ad366a548836019b49c5789e70525a7 /test/certificates_test.cc | |
| parent | c1763d2ca9cb4dd38d9eec28f6304f45b29bf9d5 (diff) | |
Improve certificate handling a bit and fix up tests.encryption
Diffstat (limited to 'test/certificates_test.cc')
| -rw-r--r-- | test/certificates_test.cc | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc index 92c6555d..40e550cb 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -21,24 +21,54 @@ BOOST_AUTO_TEST_CASE (certificates) { libdcp::CertificateChain c; - c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/data/crypt/ca.self-signed.pem"))); - c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/data/crypt/intermediate.signed.pem"))); - c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/data/crypt/leaf.signed.pem"))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/ref/crypt/ca.self-signed.pem"))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/ref/crypt/intermediate.signed.pem"))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("test/ref/crypt/leaf.signed.pem"))); + + list<shared_ptr<libdcp::Certificate> > leaf_to_root = c.leaf_to_root (); + + list<shared_ptr<libdcp::Certificate> >::iterator i = leaf_to_root.begin (); + + /* Leaf */ + BOOST_CHECK_EQUAL (*i, c.leaf ()); BOOST_CHECK_EQUAL ( - c.root()->issuer(), - "/O=example.org/OU=example.org/CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION/dnQualifier=rTeK7x+nopFkyphflooz6p2ZM7A=" + c.leaf()->issuer(), + "dnQualifier=bmtwThq3srgxIAeRMjX6BFhgLDw=,CN=.smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" + ); + + BOOST_CHECK_EQUAL ( + c.leaf()->subject(), + "dnQualifier=d95fGDzERNdxfYPgphvAR8A18L4=,CN=CS.smpte-430-2.LEAF.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); + ++i; + + /* Intermediate */ BOOST_CHECK_EQUAL ( - libdcp::Certificate::name_for_xml (c.root()->issuer()), - "dnQualifier=rTeK7x\\+nopFkyphflooz6p2ZM7A=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" + (*i)->issuer(), + "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" + ); + + BOOST_CHECK_EQUAL ( + (*i)->subject(), + "dnQualifier=bmtwThq3srgxIAeRMjX6BFhgLDw=,CN=.smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" + ); + + ++i; + + /* Root */ + BOOST_CHECK_EQUAL (*i, c.root ()); + BOOST_CHECK_EQUAL ( + c.root()->issuer(), + "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); BOOST_CHECK_EQUAL (c.root()->serial(), "5"); BOOST_CHECK_EQUAL ( - libdcp::Certificate::name_for_xml (c.root()->subject()), - "dnQualifier=rTeK7x\\+nopFkyphflooz6p2ZM7A=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" + c.root()->subject(), + "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); + } |
