diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-01-10 21:05:54 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-01-10 21:05:54 +0000 |
| commit | 1ee5cc88cb32927f95358e2d03985caf5a1d8e05 (patch) | |
| tree | dd7a17fbcae7179d79249d5bde08319d6159cf7f /test | |
| parent | 0ffc4c35a9ae232f3bed9329997c043c42372f6f (diff) | |
Move some more stuff up to Package.
Diffstat (limited to 'test')
| -rw-r--r-- | test/certificates_test.cc | 84 | ||||
| -rw-r--r-- | test/dcp_font_test.cc | 4 | ||||
| -rw-r--r-- | test/dcp_test.cc | 4 | ||||
| -rw-r--r-- | test/decryption_test.cc | 2 | ||||
| -rw-r--r-- | test/encryption_test.cc | 12 | ||||
| -rw-r--r-- | test/round_trip_test.cc | 4 |
6 files changed, 55 insertions, 55 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc index 74ed3c41..9592ae2f 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -31,15 +31,15 @@ using boost::shared_ptr; /** Check that loading certificates from files via strings works */ BOOST_AUTO_TEST_CASE (certificates1) { - dcp::dc::CertificateChain c; + dcp::CertificateChain c; - c.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - c.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - c.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + c.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); - dcp::dc::CertificateChain::List leaf_to_root = c.leaf_to_root (); + dcp::CertificateChain::List leaf_to_root = c.leaf_to_root (); - dcp::dc::CertificateChain::List::iterator i = leaf_to_root.begin (); + dcp::CertificateChain::List::iterator i = leaf_to_root.begin (); /* Leaf */ BOOST_CHECK_EQUAL (*i, c.leaf ()); @@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE (certificates1) ); /* Check that reconstruction from a string works */ - dcp::dc::Certificate test (c.root().certificate (true)); + dcp::Certificate test (c.root().certificate (true)); BOOST_CHECK_EQUAL (test.certificate(), c.root().certificate()); } @@ -92,79 +92,79 @@ BOOST_AUTO_TEST_CASE (certificates1) BOOST_AUTO_TEST_CASE (certificates2) { { - dcp::dc::Certificate c (dcp::file_to_string (private_test / "CA.GDC-TECH.COM_SA2100_A14903.crt.crt")); + dcp::Certificate c (dcp::file_to_string (private_test / "CA.GDC-TECH.COM_SA2100_A14903.crt.crt")); BOOST_CHECK_EQUAL (c.certificate(true), dcp::file_to_string (private_test / "CA.GDC-TECH.COM_SA2100_A14903.crt.crt.reformatted")); } { - dcp::dc::Certificate c (dcp::file_to_string (private_test / "usl-cert.pem")); + dcp::Certificate c (dcp::file_to_string (private_test / "usl-cert.pem")); BOOST_CHECK_EQUAL (c.certificate(true), dcp::file_to_string (private_test / "usl-cert.pem.trimmed")); } - BOOST_CHECK_THROW (dcp::dc::Certificate (dcp::file_to_string (private_test / "no-begin.pem")), dcp::MiscError); - BOOST_CHECK_THROW (dcp::dc::Certificate ("foo"), dcp::MiscError); + BOOST_CHECK_THROW (dcp::Certificate (dcp::file_to_string (private_test / "no-begin.pem")), dcp::MiscError); + BOOST_CHECK_THROW (dcp::Certificate ("foo"), dcp::MiscError); } -/** Check that dcp::dc::CertificateChain::valid() and ::attempt_reorder() basically work */ +/** Check that dcp::CertificateChain::valid() and ::attempt_reorder() basically work */ BOOST_AUTO_TEST_CASE (certificates_validation) { - dcp::dc::CertificateChain good1; - good1.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - good1.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - good1.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + dcp::CertificateChain good1; + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + good1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (good1.valid ()); - dcp::dc::CertificateChain good2; - good2.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + dcp::CertificateChain good2; + good2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (good2.valid ()); - dcp::dc::CertificateChain bad1; - bad1.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - bad1.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + dcp::CertificateChain bad1; + bad1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad1.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (!bad1.valid ()); BOOST_CHECK (!bad1.attempt_reorder ()); - dcp::dc::CertificateChain bad2; - bad2.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); - bad2.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - bad2.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + dcp::CertificateChain bad2; + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + bad2.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); BOOST_CHECK (!bad2.valid ()); BOOST_CHECK (bad2.attempt_reorder ()); - dcp::dc::CertificateChain bad3; - bad3.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - bad3.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); - bad3.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + dcp::CertificateChain bad3; + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad3.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (!bad3.valid ()); BOOST_CHECK (bad3.attempt_reorder ()); - dcp::dc::CertificateChain bad4; - bad4.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); - bad4.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - bad4.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + dcp::CertificateChain bad4; + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + bad4.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); BOOST_CHECK (!bad4.valid ()); BOOST_CHECK (bad4.attempt_reorder ()); - dcp::dc::CertificateChain bad5; - bad5.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - bad5.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + dcp::CertificateChain bad5; + bad5.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + bad5.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); BOOST_CHECK (!bad5.valid ()); BOOST_CHECK (!bad5.attempt_reorder ()); } -/** Check that dcp::dc::Signer::valid() basically works */ +/** Check that dcp::Signer::valid() basically works */ BOOST_AUTO_TEST_CASE (signer_validation) { /* Check a valid signer */ - dcp::dc::CertificateChain chain; - chain.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - chain.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - chain.add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + dcp::CertificateChain chain; + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + chain.add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); chain.set_key (dcp::file_to_string ("test/ref/crypt/leaf.key")); BOOST_CHECK (chain.valid ()); /* Put in an unrelated key and the signer should no longer be valid */ - dcp::dc::CertificateChain another_chain ("openssl"); + dcp::CertificateChain another_chain ("openssl"); chain.set_key (another_chain.key().get ()); BOOST_CHECK (!chain.valid ()); } diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc index e7d74e9d..9079f075 100644 --- a/test/dcp_font_test.cc +++ b/test/dcp_font_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test) shared_ptr<dcp::dc::CPL> cpl (new dcp::dc::CPL ("", dcp::TRAILER)); cpl->add (reel); - dcp.add (cpl); + dcp.add_cpl (cpl); dcp.write_xml (dcp::DCP_INTEROP); dcp::dc::Package dcp2 (directory); @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test) shared_ptr<dcp::dc::CPL> cpl (new dcp::dc::CPL ("", dcp::TRAILER)); cpl->add (reel); - dcp.add (cpl); + dcp.add_cpl (cpl); dcp.write_xml (dcp::DCP_SMPTE); dcp::dc::Package dcp2 (directory); diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 04633779..4fcba267 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE (dcp_test1) ) )); - d.add (cpl); + d.add_cpl (cpl); d.write_xml (dcp::DCP_SMPTE, xml_meta); @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE (dcp_test2) ) )); - d.add (cpl); + d.add_cpl (cpl); d.write_xml (dcp::DCP_SMPTE, xml_meta); diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 48e014d6..cc6fcbd3 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE (decryption_test) dcp::file_to_string ("test/data/private.key") ); - encrypted.add (kdm); + encrypted.add_kdm (kdm); pair<uint8_t *, dcp::Size> plaintext_frame = get_frame (plaintext); pair<uint8_t *, dcp::Size> encrypted_frame = get_frame (encrypted); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 72f37f46..70506fc2 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -67,10 +67,10 @@ BOOST_AUTO_TEST_CASE (encryption_test) dcp::dc::Package d ("build/test/DCP/encryption_test"); /* Use test/ref/crypt so this test is repeatable */ - shared_ptr<dcp::dc::CertificateChain> signer (new dcp::dc::CertificateChain ()); - signer->add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); - signer->add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); - signer->add (dcp::dc::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); + shared_ptr<dcp::CertificateChain> signer (new dcp::CertificateChain ()); + signer->add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/ca.self-signed.pem"))); + signer->add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/intermediate.signed.pem"))); + signer->add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); signer->set_key (dcp::file_to_string ("test/ref/crypt/leaf.key")); shared_ptr<dcp::dc::CPL> cpl (new dcp::dc::CPL ("A Test DCP", dcp::FEATURE)); @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE (encryption_test) cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00"); cpl->set_metadata (xml_metadata); - d.add (cpl); + d.add_cpl (cpl); d.write_xml (dcp::DCP_SMPTE, xml_metadata, signer); @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE (encryption_test) "2012-07-17T04:45:18+00:00" ); - kdm.encrypt (signer, signer->leaf(), vector<dcp::dc::Certificate>(), dcp::MODIFIED_TRANSITIONAL_1).as_xml ("build/test/encryption_test.kdm.xml"); + kdm.encrypt (signer, signer->leaf(), vector<dcp::Certificate>(), dcp::MODIFIED_TRANSITIONAL_1).as_xml ("build/test/encryption_test.kdm.xml"); int r = system ( "xmllint --path schema --nonet --noout --schema schema/SMPTE-430-1-2006-Amd-1-2009-KDM.xsd build/test/encryption_test.kdm.xml " diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc index 48d67add..d41b2567 100644 --- a/test/round_trip_test.cc +++ b/test/round_trip_test.cc @@ -47,7 +47,7 @@ using boost::scoped_array; /** Build an encrypted picture asset and a KDM for it and check that the KDM can be decrypted */ BOOST_AUTO_TEST_CASE (round_trip_test) { - shared_ptr<dcp::dc::CertificateChain> signer (new dcp::dc::CertificateChain ("openssl")); + shared_ptr<dcp::CertificateChain> signer (new dcp::CertificateChain ("openssl")); boost::filesystem::path work_dir = "build/test/round_trip_test"; boost::filesystem::create_directory (work_dir); @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (round_trip_test) boost::filesystem::path const kdm_file = work_dir / "kdm.xml"; - kdm_A.encrypt(signer, signer->leaf(), vector<dcp::dc::Certificate>(), dcp::MODIFIED_TRANSITIONAL_1).as_xml (kdm_file); + kdm_A.encrypt(signer, signer->leaf(), vector<dcp::Certificate>(), dcp::MODIFIED_TRANSITIONAL_1).as_xml (kdm_file); /* Reload the KDM, using our private key to decrypt it */ dcp::dc::DecryptedKDM kdm_B (dcp::dc::EncryptedKDM (dcp::file_to_string (kdm_file)), signer->key().get ()); |
