}
/* Encrypt */
- screen_kdms.push_back (ScreenKDM (i, kdm.encrypt (signer, i->recipient.get(), i->trusted_devices, _output->formulation())));
+ screen_kdms.push_back (
+ ScreenKDM (
+ i,
+ kdm.encrypt (
+ signer, i->recipient.get(), i->trusted_devices, _output->formulation(), true, 0
+ )
+ )
+ );
}
pair<shared_ptr<Job>, int> result = _output->make (
} catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
- error_dialog (this, e.what ());
+ error_dialog (this, std_to_wx(e.what()));
} catch (...) {
error_dialog (this, _("An unknown exception occurred."));
}
{
DKDMMap::iterator from = _dkdm_id.find (_dkdm->GetSelection ());
DKDMMap::iterator to = _dkdm_id.find (ev.GetItem ());
- if (from == _dkdm_id.end() || to == _dkdm_id.end()) {
+ if (from == _dkdm_id.end() || to == _dkdm_id.end() || from->first == to->first) {
return;
}
if (d->ShowModal() == wxID_OK) {
shared_ptr<DKDMBase> new_dkdm;
try {
- new_dkdm.reset (
- new DKDM (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)))
- );
+ dcp::EncryptedKDM ekdm(dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE));
+
+ /* Decrypt the DKDM to make sure that we can */
+ shared_ptr<const dcp::CertificateChain> chain = Config::instance()->decryption_chain();
+ DCPOMATIC_ASSERT (chain->key());
+ dcp::DecryptedKDM dkdm(ekdm, chain->key().get());
+
+ new_dkdm.reset(new DKDM(ekdm));
+ shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (selected_dkdm ());
+ if (!group) {
+ group = Config::instance()->dkdms ();
+ }
+ add_dkdm_model (new_dkdm, group);
+ add_dkdm_view (new_dkdm);
} catch (dcp::KDMFormatError& e) {
error_dialog (
this,
- wxString::Format (
- _("Could not read file as a KDM. Perhaps it is badly formatted, or not a KDM at all.\n\n%s"),
- std_to_wx(e.what()).data()
- )
+ _("Could not read file as a KDM. Perhaps it is badly formatted, or not a KDM at all."),
+ std_to_wx(e.what())
);
return;
+ } catch (dcp::KDMDecryptionError) {
+ error_dialog (
+ this,
+ _("Could not decrypt the DKDM. Perhaps it was not created with the correct certificate.")
+ );
}
-
- shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (selected_dkdm ());
- if (!group) {
- group = Config::instance()->dkdms ();
- }
- add_dkdm_model (new_dkdm, group);
- add_dkdm_view (new_dkdm);
}
d->Destroy ();
}
}
catch (exception& e)
{
- error_dialog (0, wxString::Format ("DCP-o-matic could not start: %s", e.what ()));
+ error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what()));
return true;
}