summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wx/barco_alchemy_certificate_panel.cc2
-rw-r--r--src/wx/christie_certificate_panel.cc4
-rw-r--r--src/wx/dolby_doremi_certificate_panel.cc2
-rw-r--r--src/wx/download_certificate_panel.cc17
-rw-r--r--src/wx/download_certificate_panel.h3
-rw-r--r--src/wx/gdc_certificate_panel.cc2
-rw-r--r--src/wx/qube_certificate_panel.cc2
7 files changed, 24 insertions, 8 deletions
diff --git a/src/wx/barco_alchemy_certificate_panel.cc b/src/wx/barco_alchemy_certificate_panel.cc
index 47dd85e07..d105b4a9c 100644
--- a/src/wx/barco_alchemy_certificate_panel.cc
+++ b/src/wx/barco_alchemy_certificate_panel.cc
@@ -61,7 +61,7 @@ BarcoAlchemyCertificatePanel::do_download ()
serial
);
- optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load_certificate, this, _1));
if (error) {
_dialog->message()->SetLabel(wxT(""));
error_dialog (this, std_to_wx(*error));
diff --git a/src/wx/christie_certificate_panel.cc b/src/wx/christie_certificate_panel.cc
index 0795b09e9..15074cdb6 100644
--- a/src/wx/christie_certificate_panel.cc
+++ b/src/wx/christie_certificate_panel.cc
@@ -60,13 +60,13 @@ ChristieCertificatePanel::do_download ()
optional<string> all_errors;
- optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
if (error) {
all_errors = *error;
string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
- error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
if (error) {
*all_errors += "\n" + *error;
}
diff --git a/src/wx/dolby_doremi_certificate_panel.cc b/src/wx/dolby_doremi_certificate_panel.cc
index c37b42e43..b047f6468 100644
--- a/src/wx/dolby_doremi_certificate_panel.cc
+++ b/src/wx/dolby_doremi_certificate_panel.cc
@@ -177,7 +177,7 @@ DolbyDoremiCertificatePanel::do_download ()
list<string>::const_iterator i = urls.begin ();
list<string>::const_iterator j = files.begin ();
while (!ok && i != urls.end ()) {
- optional<string> error = get_from_zip_url (*i++, *j++, true, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_zip_url (*i++, *j++, true, true, boost::bind (&DownloadCertificatePanel::load_certificate, this, _1));
if (error) {
errors.push_back (error.get ());
} else {
diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc
index 461c68966..34e6136ae 100644
--- a/src/wx/download_certificate_panel.cc
+++ b/src/wx/download_certificate_panel.cc
@@ -24,6 +24,7 @@
#include "lib/signal_manager.h"
#include "lib/compose.hpp"
#include <dcp/util.h>
+#include <dcp/certificate_chain.h>
#include <dcp/exceptions.h>
#include <boost/bind.hpp>
@@ -53,8 +54,9 @@ DownloadCertificatePanel::DownloadCertificatePanel (DownloadCertificateDialog* d
_overall_sizer->SetSizeHints (this);
}
+
optional<string>
-DownloadCertificatePanel::load (boost::filesystem::path file)
+DownloadCertificatePanel::load_certificate (boost::filesystem::path file)
{
try {
_certificate = dcp::Certificate (dcp::file_to_string (file));
@@ -64,6 +66,19 @@ DownloadCertificatePanel::load (boost::filesystem::path file)
return optional<string>();
}
+
+optional<string>
+DownloadCertificatePanel::load_certificate_from_chain (boost::filesystem::path file)
+{
+ try {
+ _certificate = dcp::CertificateChain (dcp::file_to_string(file)).leaf();
+ } catch (dcp::MiscError& e) {
+ return String::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what());
+ }
+ return optional<string>();
+}
+
+
optional<dcp::Certificate>
DownloadCertificatePanel::certificate () const
{
diff --git a/src/wx/download_certificate_panel.h b/src/wx/download_certificate_panel.h
index f51bcde13..2ad03f7c0 100644
--- a/src/wx/download_certificate_panel.h
+++ b/src/wx/download_certificate_panel.h
@@ -37,7 +37,8 @@ public:
virtual bool ready_to_download () const;
void download ();
- boost::optional<std::string> load (boost::filesystem::path);
+ boost::optional<std::string> load_certificate (boost::filesystem::path);
+ boost::optional<std::string> load_certificate_from_chain (boost::filesystem::path);
boost::optional<dcp::Certificate> certificate () const;
protected:
diff --git a/src/wx/gdc_certificate_panel.cc b/src/wx/gdc_certificate_panel.cc
index a4301087d..ffd7de52f 100644
--- a/src/wx/gdc_certificate_panel.cc
+++ b/src/wx/gdc_certificate_panel.cc
@@ -53,7 +53,7 @@ GDCCertificatePanel::do_download ()
wx_to_std(_serial->GetValue())
);
- optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1));
if (error) {
_dialog->message()->SetLabel(wxT(""));
diff --git a/src/wx/qube_certificate_panel.cc b/src/wx/qube_certificate_panel.cc
index de2ece889..3def3b9d4 100644
--- a/src/wx/qube_certificate_panel.cc
+++ b/src/wx/qube_certificate_panel.cc
@@ -63,7 +63,7 @@ QubeCertificatePanel::do_download ()
return;
}
- optional<string> error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1));
if (error) {
_dialog->message()->SetLabel(wxT(""));