Remove encryption key options (#1760).
authorCarl Hetherington <cth@carlh.net>
Mon, 8 Jun 2020 00:16:06 +0000 (02:16 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 8 Jun 2020 15:09:15 +0000 (17:09 +0200)
src/lib/film.cc
src/lib/film.h
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/key_dialog.cc [deleted file]
src/wx/key_dialog.h [deleted file]
src/wx/wscript
test/recover_test.cc

index 2aaeafca668382d0ae0042a3190b98b19ab0d8de..93a22d18682dae76bc0fa353014587c72476928c 100644 (file)
@@ -1208,13 +1208,6 @@ Film::set_encrypted (bool e)
        _encrypted = e;
 }
 
-void
-Film::set_key (dcp::Key key)
-{
-       ChangeSignaller<Film> ch (this, KEY);
-       _key = key;
-}
-
 ContentList
 Film::content () const
 {
index ea60b461d426be369606e8be9ef9438da52c5105..7f7590210a045ad3a5a514e1720f5b1ec80b0ac0 100644 (file)
@@ -61,6 +61,7 @@ class Ratio;
 class Job;
 class Film;
 struct isdcf_name_test;
+struct recover_test_2d_encrypted;
 
 class InfoFileHandle
 {
@@ -212,7 +213,6 @@ public:
                CONTAINER,
                RESOLUTION,
                ENCRYPTED,
-               KEY,
                J2K_BANDWIDTH,
                ISDCF_METADATA,
                VIDEO_FRAME_RATE,
@@ -347,7 +347,6 @@ public:
        void set_container (Ratio const *, bool user_explicit = true);
        void set_resolution (Resolution, bool user_explicit = true);
        void set_encrypted (bool);
-       void set_key (dcp::Key key);
        void set_j2k_bandwidth (int);
        void set_isdcf_metadata (ISDCFMetadata);
        void set_video_frame_rate (int rate, bool user_explicit = false);
@@ -387,6 +386,7 @@ public:
 private:
 
        friend struct ::isdcf_name_test;
+       friend struct ::recover_test_2d_encrypted;
        template <typename> friend class ChangeSignaller;
 
        boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const;
index d8ddd1bca1be538e3dddc9ca500f82770ce06b37..4472a14bf6599871ea9828e631c04a213676aec2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -20,7 +20,6 @@
 
 #include "dcp_panel.h"
 #include "wx_util.h"
-#include "key_dialog.h"
 #include "isdcf_metadata_dialog.h"
 #include "audio_dialog.h"
 #include "focus_manager.h"
@@ -42,7 +41,6 @@
 #include "lib/dcp_content.h"
 #include "lib/audio_content.h"
 #include <dcp/locale_convert.h>
-#include <dcp/key.h>
 #include <wx/wx.h>
 #include <wx/notebook.h>
 #include <wx/gbsizer.h>
@@ -103,10 +101,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
         wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
         size.SetHeight (-1);
 
-       _key_label = create_label (_panel, _("Key"), true);
-       _key = new StaticText (_panel, "", wxDefaultPosition, size);
-       _edit_key = new Button (_panel, _("Edit..."));
-
        _reels_label = create_label (_panel, _("Reels"), true);
        _reel_type = new wxChoice (_panel, wxID_ANY);
 
@@ -134,7 +128,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _copy_isdcf_name_button->Bind(wxEVT_BUTTON,   boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
        _dcp_content_type->Bind      (wxEVT_CHOICE,   boost::bind (&DCPPanel::dcp_content_type_changed, this));
        _encrypted->Bind             (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
-       _edit_key->Bind              (wxEVT_BUTTON,   boost::bind (&DCPPanel::edit_key_clicked, this));
        _reel_type->Bind             (wxEVT_CHOICE,   boost::bind (&DCPPanel::reel_type_changed, this));
        _reel_length->Bind           (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
        _standard->Bind              (wxEVT_CHOICE,   boost::bind (&DCPPanel::standard_changed, this));
@@ -205,9 +198,6 @@ DCPPanel::add_to_grid ()
        ++r;
 
 
-       _key_label->Show (full);
-       _key->Show (full);
-       _edit_key->Show (full);
        _reels_label->Show (full);
        _reel_type->Show (full);
        _reel_length_label->Show (full);
@@ -222,15 +212,6 @@ DCPPanel::add_to_grid ()
        _encrypted->Show (full);
 
        if (full) {
-               add_label_to_sizer (_grid, _key_label, true, wxGBPosition (r, 0));
-               {
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-                       s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
-                       s->Add (_edit_key);
-                       _grid->Add (s, wxGBPosition (r, 1));
-               }
-               ++r;
-
                add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
                _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
                ++r;
@@ -259,16 +240,6 @@ DCPPanel::add_to_grid ()
        }
 }
 
-void
-DCPPanel::edit_key_clicked ()
-{
-       KeyDialog* d = new KeyDialog (_panel, _film->key ());
-       if (d->ShowModal () == wxID_OK) {
-               _film->set_key (d->key ());
-       }
-       d->Destroy ();
-}
-
 void
 DCPPanel::name_changed ()
 {
@@ -409,16 +380,6 @@ DCPPanel::film_changed (int p)
                break;
        case Film::ENCRYPTED:
                checked_set (_encrypted, _film->encrypted ());
-               if (_film->encrypted ()) {
-                       _key->Enable (_generally_sensitive);
-                       _edit_key->Enable (_generally_sensitive);
-               } else {
-                       _key->Enable (false);
-                       _edit_key->Enable (false);
-               }
-               break;
-       case Film::KEY:
-               checked_set (_key, _film->key().hex().substr (0, 8) + "...");
                break;
        case Film::RESOLUTION:
                checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
@@ -618,7 +579,6 @@ DCPPanel::set_film (shared_ptr<Film> film)
        film_changed (Film::CONTAINER);
        film_changed (Film::RESOLUTION);
        film_changed (Film::ENCRYPTED);
-       film_changed (Film::KEY);
        film_changed (Film::J2K_BANDWIDTH);
        film_changed (Film::ISDCF_METADATA);
        film_changed (Film::VIDEO_FRAME_RATE);
@@ -650,15 +610,7 @@ DCPPanel::setup_sensitivity ()
        _edit_isdcf_button->Enable      (_generally_sensitive);
        _dcp_content_type->Enable       (_generally_sensitive);
        _copy_isdcf_name_button->Enable (_generally_sensitive);
-
-       bool si = _generally_sensitive;
-       if (_film && _film->encrypted ()) {
-               si = false;
-       }
-
        _encrypted->Enable              (_generally_sensitive);
-       _key->Enable                    (_generally_sensitive && _film && _film->encrypted ());
-       _edit_key->Enable               (_generally_sensitive && _film && _film->encrypted ());
        _reel_type->Enable              (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
        _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
        _upload_after_make_dcp->Enable  (_generally_sensitive);
index 69fc65532fdc4e3d046ece232d6dd9bb0bd2c62d..258471ffd5a6c38e0fce071dba348b521ef116ea 100644 (file)
@@ -73,7 +73,6 @@ private:
        void three_d_changed ();
        void standard_changed ();
        void encrypted_toggled ();
-       void edit_key_clicked ();
        void audio_processor_changed ();
        void show_audio_clicked ();
        void reel_type_changed ();
@@ -139,9 +138,6 @@ private:
        wxStaticText* _standard_label;
        wxChoice* _standard;
        wxCheckBox* _encrypted;
-       wxStaticText* _key_label;
-       wxStaticText* _key;
-       wxButton* _edit_key;
        wxStaticText* _reels_label;
        wxChoice* _reel_type;
        wxStaticText* _reel_length_label;
diff --git a/src/wx/key_dialog.cc b/src/wx/key_dialog.cc
deleted file mode 100644 (file)
index 2d8cd4c..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "key_dialog.h"
-#include "wx_util.h"
-#include "dcpomatic_button.h"
-#include <iostream>
-
-using std::cout;
-
-KeyDialog::KeyDialog (wxWindow* parent, dcp::Key key)
-       : TableDialog (parent, _("Key"), 3, 1, true)
-{
-       add (_("Key"), true);
-
-        wxClientDC dc (parent);
-        wxSize size = dc.GetTextExtent (wxT ("0123456790ABCDEF0123456790ABCDEF"));
-        size.SetHeight (-1);
-
-        wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST);
-        wxArrayString list;
-
-        wxString n (wxT ("0123456789abcdefABCDEF"));
-        for (size_t i = 0; i < n.Length(); ++i) {
-                list.Add (n[i]);
-        }
-
-        validator.SetIncludes (list);
-
-       _key = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, size, 0, validator));
-       _key->SetValue (std_to_wx (key.hex ()));
-       _key->SetMaxLength (32);
-
-       _random = add (new Button(this, _("Random")));
-
-       _key->Bind (wxEVT_TEXT, boost::bind (&KeyDialog::key_changed, this));
-       _random->Bind (wxEVT_BUTTON, boost::bind (&KeyDialog::random, this));
-
-       layout ();
-}
-
-dcp::Key
-KeyDialog::key () const
-{
-       return dcp::Key (wx_to_std (_key->GetValue ()));
-}
-
-void
-KeyDialog::key_changed ()
-{
-       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
-       ok->Enable (_key->GetValue().Length() == 32);
-}
-
-void
-KeyDialog::random ()
-{
-       _key->SetValue (dcp::Key().hex ());
-}
diff --git a/src/wx/key_dialog.h b/src/wx/key_dialog.h
deleted file mode 100644 (file)
index d7a65ae..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
-
-    This file is part of DCP-o-matic.
-
-    DCP-o-matic 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.
-
-    DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "table_dialog.h"
-#include <dcp/key.h>
-
-class KeyDialog : public TableDialog
-{
-public:
-       KeyDialog (wxWindow *, dcp::Key);
-
-       dcp::Key key () const;
-
-private:
-       void key_changed ();
-       void random ();
-
-       wxTextCtrl* _key;
-       wxButton* _random;
-};
index 339ebb1ec8f0dab45fe26646c3ea2660917a4754..7acbcc56f89073302735a3a804028e880cacd9cc 100644 (file)
@@ -91,7 +91,6 @@ sources = """
           kdm_dialog.cc
           kdm_output_panel.cc
           kdm_timing_panel.cc
-          key_dialog.cc
           make_chain_dialog.cc
           markers_dialog.cc
           message_dialog.cc
index 9c1ed7e66e0d7f1172882a26e3843f05c4ad4d78..ad7f475bc0eb5e554a73075cb93ba7c2a24a88c7 100644 (file)
@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("recover_test");
        film->set_encrypted (true);
-       film->set_key (dcp::Key("eafcb91c9f5472edf01f3a2404c57258"));
+       film->_key = dcp::Key("eafcb91c9f5472edf01f3a2404c57258");
 
        shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/count300bd24.m2ts"));
        film->examine_and_add_content (content);