X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fscreen.cc;h=febf9085c3d344af6a77487c5aed1c04a60a7148;hb=HEAD;hp=2c821eceb0225fb2f51a23b4bf1a8cb9a78d404f;hpb=dd9711df97e605e9015445d00337164b40f1bd00;p=dcpomatic.git diff --git a/src/lib/screen.cc b/src/lib/screen.cc index 2c821eceb..febf9085c 100644 --- a/src/lib/screen.cc +++ b/src/lib/screen.cc @@ -19,10 +19,12 @@ */ -#include "screen.h" -#include "kdm_with_metadata.h" -#include "film.h" #include "cinema.h" +#include "config.h" +#include "film.h" +#include "kdm_util.h" +#include "kdm_with_metadata.h" +#include "screen.h" #include #include #include @@ -73,14 +75,14 @@ Screen::trusted_device_thumbprints () const KDMWithMetadataPtr kdm_for_screen ( - shared_ptr film, - boost::filesystem::path cpl, + std::function make_kdm, shared_ptr screen, boost::posix_time::ptime valid_from, boost::posix_time::ptime valid_to, dcp::Formulation formulation, bool disable_forensic_marking_picture, - optional disable_forensic_marking_audio + optional disable_forensic_marking_audio, + vector& period_checks ) { if (!screen->recipient) { @@ -91,16 +93,16 @@ kdm_for_screen ( dcp::LocalTime const begin(valid_from, dcp::UTCOffset(cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0)); dcp::LocalTime const end (valid_to, dcp::UTCOffset(cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0)); - auto const kdm = film->make_kdm ( - screen->recipient.get(), - screen->trusted_device_thumbprints(), - cpl, - begin, - end, - formulation, - disable_forensic_marking_picture, - disable_forensic_marking_audio - ); + period_checks.push_back(check_kdm_and_certificate_validity_periods(cinema ? cinema->name : "", screen->name, screen->recipient.get(), begin, end)); + + auto signer = Config::instance()->signer_chain(); + if (!signer->valid()) { + throw InvalidSignerError(); + } + + auto kdm = make_kdm(begin, end).encrypt( + signer, screen->recipient.get(), screen->trusted_device_thumbprints(), formulation, disable_forensic_marking_picture, disable_forensic_marking_audio + ); dcp::NameFormat::Map name_values; if (cinema) { @@ -114,6 +116,6 @@ kdm_for_screen ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - return make_shared(name_values, cinema.get(), cinema ? cinema->emails : list(), kdm); + return make_shared(name_values, cinema.get(), cinema ? cinema->emails : vector(), kdm); }