diff options
| -rw-r--r-- | examples/make_dcp.cc | 2 | ||||
| -rw-r--r-- | src/cpl.cc | 9 | ||||
| -rw-r--r-- | src/cpl.h | 7 | ||||
| -rw-r--r-- | src/util.cc | 27 | ||||
| -rw-r--r-- | test/tests.cc | 38 |
5 files changed, 33 insertions, 50 deletions
diff --git a/examples/make_dcp.cc b/examples/make_dcp.cc index 2bcd4fc9..da029f27 100644 --- a/examples/make_dcp.cc +++ b/examples/make_dcp.cc @@ -75,7 +75,7 @@ main () for 2K projectors. */ boost::shared_ptr<libdcp::MonoPictureAsset> picture_asset ( - new libdcp::MonoPictureAsset (video_frame, "My Film DCP", "video.mxf", 0, 24, 48, libdcp::Size (1998, 1080), false) + new libdcp::MonoPictureAsset (video_frame, "My Film DCP", "video.mxf", 0, 24, 48, false, libdcp::Size (1998, 1080)) ); /* Now we will create a `sound asset', which is made up of a WAV file for each channel of audio. Here we're using @@ -18,6 +18,7 @@ */ #include <fstream> +#include <libxml/parser.h> #include "cpl.h" #include "parse/cpl.h" #include "util.h" @@ -317,7 +318,9 @@ CPL::make_kdm ( string const & signer_key, shared_ptr<const Certificate> recipient_cert, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + MXFMetadata const & mxf_metadata, + XMLMetadata const & xml_metadata ) const { assert (recipient_cert); @@ -335,8 +338,8 @@ CPL::make_kdm ( authenticated_public->add_child("MessageId")->add_child_text ("urn:uuid:" + make_uuid()); authenticated_public->add_child("MessageType")->add_child_text ("http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type"); - authenticated_public->add_child("AnnotationText")->add_child_text (MXFMetadata::instance()->product_name); - authenticated_public->add_child("IssueDate")->add_child_text (MXFMetadata::instance()->issue_date); + authenticated_public->add_child("AnnotationText")->add_child_text (mxf_metadata.product_name); + authenticated_public->add_child("IssueDate")->add_child_text (xml_metadata.issue_date); { xmlpp::Element* signer = authenticated_public->add_child("Signer"); @@ -34,7 +34,8 @@ namespace parse { class Asset; class Reel; class XMLMetadata; - class Encryption; +class MXFMetadata; +class Encryption; /** @brief A CPL within a DCP */ class CPL @@ -86,7 +87,9 @@ public: std::string const &, boost::shared_ptr<const Certificate>, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + MXFMetadata const &, + XMLMetadata const & ) const; private: diff --git a/src/util.cc b/src/util.cc index 0c63c305..e4c8122c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -307,20 +307,6 @@ libdcp::init () if (xmlSecInit() < 0) { throw MiscError ("could not initialise xmlsec"); } - -#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING - if (xmlSecCryptoDLLoadLibrary (BAD_CAST XMLSEC_CRYPTO) < 0) { - throw MiscError ("unable to load default xmlsec-crypto library"); - } -#endif - - if (xmlSecCryptoAppInit (0) < 0) { - throw MiscError ("could not initialise crypto library"); - } - - if (xmlSecCryptoInit() < 0) { - throw MiscError ("could not initialise xmlsec-crypto"); - } } void @@ -348,19 +334,6 @@ libdcp::add_signature_value (xmlpp::Element* parent, CertificateChain const & ce if (!keys_manager) { throw MiscError ("could not create keys manager"); } - if (xmlSecCryptoAppDefaultKeysMngrInit (keys_manager) < 0) { - throw MiscError ("could not initialise keys manager"); - } - - xmlSecKeyPtr const key = xmlSecCryptoAppKeyLoad (signer_key.c_str(), xmlSecKeyDataFormatPem, 0, 0, 0); - if (key == 0) { - throw MiscError ("could not load signer key"); - } - - if (xmlSecCryptoAppDefaultKeysMngrAdoptKey (keys_manager, key) < 0) { - xmlSecKeyDestroy (key); - throw MiscError ("could not use signer key"); - } xmlSecDSigCtx signature_context; diff --git a/test/tests.cc b/test/tests.cc index ad31cb86..3bc1508c 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -34,6 +34,7 @@ #include "crypt_chain.h" #include "gamma_lut.h" #include "cpl.h" +#include "encryption.h" #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE libdcp_test @@ -84,8 +85,8 @@ BOOST_AUTO_TEST_CASE (dcp_test) &d.Progress, 24, 24, - libdcp::Size (32, 32), false, + libdcp::Size (32, 32), mxf_meta )); @@ -96,8 +97,6 @@ BOOST_AUTO_TEST_CASE (dcp_test) &(d.Progress), 24, 24, - 0, - 2, 2, false, mxf_meta @@ -597,14 +596,17 @@ BOOST_AUTO_TEST_CASE (color) BOOST_AUTO_TEST_CASE (encryption) { Kumu::libdcp_test = true; + + libdcp::MXFMetadata mxf_metadata; + mxf_metadata.company_name = "OpenDCP"; + mxf_metadata.product_name = "OpenDCP"; + mxf_metadata.product_version = "0.0.25"; + + libdcp::XMLMetadata xml_metadata; + xml_metadata.issuer = "OpenDCP 0.0.25"; + xml_metadata.creator = "OpenDCP 0.0.25"; + xml_metadata.issue_date = "2012-07-17T04:45:18+00:00"; - libdcp::Metadata* t = libdcp::Metadata::instance (); - t->issuer = "OpenDCP 0.0.25"; - t->creator = "OpenDCP 0.0.25"; - t->company_name = "OpenDCP"; - t->product_name = "OpenDCP"; - t->product_version = "0.0.25"; - t->issue_date = "2012-07-17T04:45:18+00:00"; boost::filesystem::remove_all ("build/test/bar"); boost::filesystem::create_directories ("build/test/bar"); libdcp::DCP d ("build/test/bar"); @@ -630,9 +632,9 @@ BOOST_AUTO_TEST_CASE (encryption) &d.Progress, 24, 24, - 32, - 32, - true + true, + libdcp::Size (32, 32), + mxf_metadata )); shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( @@ -642,22 +644,24 @@ BOOST_AUTO_TEST_CASE (encryption) &(d.Progress), 24, 24, - 0, 2, - true + true, + mxf_metadata )); cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); d.add_cpl (cpl); - d.write_xml (crypt); + d.write_xml (xml_metadata, crypt); shared_ptr<xmlpp::Document> kdm = cpl->make_kdm ( crypt->certificates, crypt->signer_key, crypt->certificates.leaf(), boost::posix_time::time_from_string ("2013-01-01 00:00:00"), - boost::posix_time::time_from_string ("2013-01-08 00:00:00") + boost::posix_time::time_from_string ("2013-01-08 00:00:00"), + mxf_metadata, + xml_metadata ); kdm->write_to_file_formatted ("build/test/bar.kdm.xml", "UTF-8"); |
