diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-19 20:44:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-19 20:44:42 +0100 |
| commit | 8d6c3c9ae554430582dcb016897e87f6d04d5d78 (patch) | |
| tree | 5b329eeb60fe7372cc89740d4cf8fa1d5fe51614 /test | |
| parent | 827901db3d834465b1121c9f8041b9faf4923ec9 (diff) | |
Various encryption-related stuff.
Diffstat (limited to 'test')
| -rw-r--r-- | test/certificates_test.cc | 9 | ||||
| -rw-r--r-- | test/dcp_test.cc | 2 | ||||
| -rw-r--r-- | test/encryption_test.cc | 12 | ||||
| -rw-r--r-- | test/error_test.cc | 4 | ||||
| -rw-r--r-- | test/kdm_test.cc | 28 | ||||
| -rw-r--r-- | test/recovery_test.cc | 4 |
6 files changed, 31 insertions, 28 deletions
diff --git a/test/certificates_test.cc b/test/certificates_test.cc index 40e550cb..ba29549b 100644 --- a/test/certificates_test.cc +++ b/test/certificates_test.cc @@ -21,9 +21,9 @@ BOOST_AUTO_TEST_CASE (certificates) { libdcp::CertificateChain c; - 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"))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("test/ref/crypt/ca.self-signed.pem")))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("test/ref/crypt/intermediate.signed.pem")))); + c.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("test/ref/crypt/leaf.signed.pem")))); list<shared_ptr<libdcp::Certificate> > leaf_to_root = c.leaf_to_root (); @@ -71,4 +71,7 @@ BOOST_AUTO_TEST_CASE (certificates) "dnQualifier=ndND9A/cODo2rTdrbLVmfQnoaSc=,CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION,OU=example.org,O=example.org" ); + /* Check that reconstruction from a string works */ + libdcp::Certificate test (c.root()->certificate (true)); + BOOST_CHECK_EQUAL (test.certificate(), c.root()->certificate()); } diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 1b943694..d4207d5a 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -45,7 +45,6 @@ BOOST_AUTO_TEST_CASE (dcp_test) &d.Progress, 24, 24, - false, libdcp::Size (32, 32), false, mxf_meta @@ -60,7 +59,6 @@ BOOST_AUTO_TEST_CASE (dcp_test) 24, 2, false, - false, mxf_meta )); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 1b0de19a..3501befc 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -39,9 +39,9 @@ BOOST_AUTO_TEST_CASE (encryption) libdcp::DCP d ("build/test/DCP/bar"); libdcp::CertificateChain chain; - chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("build/test/signer/ca.self-signed.pem"))); - chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("build/test/signer/intermediate.signed.pem"))); - chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate ("build/test/signer/leaf.signed.pem"))); + chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("build/test/signer/ca.self-signed.pem")))); + chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("build/test/signer/intermediate.signed.pem")))); + chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (boost::filesystem::path ("build/test/signer/leaf.signed.pem")))); shared_ptr<libdcp::Signer> signer ( new libdcp::Signer ( @@ -59,12 +59,13 @@ BOOST_AUTO_TEST_CASE (encryption) &d.Progress, 24, 24, - true, libdcp::Size (32, 32), false, mxf_metadata )); + mp->set_key (libdcp::Key ()); + shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( wav, "build/test/bar", @@ -73,10 +74,11 @@ BOOST_AUTO_TEST_CASE (encryption) 24, 24, 2, - true, false, mxf_metadata )); + + ms->set_key (libdcp::Key ()); cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); d.add_cpl (cpl); diff --git a/test/error_test.cc b/test/error_test.cc index 380363b4..5477ca5a 100644 --- a/test/error_test.cc +++ b/test/error_test.cc @@ -29,12 +29,12 @@ BOOST_AUTO_TEST_CASE (error_test) /* Trying to create video/audio MXFs using a non-existant file should throw an exception */ BOOST_CHECK_THROW ( - new libdcp::MonoPictureAsset (p, "build/test/fred", "video.mxf", &d.Progress, 24, 24, false, libdcp::Size (32, 32), false), + new libdcp::MonoPictureAsset (p, "build/test/fred", "video.mxf", &d.Progress, 24, 24, libdcp::Size (32, 32), false), libdcp::FileError ); BOOST_CHECK_THROW ( - new libdcp::SoundAsset (p, "build/test/fred", "audio.mxf", &d.Progress, 24, 24, false, false), + new libdcp::SoundAsset (p, "build/test/fred", "audio.mxf", &d.Progress, 24, 24, false), libdcp::FileError ); } diff --git a/test/kdm_test.cc b/test/kdm_test.cc index f536e189..a85bada7 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -26,19 +26,19 @@ BOOST_AUTO_TEST_CASE (kdm_test) "test/data/private.key" ); - list<libdcp::KDMCipher> ciphers = kdm.ciphers (); + list<libdcp::KDMKey> keys = kdm.keys (); - BOOST_CHECK_EQUAL (ciphers.size(), 2); - - BOOST_CHECK_EQUAL (ciphers.front().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f"); - BOOST_CHECK_EQUAL (ciphers.front().key_id(), "4ac4f922-8239-4831-b23b-31426d0542c4"); - BOOST_CHECK_EQUAL (ciphers.front().not_valid_before(), "2013-07-06T20:04:58+00:00"); - BOOST_CHECK_EQUAL (ciphers.front().not_valid_after(), "2023-07-02T20:04:56+00:00"); - BOOST_CHECK_EQUAL (ciphers.front().key_string(), "8a2729c3e5b65c45d78305462104c3fb"); - - BOOST_CHECK_EQUAL (ciphers.back().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f"); - BOOST_CHECK_EQUAL (ciphers.back().key_id(), "73baf5de-e195-4542-ab28-8a465f7d4079"); - BOOST_CHECK_EQUAL (ciphers.back().not_valid_before(), "2013-07-06T20:04:58+00:00"); - BOOST_CHECK_EQUAL (ciphers.back().not_valid_after(), "2023-07-02T20:04:56+00:00"); - BOOST_CHECK_EQUAL (ciphers.back().key_string(), "5327fb7ec2e807bd57059615bf8a169d"); + BOOST_CHECK_EQUAL (keys.size(), 2); + + BOOST_CHECK_EQUAL (keys.front().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f"); + BOOST_CHECK_EQUAL (keys.front().key_id(), "4ac4f922-8239-4831-b23b-31426d0542c4"); + BOOST_CHECK_EQUAL (keys.front().not_valid_before(), "2013-07-06T20:04:58+00:00"); + BOOST_CHECK_EQUAL (keys.front().not_valid_after(), "2023-07-02T20:04:56+00:00"); + BOOST_CHECK_EQUAL (keys.front().key().hex(), "8a2729c3e5b65c45d78305462104c3fb"); + + BOOST_CHECK_EQUAL (keys.back().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f"); + BOOST_CHECK_EQUAL (keys.back().key_id(), "73baf5de-e195-4542-ab28-8a465f7d4079"); + BOOST_CHECK_EQUAL (keys.back().not_valid_before(), "2013-07-06T20:04:58+00:00"); + BOOST_CHECK_EQUAL (keys.back().not_valid_after(), "2023-07-02T20:04:56+00:00"); + BOOST_CHECK_EQUAL (keys.back().key().hex(), "5327fb7ec2e807bd57059615bf8a169d"); } diff --git a/test/recovery_test.cc b/test/recovery_test.cc index 277ea678..d8ffea6a 100644 --- a/test/recovery_test.cc +++ b/test/recovery_test.cc @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (recovery) boost::filesystem::remove_all ("build/test/baz"); boost::filesystem::create_directories ("build/test/baz"); - shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/baz", "video1.mxf", 24, libdcp::Size (32, 32), false)); + shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ("build/test/baz", "video1.mxf", 24, libdcp::Size (32, 32))); shared_ptr<libdcp::PictureAssetWriter> writer = mp->start_write (false, false); int written_size = 0; @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (recovery) Kumu::ResetTestRNG (); #endif - mp.reset (new libdcp::MonoPictureAsset ("build/test/baz", "video2.mxf", 24, libdcp::Size (32, 32), false)); + mp.reset (new libdcp::MonoPictureAsset ("build/test/baz", "video2.mxf", 24, libdcp::Size (32, 32))); writer = mp->start_write (true, false); writer->write (data, size); |
