From 551d099baf7519988354bc3d6699cfa2f12daea1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 15 Feb 2022 16:52:58 +0100 Subject: Allow configurable certificate validity periods. --- src/wx/make_chain_dialog.cc | 15 ++++++++++++++- src/wx/make_chain_dialog.h | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/wx/make_chain_dialog.cc b/src/wx/make_chain_dialog.cc index 4255fb307..a58ef6fdb 100644 --- a/src/wx/make_chain_dialog.cc +++ b/src/wx/make_chain_dialog.cc @@ -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( 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()), diff --git a/src/wx/make_chain_dialog.h b/src/wx/make_chain_dialog.h index 018db99a2..00be22c97 100644 --- a/src/wx/make_chain_dialog.h +++ b/src/wx/make_chain_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,12 +18,17 @@ */ + #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 -- cgit v1.2.3