From: Carl Hetherington Date: Thu, 30 Jul 2015 01:10:26 +0000 (+0100) Subject: Changes to libdcp. X-Git-Tag: v2.1.32~15 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=0242efb9802d7bcbde0701a7267972d4dbe5abb8 Changes to libdcp. --- diff --git a/src/lib/cinema.h b/src/lib/cinema.h index fea4f1c14..4639261c3 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -22,7 +22,7 @@ */ #include -#include +#include #include class Cinema; diff --git a/src/lib/config.cc b/src/lib/config.cc index e600056ad..b75791a45 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -30,7 +30,6 @@ #include "cross.h" #include "raw_convert.h" #include -#include #include #include #include @@ -121,7 +120,7 @@ Config::read () { if (!boost::filesystem::exists (file ())) { /* Make a new set of signing certificates and key */ - _signer.reset (new dcp::Signer (openssl_path ())); + _signer.reset (new dcp::CertificateChain (openssl_path ())); /* And decryption keys */ make_decryption_keys (); return; @@ -236,16 +235,17 @@ Config::read () cxml::NodePtr signer = f.optional_node_child ("Signer"); dcp::CertificateChain signer_chain; if (signer) { + shared_ptr c (new dcp::CertificateChain ()); /* Read the signing certificates and private key in from the config file */ list certificates = signer->node_children ("Certificate"); for (list::const_iterator i = certificates.begin(); i != certificates.end(); ++i) { - signer_chain.add (dcp::Certificate ((*i)->content ())); + c->add (dcp::Certificate ((*i)->content ())); } - - _signer.reset (new dcp::Signer (signer_chain, signer->string_child ("PrivateKey"))); + c->set_key (signer->string_child ("PrivateKey")); + _signer = c; } else { /* Make a new set of signing certificates and key */ - _signer.reset (new dcp::Signer (openssl_path ())); + _signer.reset (new dcp::CertificateChain (openssl_path ())); } if (f.optional_string_child ("DecryptionCertificate")) { @@ -265,10 +265,9 @@ Config::read () void Config::make_decryption_keys () { - boost::filesystem::path p = dcp::make_certificate_chain (openssl_path ()); - _decryption_certificate = dcp::Certificate (dcp::file_to_string (p / "leaf.signed.pem")); - _decryption_private_key = dcp::file_to_string (p / "leaf.key"); - boost::filesystem::remove_all (p); + dcp::CertificateChain c (openssl_path ()); + _decryption_certificate = c.leaf (); + _decryption_private_key = c.key().get (); } /** @return Filename to write configuration to */ @@ -380,11 +379,11 @@ Config::write () const #endif xmlpp::Element* signer = root->add_child ("Signer"); - dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf (); + dcp::CertificateChain::List certs = _signer->root_to_leaf (); for (dcp::CertificateChain::List::const_iterator i = certs.begin(); i != certs.end(); ++i) { signer->add_child("Certificate")->add_child_text (i->certificate (true)); } - signer->add_child("PrivateKey")->add_child_text (_signer->key ()); + signer->add_child("PrivateKey")->add_child_text (_signer->key().get ()); root->add_child("DecryptionCertificate")->add_child_text (_decryption_certificate.certificate (true)); root->add_child("DecryptionPrivateKey")->add_child_text (_decryption_private_key); diff --git a/src/lib/config.h b/src/lib/config.h index b008fe22f..913c2abc3 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -27,8 +27,8 @@ #include "isdcf_metadata.h" #include "video_content.h" #include -#include -#include +#include +#include #include #include #include @@ -199,7 +199,7 @@ public: return _kdm_email; } - boost::shared_ptr signer () const { + boost::shared_ptr signer () const { return _signer; } @@ -376,7 +376,7 @@ public: void reset_kdm_email (); - void set_signer (boost::shared_ptr s) { + void set_signer (boost::shared_ptr s) { maybe_set (_signer, s); } @@ -489,7 +489,7 @@ private: std::string _kdm_cc; std::string _kdm_bcc; std::string _kdm_email; - boost::shared_ptr _signer; + boost::shared_ptr _signer; dcp::Certificate _decryption_certificate; std::string _decryption_private_key; /** true to check for updates on startup */ diff --git a/src/lib/film.cc b/src/lib/film.cc index e935e76bc..548c51796 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -45,7 +45,7 @@ #include "md5_digester.h" #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ using boost::starts_with; using boost::optional; using boost::is_any_of; using dcp::Size; -using dcp::Signer; +using dcp::CertificateChain; #define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); #define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, Log::TYPE_GENERAL); @@ -1063,7 +1063,7 @@ Film::make_kdm ( ) const { shared_ptr cpl (new dcp::CPL (cpl_file)); - shared_ptr signer = Config::instance()->signer(); + shared_ptr signer = Config::instance()->signer(); if (!signer->valid ()) { throw InvalidSignerError (); } diff --git a/src/lib/util.cc b/src/lib/util.cc index dad094b6e..ede1d4e9b 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -36,7 +36,6 @@ #include "audio_processor.h" #include "safe_stringstream.h" #include -#include #include #include #include diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 863b49959..7b2cfa3d2 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -597,7 +597,7 @@ Writer::finish () meta.creator = String::compose ("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit); meta.set_issue_date_now (); - shared_ptr signer; + shared_ptr signer; if (_film->is_signed ()) { signer = Config::instance()->signer (); /* We did check earlier, but check again here to be on the safe side */ diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 345b90545..0a43a91f2 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -22,7 +22,7 @@ */ #include -#include +#include #include "lib/film.h" #include "lib/cinema.h" #include "lib/kdm.h" diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 53adcd0a0..fd6bcb086 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -39,7 +39,7 @@ #include "lib/cross.h" #include "lib/exceptions.h" #include -#include +#include #include #include #include @@ -676,7 +676,7 @@ private: void config_changed () { - _signer.reset (new dcp::Signer (*Config::instance()->signer().get ())); + _signer.reset (new dcp::CertificateChain (*Config::instance()->signer().get ())); update_certificate_list (); update_signer_private_key (); @@ -692,7 +692,7 @@ private: if (d->ShowModal() == wxID_OK) { try { dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ()))); - _signer->certificates().add (c); + _signer->add (c); Config::instance()->set_signer (_signer); update_certificate_list (); } catch (dcp::MiscError& e) { @@ -713,7 +713,7 @@ private: } _certificates->DeleteItem (i); - _signer->certificates().remove (i); + _signer->remove (i); Config::instance()->set_signer (_signer); update_sensitivity (); @@ -722,7 +722,7 @@ private: void update_certificate_list () { _certificates->DeleteAllItems (); - dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf (); + dcp::CertificateChain::List certs = _signer->root_to_leaf (); size_t n = 0; for (dcp::CertificateChain::List::const_iterator i = certs.begin(); i != certs.end(); ++i) { wxListItem item; @@ -744,11 +744,11 @@ private: void remake_certificates () { - dcp::CertificateChain chain = Config::instance()->signer()->certificates (); + shared_ptr chain = Config::instance()->signer(); string intermediate_common_name; - if (chain.root_to_leaf().size() >= 3) { - dcp::CertificateChain::List all = chain.root_to_leaf (); + if (chain->root_to_leaf().size() >= 3) { + dcp::CertificateChain::List all = chain->root_to_leaf (); dcp::CertificateChain::List::iterator i = all.begin (); ++i; intermediate_common_name = i->subject_common_name (); @@ -756,16 +756,16 @@ private: MakeSignerChainDialog* d = new MakeSignerChainDialog ( _panel, - chain.root().subject_organization_name (), - chain.root().subject_organizational_unit_name (), - chain.root().subject_common_name (), + chain->root().subject_organization_name (), + chain->root().subject_organizational_unit_name (), + chain->root().subject_common_name (), intermediate_common_name, - chain.leaf().subject_common_name () + chain->leaf().subject_common_name () ); if (d->ShowModal () == wxID_OK) { _signer.reset ( - new dcp::Signer ( + new dcp::CertificateChain ( openssl_path (), d->organisation (), d->organisational_unit (), @@ -790,7 +790,7 @@ private: void update_signer_private_key () { - checked_set (_signer_private_key, dcp::private_key_fingerprint (_signer->key ())); + checked_set (_signer_private_key, dcp::private_key_fingerprint (_signer->key().get ())); } void load_signer_private_key () @@ -894,7 +894,7 @@ private: wxStaticText* _decryption_private_key; wxButton* _load_decryption_private_key; wxButton* _export_decryption_certificate; - shared_ptr _signer; + shared_ptr _signer; }; class TMSPage : public StandardPage diff --git a/src/wx/screen_dialog.h b/src/wx/screen_dialog.h index 69d0fff81..cf8d3da18 100644 --- a/src/wx/screen_dialog.h +++ b/src/wx/screen_dialog.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include "table_dialog.h" class Progress;