Allow configurable certificate validity periods. carsten-cert-validity
authorCarl Hetherington <cth@carlh.net>
Tue, 15 Feb 2022 15:52:58 +0000 (16:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 15 Feb 2022 15:52:58 +0000 (16:52 +0100)
src/wx/make_chain_dialog.cc
src/wx/make_chain_dialog.h

index 4255fb307881dcba3a98930b87db7f377f8793dd..a58ef6fdb7371aadafba5ed644d48c4eb3d1f850 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 
+#include "dcpomatic_spin_ctrl.h"
 #include "make_chain_dialog.h"
 #include "static_text.h"
 #include "lib/cross.h"
@@ -118,9 +119,21 @@ MakeChainDialog::MakeChainDialog (
                add (s);
        }
 
+       add (_("Valid for"), true);
+
+       {
+               auto s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (_validity = new SpinCtrl(this, 156), 0, wxALIGN_CENTER_VERTICAL);
+               s->Add (new StaticText(this, _("days")), 0, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
+               add (s);
+       }
+
        layout ();
 
        _organisation->SetFocus ();
+
+       _validity->SetRange (7, 50 * 365);
+       _validity->SetValue (3650);
 }
 
 
@@ -129,7 +142,7 @@ MakeChainDialog::get () const
 {
        return make_shared<dcp::CertificateChain>(
                openssl_path(),
-               CERTIFICATE_VALIDITY_PERIOD,
+               _validity->GetValue(),
                wx_to_std(_organisation->GetValue()),
                wx_to_std(_organisational_unit->GetValue()),
                "." + wx_to_std(_root_common_name->GetValue()),
index 018db99a202c2e2ce7d42ef3c0db60c870ea789b..00be22c9785010bda53d858459fa03b18b6d40d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #ifndef DCPOMATIC_MAKE_CHAIN_DIALOG_H
 #define DCPOMATIC_MAKE_CHAIN_DIALOG_H
 
+
 #include "table_dialog.h"
 #include "wx_util.h"
 
+
+class SpinCtrl;
+
 class MakeChainDialog : public TableDialog
 {
 public:
@@ -37,6 +42,8 @@ private:
        wxTextCtrl* _root_common_name;
        wxTextCtrl* _intermediate_common_name;
        wxTextCtrl* _leaf_common_name;
+       SpinCtrl* _validity;
 };
 
+
 #endif