Christie FTP contains certificate chains, not just leaf certificates.
authorCarl Hetherington <cth@carlh.net>
Thu, 14 May 2020 18:35:32 +0000 (20:35 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 14 May 2020 18:35:32 +0000 (20:35 +0200)
src/wx/barco_alchemy_certificate_panel.cc
src/wx/christie_certificate_panel.cc
src/wx/dolby_doremi_certificate_panel.cc
src/wx/download_certificate_panel.cc
src/wx/download_certificate_panel.h
src/wx/gdc_certificate_panel.cc
src/wx/qube_certificate_panel.cc

index 47dd85e0705a03b9ce87d2cb482cb508a705a62c..d105b4a9cb2a6eaaa1d77ee9d80d385dc3860853 100644 (file)
@@ -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));
index 0795b09e9855c89300516f62fb29cf0713565477..15074cdb66fd6f1771207592baf10d5acbc54afd 100644 (file)
@@ -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;
                }
index c37b42e43796193d4fe1276094aca11ab77a7b70..b047f6468b119bf0d430a417b09814e69ff0a95f 100644 (file)
@@ -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 {
index 461c68966cba83b94d3afc27838f073e55fb78ba..34e6136ae39d5085f875553e3b58554d832003a8 100644 (file)
@@ -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
 {
index f51bcde133c3ec49f88cfc64306b9e72ddfff32d..2ad03f7c0c96d1a00a82d8844684b8a52bc0b53c 100644 (file)
@@ -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:
index a4301087dea1980f1dcda2f8c7990214a7206fe9..ffd7de52f444626d58cc2e6568e7aba6d8220da2 100644 (file)
@@ -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(""));
index de2ece88959ea0ecdd6da1c0987ac5f38e42c272..3def3b9d448c589ec1b5a48f5c7c45bd24c74147 100644 (file)
@@ -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(""));