#include "cinema.h"
+#include "config.h"
#include "film.h"
#include "kdm_util.h"
#include "kdm_with_metadata.h"
KDMWithMetadataPtr
kdm_for_screen (
- shared_ptr<const Film> film,
- boost::filesystem::path cpl,
+ std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm,
shared_ptr<const dcpomatic::Screen> screen,
boost::posix_time::ptime valid_from,
boost::posix_time::ptime valid_to,
period_checks.push_back(check_kdm_and_certificate_validity_periods(screen->recipient.get(), begin, end));
- 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
- );
+ 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) {
name_values['e'] = end.date() + " " + end.time_of_day(true, false);
name_values['i'] = kdm.cpl_id();
- return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : list<string>(), kdm);
+ return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : vector<string>(), kdm);
}