- if (d->ShowModal() == wxID_OK) {
- optional<dcp::EncryptedKDM> kdm;
- try {
- kdm = dcp::EncryptedKDM (dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE));
- } catch (exception& e) {
- error_dialog (_parent, _("Could not load KDM"), std_to_wx(e.what()));
- d->Destroy ();
- return;
- }
-
- /* Try to decrypt it to get an early preview of any errors */
- try {
- decrypt_kdm_with_helpful_error (*kdm);
- } catch (KDMError& e) {
- error_dialog (_parent, std_to_wx(e.summary()), std_to_wx(e.detail()));
- return;
- } catch (exception& e) {
- error_dialog (_parent, e.what());
- return;
- }