From f330799459f44d031dc711b947dd2c0cc5a015a3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 8 Jun 2020 02:16:06 +0200 Subject: [PATCH] Remove encryption key options (#1760). --- src/lib/film.cc | 7 ---- src/lib/film.h | 4 +-- src/wx/dcp_panel.cc | 50 +---------------------------- src/wx/dcp_panel.h | 4 --- src/wx/key_dialog.cc | 76 -------------------------------------------- src/wx/key_dialog.h | 37 --------------------- src/wx/wscript | 1 - test/recover_test.cc | 2 +- 8 files changed, 4 insertions(+), 177 deletions(-) delete mode 100644 src/wx/key_dialog.cc delete mode 100644 src/wx/key_dialog.h diff --git a/src/lib/film.cc b/src/lib/film.cc index 2aaeafca6..93a22d186 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1208,13 +1208,6 @@ Film::set_encrypted (bool e) _encrypted = e; } -void -Film::set_key (dcp::Key key) -{ - ChangeSignaller ch (this, KEY); - _key = key; -} - ContentList Film::content () const { diff --git a/src/lib/film.h b/src/lib/film.h index ea60b461d..7f7590210 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -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 friend class ChangeSignaller; boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index d8ddd1bca..4472a14bf 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington + Copyright (C) 2012-2020 Carl Hetherington 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 -#include #include #include #include @@ -103,10 +101,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr 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, weak_ptr 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_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); diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index 69fc65532..258471ffd 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -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 index 2d8cd4c37..000000000 --- a/src/wx/key_dialog.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2015 Carl Hetherington - - 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 . - -*/ - -#include "key_dialog.h" -#include "wx_util.h" -#include "dcpomatic_button.h" -#include - -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 (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 index d7a65aef4..000000000 --- a/src/wx/key_dialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2015 Carl Hetherington - - 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 . - -*/ - -#include "table_dialog.h" -#include - -class KeyDialog : public TableDialog -{ -public: - KeyDialog (wxWindow *, dcp::Key); - - dcp::Key key () const; - -private: - void key_changed (); - void random (); - - wxTextCtrl* _key; - wxButton* _random; -}; diff --git a/src/wx/wscript b/src/wx/wscript index 339ebb1ec..7acbcc56f 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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 diff --git a/test/recover_test.cc b/test/recover_test.cc index 9c1ed7e66..ad7f475bc 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -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 content (new FFmpegContent("test/data/count300bd24.m2ts")); film->examine_and_add_content (content); -- 2.30.2