Allow re-build of signer chain with specified details (#354).
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Sep 2014 13:08:12 +0000 (14:08 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Sep 2014 13:08:12 +0000 (14:08 +0100)
ChangeLog
src/wx/config_dialog.cc
src/wx/make_signer_chain_dialog.cc [new file with mode: 0644]
src/wx/make_signer_chain_dialog.h [new file with mode: 0644]
src/wx/wscript

index 89185d4e62fca3f08dab100a666b55988d9156e1..da343f6bea1f2efcd9c3dfdcd35b2aca4405c07f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-11  Carl Hetherington  <cth@carlh.net>
+
+       * Add option to re-make signing chain with specified organisation,
+       common names etc. (#354)
+
 2014-09-10  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.0.8 released.
index e71b19e3721438059eec18050e8b814de1e9240b..ada0823597957e2a9e4a969045c664bdffd710e8 100644 (file)
@@ -49,6 +49,7 @@
 #include "isdcf_metadata_dialog.h"
 #include "preset_colour_conversion_dialog.h"
 #include "server_dialog.h"
+#include "make_signer_chain_dialog.h"
 
 using std::vector;
 using std::string;
@@ -604,6 +605,10 @@ public:
                table->AddGrowableCol (1, 1);
                overall_sizer->Add (table, 1, wxALL | wxEXPAND, _border);
 
+               _remake_certificates = new wxButton (_panel, wxID_ANY, _("Re-make certificates..."));
+               table->Add (_remake_certificates, 0);
+               table->AddSpacer (0);
+
                add_label_to_sizer (table, _panel, _("Private key for leaf certificate"), true);
                {
                        wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -651,6 +656,7 @@ public:
                _remove_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::remove_certificate, this));
                _certificates->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&KeysPage::update_sensitivity, this));
                _certificates->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&KeysPage::update_sensitivity, this));
+               _remake_certificates->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::remake_certificates, this));
                _load_signer_private_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_signer_private_key, this));
                _load_decryption_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_decryption_certificate, this));
                _load_decryption_private_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_decryption_private_key, this));
@@ -725,6 +731,29 @@ private:
                }
        }
 
+       void remake_certificates ()
+       {
+               MakeSignerChainDialog* d = new MakeSignerChainDialog (_panel);
+               if (d->ShowModal () == wxID_OK) {
+                       _signer.reset (
+                               new dcp::Signer (
+                                       openssl_path (),
+                                       d->organisation (),
+                                       d->organisational_unit (),
+                                       d->root_common_name (),
+                                       d->intermediate_common_name (),
+                                       d->leaf_common_name ()
+                                       )
+                               );
+
+                       Config::instance()->set_signer (_signer);
+                       update_certificate_list ();
+                       update_signer_private_key ();
+               }
+               
+               d->Destroy ();
+       }
+
        void update_sensitivity ()
        {
                _remove_certificate->Enable (_certificates->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1);
@@ -829,6 +858,7 @@ private:
        wxListCtrl* _certificates;
        wxButton* _add_certificate;
        wxButton* _remove_certificate;
+       wxButton* _remake_certificates;
        wxStaticText* _signer_private_key;
        wxButton* _load_signer_private_key;
        wxStaticText* _decryption_certificate;
diff --git a/src/wx/make_signer_chain_dialog.cc b/src/wx/make_signer_chain_dialog.cc
new file mode 100644 (file)
index 0000000..8736f24
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "make_signer_chain_dialog.h"
+
+MakeSignerChainDialog::MakeSignerChainDialog (wxWindow* parent)
+       : TableDialog (parent, _("Make certificate chain"), 2, true)
+{
+       add (_("Organisation"), true);
+       add (_organisation = new wxTextCtrl (this, wxID_ANY));
+       add (_("Organisational unit"), true);
+       add (_organisational_unit = new wxTextCtrl (this, wxID_ANY));
+       add (_("Root common name"), true);
+       add (_root_common_name = new wxTextCtrl (this, wxID_ANY));
+       add (_("Intermediate common name"), true);
+       add (_intermediate_common_name = new wxTextCtrl (this, wxID_ANY));
+       add (_("Leaf common name"), true);
+       add (_leaf_common_name = new wxTextCtrl (this, wxID_ANY));
+}
diff --git a/src/wx/make_signer_chain_dialog.h b/src/wx/make_signer_chain_dialog.h
new file mode 100644 (file)
index 0000000..fc6391a
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "table_dialog.h"
+#include "wx_util.h"
+
+class MakeSignerChainDialog : public TableDialog
+{
+public:
+       MakeSignerChainDialog (wxWindow* parent);
+
+       std::string organisation () const {
+               return wx_to_std (_organisation->GetValue ());
+       }
+
+       std::string organisational_unit () const {
+               return wx_to_std (_organisational_unit->GetValue ());
+       }
+
+       std::string root_common_name () const {
+               return wx_to_std (_root_common_name->GetValue ());
+       }
+
+       std::string intermediate_common_name () const {
+               return wx_to_std (_intermediate_common_name->GetValue ());
+       }
+
+       std::string leaf_common_name () const {
+               return wx_to_std (_leaf_common_name->GetValue ());
+       }
+       
+
+private:
+       wxTextCtrl* _organisation;
+       wxTextCtrl* _organisational_unit;
+       wxTextCtrl* _root_common_name;
+       wxTextCtrl* _intermediate_common_name;
+       wxTextCtrl* _leaf_common_name;
+};
+       
index d6e573891a06e12f93401ce7a42a6bad86945858..0f39038a5f4873eccac693933faedee72eaeec3c 100644 (file)
@@ -32,6 +32,7 @@ sources = """
           job_manager_view.cc
           job_wrapper.cc
           kdm_dialog.cc
+          make_signer_chain_dialog.cc
           new_film_dialog.cc
           preset_colour_conversion_dialog.cc
           properties_dialog.cc