diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-07-30 02:10:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-07-30 02:10:26 +0100 |
| commit | 0242efb9802d7bcbde0701a7267972d4dbe5abb8 (patch) | |
| tree | 9dcf3d92b3cf3224e0b4ee852f0e38c38c7a477e /src/lib | |
| parent | 9e69c78fe4473279d848341d64ade8c834ebebd7 (diff) | |
Changes to libdcp.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cinema.h | 2 | ||||
| -rw-r--r-- | src/lib/config.cc | 23 | ||||
| -rw-r--r-- | src/lib/config.h | 10 | ||||
| -rw-r--r-- | src/lib/film.cc | 6 | ||||
| -rw-r--r-- | src/lib/util.cc | 1 | ||||
| -rw-r--r-- | src/lib/writer.cc | 4 |
6 files changed, 22 insertions, 24 deletions
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 <libcxml/cxml.h> -#include <dcp/certificates.h> +#include <dcp/certificate.h> #include <boost/enable_shared_from_this.hpp> 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 <dcp/colour_matrix.h> -#include <dcp/signer.h> #include <dcp/certificate_chain.h> #include <libcxml/cxml.h> #include <glib.h> @@ -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<dcp::CertificateChain> c (new dcp::CertificateChain ()); /* Read the signing certificates and private key in from the config file */ list<cxml::NodePtr> certificates = signer->node_children ("Certificate"); for (list<cxml::NodePtr>::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 <dcp/metadata.h> -#include <dcp/certificates.h> -#include <dcp/signer.h> +#include <dcp/certificate.h> +#include <dcp/certificate_chain.h> #include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> #include <boost/filesystem.hpp> @@ -199,7 +199,7 @@ public: return _kdm_email; } - boost::shared_ptr<const dcp::Signer> signer () const { + boost::shared_ptr<const dcp::CertificateChain> signer () const { return _signer; } @@ -376,7 +376,7 @@ public: void reset_kdm_email (); - void set_signer (boost::shared_ptr<const dcp::Signer> s) { + void set_signer (boost::shared_ptr<const dcp::CertificateChain> 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<const dcp::Signer> _signer; + boost::shared_ptr<const dcp::CertificateChain> _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 <libcxml/cxml.h> #include <dcp/cpl.h> -#include <dcp/signer.h> +#include <dcp/certificate_chain.h> #include <dcp/util.h> #include <dcp/local_time.h> #include <dcp/decrypted_kdm.h> @@ -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<const dcp::CPL> cpl (new dcp::CPL (cpl_file)); - shared_ptr<const dcp::Signer> signer = Config::instance()->signer(); + shared_ptr<const dcp::CertificateChain> 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 <dcp/util.h> -#include <dcp/signer.h> #include <dcp/picture_asset.h> #include <dcp/sound_asset.h> #include <dcp/subtitle_asset.h> 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 <dcp/reel_subtitle_asset.h> #include <dcp/dcp.h> #include <dcp/cpl.h> -#include <dcp/signer.h> +#include <dcp/certificate_chain.h> #include <dcp/interop_subtitle_asset.h> #include <dcp/smpte_subtitle_asset.h> #include <boost/foreach.hpp> @@ -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<const dcp::Signer> signer; + shared_ptr<const dcp::CertificateChain> signer; if (_film->is_signed ()) { signer = Config::instance()->signer (); /* We did check earlier, but check again here to be on the safe side */ |
