Enforce some restrictions on SSL certificate properties.
authorCarl Hetherington <cth@carlh.net>
Sun, 12 Jul 2015 19:19:30 +0000 (20:19 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Jul 2015 19:19:30 +0000 (20:19 +0100)
ChangeLog
src/wx/make_signer_chain_dialog.cc
src/wx/make_signer_chain_dialog.h

index 20f9a74d8331fab73abb2a0eb85936ebbc39a351..0d962e7b2effa3b8d6011655d26c4377bbcd0f07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-12  Carl Hetherington  <cth@carlh.net>
+
+       * Enforce restrictions on SSL certificate properties.
+
 2015-07-09  Carl Hetherington  <cth@carlh.net>
 
        * Improve 'best' frame rate guess in some cases (#633).
index 5211fa5476c7211687e22ddbbbe1d100b00b5b4e..8df208934372512b9a7f20adf6dcc676b5b3c49b 100644 (file)
 MakeSignerChainDialog::MakeSignerChainDialog (wxWindow* parent)
        : TableDialog (parent, _("Make certificate chain"), 2, true)
 {
+       wxTextValidator validator (wxFILTER_EXCLUDE_CHAR_LIST);
+       validator.SetCharExcludes (wxT ("/"));
+
        add (_("Organisation"), true);
-       add (_organisation = new wxTextCtrl (this, wxID_ANY));
+       add (_organisation = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, validator));
        add (_("Organisational unit"), true);
-       add (_organisational_unit = new wxTextCtrl (this, wxID_ANY));
+       add (_organisational_unit = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, validator));
+
        add (_("Root common name"), true);
-       add (_root_common_name = new wxTextCtrl (this, wxID_ANY));
+
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL);
+               s->Add (_root_common_name = new wxTextCtrl (
+                               this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
+                       );
+               add (s);
+       }
+
        add (_("Intermediate common name"), true);
-       add (_intermediate_common_name = new wxTextCtrl (this, wxID_ANY));
+
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL);
+               s->Add (_intermediate_common_name = new wxTextCtrl (
+                               this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
+                       );
+               add (s);
+       }
+
        add (_("Leaf common name"), true);
-       add (_leaf_common_name = new wxTextCtrl (this, wxID_ANY));
+
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (new wxStaticText (this, wxID_ANY, wxT ("CS.")), 0, wxALIGN_CENTER_VERTICAL);
+               s->Add (_leaf_common_name = new wxTextCtrl (
+                               this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
+                       );
+               add (s);
+       }
 
        layout ();
 
index 6d018c0dc021ebb109612a8b0b225d987e46d6f5..d05b4381f831b627ba726612c5362535c1c43c6c 100644 (file)
@@ -34,15 +34,15 @@ public:
        }
 
        std::string root_common_name () const {
-               return wx_to_std (_root_common_name->GetValue ());
+               return "." + wx_to_std (_root_common_name->GetValue ());
        }
 
        std::string intermediate_common_name () const {
-               return wx_to_std (_intermediate_common_name->GetValue ());
+               return "." + wx_to_std (_intermediate_common_name->GetValue ());
        }
 
        std::string leaf_common_name () const {
-               return wx_to_std (_leaf_common_name->GetValue ());
+               return "CS." + wx_to_std (_leaf_common_name->GetValue ());
        }
 
 
@@ -53,4 +53,3 @@ private:
        wxTextCtrl* _intermediate_common_name;
        wxTextCtrl* _leaf_common_name;
 };
-