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));
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;
}
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 {
#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>
_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));
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
{
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:
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(""));
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(""));