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:47:34 +0000 (18:47 +0000)
Backported from 2c844e57ed5c54e65a2b4484f02907122a03361e in v2.15.x.

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

index 84048c65cf98d97b767577668d14e489e9dad93c..a4156a0e63755fb99f15a08baa7bd327266c60b9 100644 (file)
@@ -60,7 +60,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 9e95aa994531a728a989d153b560bb25e2cd6652..43a9a2432dd14f0ec7af6af9edfa59dcc0b6dfec 100644 (file)
@@ -57,13 +57,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 dee76c43503792a0fec3b9026b3b480c689189ba..f10b42b00ca1d32b04a97a4dc282051112c7b0a7 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 b0bb31674458fc7711a7c6bf634660f1ba73dcb9..2d47b427ee95e8b1d56500373cd49de661de53d3 100644 (file)
@@ -51,7 +51,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(""));