Merge master.
authorCarl Hetherington <cth@carlh.net>
Wed, 6 Aug 2014 14:37:57 +0000 (15:37 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 6 Aug 2014 14:37:57 +0000 (15:37 +0100)
1  2 
ChangeLog
cscript
src/lib/config.cc
src/lib/config.h
src/lib/kdm.cc
src/wx/about_dialog.cc
src/wx/config_dialog.cc

diff --combined ChangeLog
index 0a1f804b93789b8ac1ad807443f0ba0f33ea22d1,884f384bbb7350c600b8baea8746da750199ddba..d25196832ee9985848b7f841895e5398dfd4f16d
+++ b/ChangeLog
@@@ -1,17 -1,11 +1,25 @@@
 +2014-07-15  Carl Hetherington  <cth@carlh.net>
 +
 +      * A variety of changes were made on the 2.0 branch
 +      but not documented in the ChangeLog.  Most sigificantly:
 +
 +      - DCP import
 +      - Creation of DCPs with proper XML subtitles
 +      - Import of .srt and .xml subtitles
 +      - Audio processing framework (with some basic processors).
 +
 +2014-03-07  Carl Hetherington  <cth@carlh.net>
 +
 +      * Add subtitle view.
 +
+ 2014-08-04  Carl Hetherington  <cth@carlh.net>
+       * Add BCC option for KDM emails.
+ 2014-07-29  Carl Hetherington  <cth@carlh.net>
+       * Version 1.72.5 released.
  2014-07-17  Carl Hetherington  <cth@carlh.net>
  
        * Fix corrupted text in job descriptions in some cases.
@@@ -50,7 -44,6 +58,7 @@@
  2014-07-10  Carl Hetherington  <cth@carlh.net>
  
        * Version 1.72.2 released.
 +>>>>>>> origin/master
  
  2014-07-10  Carl Hetherington  <cth@carlh.net>
  
diff --combined cscript
index bdf7dffa44d4eb1ee2578c0a07f6125fc7c59094,05a7f868ccbfd6ff8c66580377b41767e0fe025a..86dab4306d15d233fa01c8b934f397c657573add
+++ b/cscript
@@@ -157,7 -157,7 +157,7 @@@ def make_control(debian_version, bits, 
  
  def dependencies(target):
      return (('ffmpeg-cdist', '7e95caa'),
 -            ('libdcp', '7f029e7'))
 +            ('libdcp', '1.0'))
  
  def build(target, options):
      cmd = './waf configure --prefix=%s' % target.directory
@@@ -217,29 -217,26 +217,26 @@@ def package_debian(target, cpu, version
      return debs
  
  def package_centos(target, cpu, version):
-     os.makedirs('%s/rpmbuild/BUILD' % target.directory)
-     os.makedirs('%s/rpmbuild/RPMS' % target.directory)
-     os.makedirs('%s/rpmbuild/SOURCES' % target.directory)
-     os.makedirs('%s/rpmbuild/SPECS' % target.directory)
-     os.makedirs('%s/rpmbuild/SRPMS' % target.directory)
-     f = open('%s/.rpmmacros' % target.dir_in_chroot, 'w')
-     print >>f,"%%_topdir %srpmbuild" % target.dir_in_chroot
-     f.close()
+     topdir = os.path.realpath('build/rpmbuild')
+     os.makedirs('%s/BUILD' % topdir)
+     os.makedirs('%s/RPMS' % topdir)
+     os.makedirs('%s/SOURCES' % topdir)
+     os.makedirs('%s/SPECS' % topdir)
+     os.makedirs('%s/SRPMS' % topdir)
  
      target.command('./waf dist')
      shutil.copyfile(
          "%s/src/dcpomatic/dcpomatic-%s.tar.bz2" % (target.directory, version),
-         "%s/rpmbuild/SOURCES/dcpomatic-%s.tar.bz2" % (target.directory, version)
+         "%s/SOURCES/dcpomatic-%s.tar.bz2" % (topdir, version)
          )
  
-     target.command('rpmbuild -bb build/platform/linux/dcpomatic.spec')
+     target.command('rpmbuild --define \'_topdir %s\' -bb build/platform/linux/dcpomatic.spec' % topdir)
      rpms = []
  
      if cpu == "amd64":
          cpu = "x86_64"
  
-     for p in glob.glob('%s/rpmbuild/RPMS/%s/*.rpm' % (target.directory, cpu)):
+     for p in glob.glob('%s/RPMS/%s/*.rpm' % (topdir, cpu)):
          rpms.append(os.path.abspath(p))
  
      return rpms
diff --combined src/lib/config.cc
index 1fd4792c3bbf80f6d721a190264f4479b7659793,ee1b01386e4d6561154ebc084d39fa536cd92db7..14539044d2eb53b11f2465ea4e753e75a0ab1f93
  #include <glib.h>
  #include <boost/filesystem.hpp>
  #include <boost/algorithm/string.hpp>
 -#include <libdcp/colour_matrix.h>
 -#include <libdcp/raw_convert.h>
 +#include <dcp/colour_matrix.h>
 +#include <dcp/raw_convert.h>
 +#include <dcp/signer.h>
 +#include <dcp/certificate_chain.h>
  #include <libcxml/cxml.h>
  #include "config.h"
  #include "server.h"
  #include "filter.h"
  #include "ratio.h"
  #include "dcp_content_type.h"
 -#include "sound_processor.h"
 +#include "cinema_sound_processor.h"
  #include "colour_conversion.h"
  #include "cinema.h"
  #include "util.h"
 +#include "cross.h"
  
  #include "i18n.h"
  
@@@ -53,7 -50,7 +53,7 @@@ using boost::shared_ptr
  using boost::optional;
  using boost::algorithm::is_any_of;
  using boost::algorithm::split;
 -using libdcp::raw_convert;
 +using dcp::raw_convert;
  
  Config* Config::_instance = 0;
  
@@@ -63,7 -60,7 +63,7 @@@ Config::Config (
        , _server_port_base (6192)
        , _use_any_servers (true)
        , _tms_path (".")
 -      , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750")))
 +      , _cinema_sound_processor (CinemaSoundProcessor::from_id (N_("dolby_cp750")))
        , _allow_any_dcp_frame_rate (false)
        , _default_still_length (10)
        , _default_scale (Ratio::from_id ("185"))
@@@ -83,9 -80,9 +83,9 @@@
        _allowed_dcp_frame_rates.push_back (50);
        _allowed_dcp_frame_rates.push_back (60);
  
 -      _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6));
 -      _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, libdcp::colour_matrix::srgb_to_xyz, 2.6));
 -      _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, dcp::colour_matrix::srgb_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6));
  
        reset_kdm_email ();
  }
@@@ -94,6 -91,7 +94,6 @@@ voi
  Config::read ()
  {
        if (!boost::filesystem::exists (file (false))) {
 -              read_old_metadata ();
                return;
        }
  
  
        c = f.optional_string_child ("SoundProcessor");
        if (c) {
 -              _sound_processor = SoundProcessor::from_id (c.get ());
 +              _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
 +      }
 +      c = f.optional_string_child ("CinemaSoundProcessor");
 +      if (c) {
 +              _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
        }
  
        _language = f.optional_string_child ("Language");
                /* Loading version 0 (before Rec. 709 was added as a preset).
                   Add it in.
                */
 -              _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6));
 +              _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6));
        }
  
        list<cxml::NodePtr> cin = f.node_children ("Cinema");
        _kdm_subject = f.optional_string_child ("KDMSubject").get_value_or (_("KDM delivery: $CPL_NAME"));
        _kdm_from = f.string_child ("KDMFrom");
        _kdm_cc = f.optional_string_child ("KDMCC").get_value_or ("");
+       _kdm_bcc = f.optional_string_child ("KDMBCC").get_value_or ("");
        _kdm_email = f.string_child ("KDMEmail");
  
        _check_for_updates = f.optional_bool_child("CheckForUpdates").get_value_or (false);
        _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate");
  
        _log_types = f.optional_number_child<int> ("LogTypes").get_value_or (Log::TYPE_GENERAL | Log::TYPE_WARNING | Log::TYPE_ERROR);
 -}
  
 -void
 -Config::read_old_metadata ()
 -{
 -      /* XXX: this won't work with non-Latin filenames */
 -      ifstream f (file(true).string().c_str ());
 -      string line;
 -
 -      while (getline (f, line)) {
 -              if (line.empty ()) {
 -                      continue;
 +      cxml::NodePtr signer = f.optional_node_child ("Signer");
 +      dcp::CertificateChain signer_chain;
 +      if (signer) {
 +              /* Read the signing certificates and private key in from the config file */
 +              list<cxml::NodePtr> certificates = signer->node_children ("Certificate");
 +              for (list<cxml::NodePtr>::const_iterator i = certificates.begin(); i != certificates.end(); ++i) {
 +                      signer_chain.add (dcp::Certificate ((*i)->content ()));
                }
  
 -              if (line[0] == '#') {
 -                      continue;
 -              }
 +              _signer.reset (new dcp::Signer (signer_chain, signer->string_child ("PrivateKey")));
 +      } else {
 +              /* Make a new set of signing certificates and key */
 +              _signer.reset (new dcp::Signer (openssl_path ()));
 +      }
  
 -              size_t const s = line.find (' ');
 -              if (s == string::npos) {
 -                      continue;
 -              }
 -              
 -              string const k = line.substr (0, s);
 -              string const v = line.substr (s + 1);
 -
 -              if (k == N_("num_local_encoding_threads")) {
 -                      _num_local_encoding_threads = atoi (v.c_str ());
 -              } else if (k == N_("default_directory")) {
 -                      _default_directory = v;
 -              } else if (k == N_("server_port")) {
 -                      _server_port_base = atoi (v.c_str ());
 -              } else if (k == N_("server")) {
 -                      vector<string> b;
 -                      split (b, v, is_any_of (" "));
 -                      if (b.size() == 2) {
 -                              _servers.push_back (b[0]);
 -                      }
 -              } else if (k == N_("tms_ip")) {
 -                      _tms_ip = v;
 -              } else if (k == N_("tms_path")) {
 -                      _tms_path = v;
 -              } else if (k == N_("tms_user")) {
 -                      _tms_user = v;
 -              } else if (k == N_("tms_password")) {
 -                      _tms_password = v;
 -              } else if (k == N_("sound_processor")) {
 -                      _sound_processor = SoundProcessor::from_id (v);
 -              } else if (k == "language") {
 -                      _language = v;
 -              } else if (k == "default_container") {
 -                      _default_container = Ratio::from_id (v);
 -              } else if (k == "default_dcp_content_type") {
 -                      _default_dcp_content_type = DCPContentType::from_isdcf_name (v);
 -              } else if (k == "dcp_metadata_issuer") {
 -                      _dcp_metadata.issuer = v;
 -              } else if (k == "dcp_metadata_creator") {
 -                      _dcp_metadata.creator = v;
 -              } else if (k == "dcp_metadata_issue_date") {
 -                      _dcp_metadata.issue_date = v;
 -              }
 +      if (f.optional_string_child ("DecryptionCertificate")) {
 +              _decryption_certificate = dcp::Certificate (f.string_child ("DecryptionCertificate"));
 +      }
 +
 +      if (f.optional_string_child ("DecryptionPrivateKey")) {
 +              _decryption_private_key = f.string_child ("DecryptionPrivateKey");
 +      }
  
 -              _default_isdcf_metadata.read_old_metadata (k, v);
 +      if (!f.optional_string_child ("DecryptionCertificate") || !f.optional_string_child ("DecryptionPrivateKey")) {
 +              /* Generate our own decryption certificate and key if either is not present in config */
 +              boost::filesystem::path p = dcp::make_certificate_chain (openssl_path ());
 +              _decryption_certificate = dcp::Certificate (dcp::file_to_string (p / "leaf.signed.pem"));
 +              _decryption_private_key = dcp::file_to_string (p / "leaf.key");
 +              boost::filesystem::remove_all (p);
        }
  }
  
@@@ -261,6 -289,17 +262,6 @@@ Config::file (bool old) cons
        return p;
  }
  
 -boost::filesystem::path
 -Config::signer_chain_directory () const
 -{
 -      boost::filesystem::path p;
 -      p /= g_get_user_config_dir ();
 -      p /= "dcpomatic";
 -      p /= "crypt";
 -      boost::filesystem::create_directories (p);
 -      return p;
 -}
 -
  /** @return Singleton instance */
  Config *
  Config::instance ()
@@@ -303,8 -342,8 +304,8 @@@ Config::write () cons
        root->add_child("TMSPath")->add_child_text (_tms_path);
        root->add_child("TMSUser")->add_child_text (_tms_user);
        root->add_child("TMSPassword")->add_child_text (_tms_password);
 -      if (_sound_processor) {
 -              root->add_child("SoundProcessor")->add_child_text (_sound_processor->id ());
 +      if (_cinema_sound_processor) {
 +              root->add_child("CinemaSoundProcessor")->add_child_text (_cinema_sound_processor->id ());
        }
        if (_language) {
                root->add_child("Language")->add_child_text (_language.get());
        root->add_child("KDMSubject")->add_child_text (_kdm_subject);
        root->add_child("KDMFrom")->add_child_text (_kdm_from);
        root->add_child("KDMCC")->add_child_text (_kdm_cc);
+       root->add_child("KDMBCC")->add_child_text (_kdm_bcc);
        root->add_child("KDMEmail")->add_child_text (_kdm_email);
  
        root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
        root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth));
        root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
        root->add_child("LogTypes")->add_child_text (raw_convert<string> (_log_types));
 -      
 +
 +      xmlpp::Element* signer = root->add_child ("Signer");
 +      dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf ();
 +      for (dcp::CertificateChain::List::const_iterator i = certs.begin(); i != certs.end(); ++i) {
 +              signer->add_child("Certificate")->add_child_text (i->certificate (true));
 +      }
 +      signer->add_child("PrivateKey")->add_child_text (_signer->key ());
 +
 +      root->add_child("DecryptionCertificate")->add_child_text (_decryption_certificate.certificate (true));
 +      root->add_child("DecryptionPrivateKey")->add_child_text (_decryption_private_key);
 +
        doc.write_to_file_formatted (file(false).string ());
  }
  
diff --combined src/lib/config.h
index d8ac75beddd48e79fc98b3653d9f75f6c1b15c96,0ce6b8351a4b0a48d5fb3a0791112edd5edd2ba1..310d3c6f5e2ca4624761c1b22ab44fa95e85ebc6
  #include <boost/shared_ptr.hpp>
  #include <boost/signals2.hpp>
  #include <boost/filesystem.hpp>
 -#include <libdcp/metadata.h>
 +#include <dcp/metadata.h>
 +#include <dcp/certificates.h>
 +#include <dcp/signer.h>
  #include "isdcf_metadata.h"
  #include "colour_conversion.h"
 -#include "server.h"
  
  class ServerDescription;
  class Scaler;
  class Filter;
 -class SoundProcessor;
 +class CinemaSoundProcessor;
  class DCPContentType;
  class Ratio;
  class Cinema;
@@@ -105,9 -104,9 +105,9 @@@ public
                return _tms_password;
        }
  
 -      /** @return The sound processor that we are using */
 -      SoundProcessor const * sound_processor () const {
 -              return _sound_processor;
 +      /** @return The cinema sound processor that we are using */
 +      CinemaSoundProcessor const * cinema_sound_processor () const {
 +              return _cinema_sound_processor;
        }
  
        std::list<boost::shared_ptr<Cinema> > cinemas () const {
                return _default_dcp_content_type;
        }
  
 -      libdcp::XMLMetadata dcp_metadata () const {
 +      dcp::XMLMetadata dcp_metadata () const {
                return _dcp_metadata;
        }
  
        std::string kdm_cc () const {
                return _kdm_cc;
        }
+       std::string kdm_bcc () const {
+               return _kdm_bcc;
+       }
        
        std::string kdm_email () const {
                return _kdm_email;
        }
  
 +      boost::shared_ptr<const dcp::Signer> signer () const {
 +              return _signer;
 +      }
 +
 +      dcp::Certificate decryption_certificate () const {
 +              return _decryption_certificate;
 +      }
 +
 +      std::string decryption_private_key () const {
 +              return _decryption_private_key;
 +      }
 +
        bool check_for_updates () const {
                return _check_for_updates;
        }
                changed ();
        }
  
 -      void set_dcp_metadata (libdcp::XMLMetadata m) {
 +      void set_dcp_metadata (dcp::XMLMetadata m) {
                _dcp_metadata = m;
                changed ();
        }
                _kdm_cc = f;
                changed ();
        }
+       void set_kdm_bcc (std::string f) {
+               _kdm_bcc = f;
+               changed ();
+       }
        
        void set_kdm_email (std::string e) {
                _kdm_email = e;
  
        void reset_kdm_email ();
  
 +      void set_signer (boost::shared_ptr<const dcp::Signer> s) {
 +              _signer = s;
 +              changed ();
 +      }
 +
 +      void set_decryption_certificate (dcp::Certificate c) {
 +              _decryption_certificate = c;
 +              changed ();
 +      }
 +
 +      void set_decryption_private_key (std::string k) {
 +              _decryption_private_key = k;
 +              changed ();
 +      }
 +
        void set_check_for_updates (bool c) {
                _check_for_updates = c;
                changed ();
                changed ();
        }
        
 -      boost::filesystem::path signer_chain_directory () const;
 -
        void changed ();
        boost::signals2::signal<void ()> Changed;
  
@@@ -416,6 -399,7 +425,6 @@@ private
        Config ();
        boost::filesystem::path file (bool) const;
        void read ();
 -      void read_old_metadata ();
        void write () const;
  
        /** number of threads to use for J2K encoding on the local machine */
        std::string _tms_user;
        /** Password to log into the TMS with */
        std::string _tms_password;
 -      /** Our sound processor */
 -      SoundProcessor const * _sound_processor;
 +      /** Our cinema sound processor */
 +      CinemaSoundProcessor const * _cinema_sound_processor;
        std::list<int> _allowed_dcp_frame_rates;
        /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
        bool _allow_any_dcp_frame_rate;
        Ratio const * _default_scale;
        Ratio const * _default_container;
        DCPContentType const * _default_dcp_content_type;
 -      libdcp::XMLMetadata _dcp_metadata;
 +      dcp::XMLMetadata _dcp_metadata;
        int _default_j2k_bandwidth;
        int _default_audio_delay;
        std::vector<PresetColourConversion> _colour_conversions;
        std::string _kdm_subject;
        std::string _kdm_from;
        std::string _kdm_cc;
+       std::string _kdm_bcc;
        std::string _kdm_email;
 +      boost::shared_ptr<const dcp::Signer> _signer;
 +      dcp::Certificate _decryption_certificate;
 +      std::string _decryption_private_key;
        /** true to check for updates on startup */
        bool _check_for_updates;
        bool _check_for_test_updates;
diff --combined src/lib/kdm.cc
index 0593881bc696498b1ec401ae7d6537a2df300d20,177dec078a8bc0770f6478b762b06014e6cf651d..a2ed1be73498dd924752f998fa154e479ae18cb9
@@@ -21,8 -21,7 +21,8 @@@
  #include <boost/shared_ptr.hpp>
  #include <quickmail.h>
  #include <zip.h>
 -#include <libdcp/kdm.h>
 +#include <dcp/encrypted_kdm.h>
 +#include <dcp/types.h>
  #include "kdm.h"
  #include "cinema.h"
  #include "exceptions.h"
@@@ -38,13 -37,13 +38,13 @@@ using boost::shared_ptr
  
  struct ScreenKDM
  {
 -      ScreenKDM (shared_ptr<Screen> s, libdcp::KDM k)
 +      ScreenKDM (shared_ptr<Screen> s, dcp::EncryptedKDM k)
                : screen (s)
                , kdm (k)
        {}
        
        shared_ptr<Screen> screen;
 -      libdcp::KDM kdm;
 +      dcp::EncryptedKDM kdm;
  };
  
  static string
@@@ -105,17 -104,17 +105,17 @@@ make_screen_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
 -      list<libdcp::KDM> kdms = film->make_kdms (screens, cpl, from, to, formulation);
 +      list<dcp::EncryptedKDM> kdms = film->make_kdms (screens, cpl, from, to, formulation);
           
        list<ScreenKDM> screen_kdms;
        
        list<shared_ptr<Screen> >::iterator i = screens.begin ();
 -      list<libdcp::KDM>::iterator j = kdms.begin ();
 +      list<dcp::EncryptedKDM>::iterator j = kdms.begin ();
        while (i != screens.end() && j != kdms.end ()) {
                screen_kdms.push_back (ScreenKDM (*i, *j));
                ++i;
@@@ -130,9 -129,9 +130,9 @@@ make_cinema_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
        list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to, formulation);
@@@ -176,9 -175,9 +176,9 @@@ write_kdm_files 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation,
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation,
        boost::filesystem::path directory
        )
  {
@@@ -197,9 -196,9 +197,9 @@@ write_kdm_zip_files 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation,
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation,
        boost::filesystem::path directory
        )
  {
@@@ -217,9 -216,9 +217,9 @@@ email_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
        list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to, formulation);
                if (!Config::instance()->kdm_cc().empty ()) {
                        quickmail_add_cc (mail, Config::instance()->kdm_cc().c_str ());
                }
+               if (!Config::instance()->kdm_bcc().empty ()) {
+                       quickmail_add_bcc (mail, Config::instance()->kdm_bcc().c_str ());
+               }
                
                string body = Config::instance()->kdm_email().c_str();
                boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ());
diff --combined src/wx/about_dialog.cc
index 9c7857c1e72c1dc6fddb8d6465446b651bc625fd,8898a662998fdf535b1cfcce296452b4c951f87e..1d9b038997542374bd34f128921447cee8822671
@@@ -1,5 -1,5 +1,5 @@@
  /*
 -    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
 +    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
  
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
  
  */
  
 +/** @file  src/wx/about_dialog.cc
 + *  @brief The "about DCP-o-matic" dialogue box.
 + */
 +
  #include <wx/notebook.h>
  #include <wx/hyperlink.h>
  #include "lib/version.h"
@@@ -124,6 -120,7 +124,7 @@@ AboutDialog::AboutDialog (wxWindow* par
        supported_by.Add (wxT ("Cinema Clarici"));
        supported_by.Add (wxT ("Adam Colt"));
        supported_by.Add (wxT ("Matthias Damm"));
+       supported_by.Add (wxT ("Alexey Derevyanko"));
        supported_by.Add (wxT ("Andres Fink"));
        supported_by.Add (wxT ("Evan Freeze"));
        supported_by.Add (wxT ("Silvio Giuliano"));
        supported_by.Add (wxT ("Lasse Salling"));
        supported_by.Add (wxT ("Mike Stiebing"));
        supported_by.Add (wxT ("Randy Stankey"));
+       supported_by.Add (wxT ("Bruce Taylor"));
        supported_by.Add (wxT ("Wolfgang Woehl"));
        supported_by.Add (wxT ("Wolfram Weber"));
        supported_by.Add (wxT ("Frank de Wulf"));
        SetSizerAndFit (overall_sizer);
  }
  
 +/** Add a section of credits.
 + *  @param name Name of section.
 + *  @param credits List of names.
 + */
  void
  AboutDialog::add_section (wxString name, wxArrayString credits)
  {
diff --combined src/wx/config_dialog.cc
index 8e27dc540856829651788014866674e54a335112,234ac319dfa0947068083c3f666cd33a3c126b96..175ed94ade131a754781e69476f9d6d6f4f3a534
  #include <wx/preferences.h>
  #include <wx/filepicker.h>
  #include <wx/spinctrl.h>
 -#include <libdcp/colour_matrix.h>
 +#include <dcp/colour_matrix.h>
 +#include <dcp/exceptions.h>
 +#include <dcp/signer.h>
  #include "lib/config.h"
  #include "lib/ratio.h"
  #include "lib/scaler.h"
  #include "lib/filter.h"
  #include "lib/dcp_content_type.h"
  #include "lib/colour_conversion.h"
 +#include "lib/log.h"
 +#include "lib/util.h"
 +#include "lib/cross.h"
 +#include "lib/exceptions.h"
  #include "config_dialog.h"
  #include "wx_util.h"
  #include "editable_list.h"
@@@ -112,6 -106,7 +112,6 @@@ public
                _num_local_encoding_threads = new wxSpinCtrl (panel);
                table->Add (_num_local_encoding_threads, 1);
  
 -              
                _check_for_updates = new wxCheckBox (panel, wxID_ANY, _("Check for updates on startup"));
                table->Add (_check_for_updates, 1, wxEXPAND | wxALL);
                table->AddSpacer (0);
@@@ -415,14 -410,14 +415,14 @@@ private
  
        void issuer_changed ()
        {
 -              libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
 +              dcp::XMLMetadata m = Config::instance()->dcp_metadata ();
                m.issuer = wx_to_std (_issuer->GetValue ());
                Config::instance()->set_dcp_metadata (m);
        }
        
        void creator_changed ()
        {
 -              libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
 +              dcp::XMLMetadata m = Config::instance()->dcp_metadata ();
                m.creator = wx_to_std (_creator->GetValue ());
                Config::instance()->set_dcp_metadata (m);
        }
@@@ -551,310 -546,6 +551,310 @@@ private
        }
  };
  
 +class KeysPage : public wxPreferencesPage, public Page
 +{
 +public:
 +      KeysPage (wxSize panel_size, int border)
 +              : Page (panel_size, border)
 +      {}
 +
 +      wxString GetName () const
 +      {
 +              return _("Keys");
 +      }
 +
 +#ifdef DCPOMATIC_OSX
 +      wxBitmap GetLargeIcon () const
 +      {
 +              return wxBitmap ("keys", wxBITMAP_TYPE_PNG_RESOURCE);
 +      }
 +#endif        
 +
 +      wxWindow* CreateWindow (wxWindow* parent)
 +      {
 +              _panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, _panel_size);
 +              wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
 +              _panel->SetSizer (overall_sizer);
 +
 +              wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Certificate chain for signing DCPs and KDMs:"));
 +              overall_sizer->Add (m, 0, wxALL, _border);
 +              
 +              wxBoxSizer* certificates_sizer = new wxBoxSizer (wxHORIZONTAL);
 +              overall_sizer->Add (certificates_sizer, 0, wxLEFT | wxRIGHT, _border);
 +              
 +              _certificates = new wxListCtrl (_panel, wxID_ANY, wxDefaultPosition, wxSize (400, 200), wxLC_REPORT | wxLC_SINGLE_SEL);
 +
 +              {
 +                      wxListItem ip;
 +                      ip.SetId (0);
 +                      ip.SetText (_("Type"));
 +                      ip.SetWidth (100);
 +                      _certificates->InsertColumn (0, ip);
 +              }
 +
 +              {
 +                      wxListItem ip;
 +                      ip.SetId (1);
 +                      ip.SetText (_("Thumbprint"));
 +                      ip.SetWidth (300);
 +
 +                      wxFont font = ip.GetFont ();
 +                      font.SetFamily (wxFONTFAMILY_TELETYPE);
 +                      ip.SetFont (font);
 +                      
 +                      _certificates->InsertColumn (1, ip);
 +              }
 +
 +              certificates_sizer->Add (_certificates, 1, wxEXPAND);
 +
 +              {
 +                      wxSizer* s = new wxBoxSizer (wxVERTICAL);
 +                      _add_certificate = new wxButton (_panel, wxID_ANY, _("Add..."));
 +                      s->Add (_add_certificate, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
 +                      _remove_certificate = new wxButton (_panel, wxID_ANY, _("Remove"));
 +                      s->Add (_remove_certificate, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
 +                      certificates_sizer->Add (s, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
 +              }
 +
 +              wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
 +              table->AddGrowableCol (1, 1);
 +              overall_sizer->Add (table, 1, wxALL | wxEXPAND, _border);
 +
 +              add_label_to_sizer (table, _panel, _("Private key for leaf certificate"), true);
 +              {
 +                      wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
 +                      _signer_private_key = new wxStaticText (_panel, wxID_ANY, wxT (""));
 +                      wxFont font = _signer_private_key->GetFont ();
 +                      font.SetFamily (wxFONTFAMILY_TELETYPE);
 +                      _signer_private_key->SetFont (font);
 +                      s->Add (_signer_private_key, 1, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
 +                      _load_signer_private_key = new wxButton (_panel, wxID_ANY, _("Load..."));
 +                      s->Add (_load_signer_private_key, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
 +                      table->Add (s, 0);
 +              }
 +
 +              add_label_to_sizer (table, _panel, _("Certificate for decrypting DCPs"), true);
 +              {
 +                      wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
 +                      _decryption_certificate = new wxStaticText (_panel, wxID_ANY, wxT (""));
 +                      wxFont font = _decryption_certificate->GetFont ();
 +                      font.SetFamily (wxFONTFAMILY_TELETYPE);
 +                      _decryption_certificate->SetFont (font);
 +                      s->Add (_decryption_certificate, 1, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
 +                      _load_decryption_certificate = new wxButton (_panel, wxID_ANY, _("Load..."));
 +                      s->Add (_load_decryption_certificate, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
 +                      table->Add (s, 0);
 +              }
 +
 +              add_label_to_sizer (table, _panel, _("Private key for decrypting DCPs"), true);
 +              {
 +                      wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
 +                      _decryption_private_key = new wxStaticText (_panel, wxID_ANY, wxT (""));
 +                      wxFont font = _decryption_private_key->GetFont ();
 +                      font.SetFamily (wxFONTFAMILY_TELETYPE);
 +                      _decryption_private_key->SetFont (font);
 +                      s->Add (_decryption_private_key, 1, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
 +                      _load_decryption_private_key = new wxButton (_panel, wxID_ANY, _("Load..."));
 +                      s->Add (_load_decryption_private_key, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
 +                      table->Add (s, 0);
 +              }
 +
 +              _export_decryption_certificate = new wxButton (_panel, wxID_ANY, _("Export DCP decryption certificate..."));
 +              table->Add (_export_decryption_certificate);
 +              table->AddSpacer (0);
 +              
 +              _add_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::add_certificate, this));
 +              _remove_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::remove_certificate, this));
 +              _certificates->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&KeysPage::update_sensitivity, this));
 +              _certificates->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&KeysPage::update_sensitivity, this));
 +              _load_signer_private_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_signer_private_key, this));
 +              _load_decryption_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_decryption_certificate, this));
 +              _load_decryption_private_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::load_decryption_private_key, this));
 +              _export_decryption_certificate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KeysPage::export_decryption_certificate, this));
 +
 +              _signer.reset (new dcp::Signer (*Config::instance()->signer().get ()));
 +
 +              update_certificate_list ();
 +              update_signer_private_key ();
 +              update_decryption_certificate ();
 +              update_decryption_private_key ();
 +              update_sensitivity ();
 +
 +              return _panel;
 +      }
 +
 +private:
 +      void add_certificate ()
 +      {
 +              wxFileDialog* d = new wxFileDialog (_panel, _("Select Certificate File"));
 +              
 +              if (d->ShowModal() == wxID_OK) {
 +                      try {
 +                              dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ())));
 +                              _signer->certificates().add (c);
 +                              Config::instance()->set_signer (_signer);
 +                              update_certificate_list ();
 +                      } catch (dcp::MiscError& e) {
 +                              error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
 +                      }
 +              }
 +              
 +              d->Destroy ();
 +
 +              update_sensitivity ();
 +      }
 +
 +      void remove_certificate ()
 +      {
 +              int i = _certificates->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
 +              if (i == -1) {
 +                      return;
 +              }
 +              
 +              _certificates->DeleteItem (i);
 +              _signer->certificates().remove (i);
 +              Config::instance()->set_signer (_signer);
 +
 +              update_sensitivity ();
 +      }
 +
 +      void update_certificate_list ()
 +      {
 +              _certificates->DeleteAllItems ();
 +              dcp::CertificateChain::List certs = _signer->certificates().root_to_leaf ();
 +              size_t n = 0;
 +              for (dcp::CertificateChain::List::const_iterator i = certs.begin(); i != certs.end(); ++i) {
 +                      wxListItem item;
 +                      item.SetId (n);
 +                      _certificates->InsertItem (item);
 +                      _certificates->SetItem (n, 1, std_to_wx (i->thumbprint ()));
 +
 +                      if (n == 0) {
 +                              _certificates->SetItem (n, 0, _("Root"));
 +                      } else if (n == (certs.size() - 1)) {
 +                              _certificates->SetItem (n, 0, _("Leaf"));
 +                      } else {
 +                              _certificates->SetItem (n, 0, _("Intermediate"));
 +                      }
 +
 +                      ++n;
 +              }
 +      }
 +
 +      void update_sensitivity ()
 +      {
 +              _remove_certificate->Enable (_certificates->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1);
 +      }
 +
 +      void update_signer_private_key ()
 +      {
 +              _signer_private_key->SetLabel (std_to_wx (dcp::private_key_fingerprint (_signer->key ())));
 +      }       
 +
 +      void load_signer_private_key ()
 +      {
 +              wxFileDialog* d = new wxFileDialog (_panel, _("Select Key File"));
 +
 +              if (d->ShowModal() == wxID_OK) {
 +                      try {
 +                              boost::filesystem::path p (wx_to_std (d->GetPath ()));
 +                              if (boost::filesystem::file_size (p) > 1024) {
 +                                      error_dialog (_panel, wxString::Format (_("Could not read key file (%s)"), std_to_wx (p.string ())));
 +                                      return;
 +                              }
 +                              
 +                              _signer->set_key (dcp::file_to_string (p));
 +                              Config::instance()->set_signer (_signer);
 +                              update_signer_private_key ();
 +                      } catch (dcp::MiscError& e) {
 +                              error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
 +                      }
 +              }
 +              
 +              d->Destroy ();
 +
 +              update_sensitivity ();
 +
 +      }
 +
 +      void load_decryption_certificate ()
 +      {
 +              wxFileDialog* d = new wxFileDialog (_panel, _("Select Certificate File"));
 +              
 +              if (d->ShowModal() == wxID_OK) {
 +                      try {
 +                              dcp::Certificate c (dcp::file_to_string (wx_to_std (d->GetPath ())));
 +                              Config::instance()->set_decryption_certificate (c);
 +                              update_decryption_certificate ();
 +                      } catch (dcp::MiscError& e) {
 +                              error_dialog (_panel, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
 +                      }
 +              }
 +              
 +              d->Destroy ();
 +      }
 +
 +      void update_decryption_certificate ()
 +      {
 +              _decryption_certificate->SetLabel (std_to_wx (Config::instance()->decryption_certificate().thumbprint ()));
 +      }
 +
 +      void load_decryption_private_key ()
 +      {
 +              wxFileDialog* d = new wxFileDialog (_panel, _("Select Key File"));
 +
 +              if (d->ShowModal() == wxID_OK) {
 +                      try {
 +                              boost::filesystem::path p (wx_to_std (d->GetPath ()));
 +                              Config::instance()->set_decryption_private_key (dcp::file_to_string (p));
 +                              update_decryption_private_key ();
 +                      } catch (dcp::MiscError& e) {
 +                              error_dialog (_panel, wxString::Format (_("Could not read key file (%s)"), e.what ()));
 +                      }
 +              }
 +              
 +              d->Destroy ();
 +      }
 +
 +      void update_decryption_private_key ()
 +      {
 +              _decryption_private_key->SetLabel (std_to_wx (dcp::private_key_fingerprint (Config::instance()->decryption_private_key())));
 +      }
 +
 +      void export_decryption_certificate ()
 +      {
 +              wxFileDialog* d = new wxFileDialog (
 +                      _panel, _("Select Certificate File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"),
 +                      wxFD_SAVE | wxFD_OVERWRITE_PROMPT
 +                      );
 +              
 +              if (d->ShowModal () == wxID_OK) {
 +                      FILE* f = fopen_boost (wx_to_std (d->GetPath ()), "w");
 +                      if (!f) {
 +                              throw OpenFileError (wx_to_std (d->GetPath ()));
 +                      }
 +
 +                      string const s = Config::instance()->decryption_certificate().certificate (true);
 +                      fwrite (s.c_str(), 1, s.length(), f);
 +                      fclose (f);
 +              }
 +              d->Destroy ();
 +      }
 +
 +      wxPanel* _panel;
 +      wxListCtrl* _certificates;
 +      wxButton* _add_certificate;
 +      wxButton* _remove_certificate;
 +      wxStaticText* _signer_private_key;
 +      wxButton* _load_signer_private_key;
 +      wxStaticText* _decryption_certificate;
 +      wxButton* _load_decryption_certificate;
 +      wxStaticText* _decryption_private_key;
 +      wxButton* _load_decryption_private_key;
 +      wxButton* _export_decryption_certificate;
 +      shared_ptr<dcp::Signer> _signer;
 +};
 +
  class TMSPage : public wxPreferencesPage, public Page
  {
  public:
@@@ -1006,9 -697,13 +1006,13 @@@ public
                add_label_to_sizer (table, panel, _("CC address"), true);
                _kdm_cc = new wxTextCtrl (panel, wxID_ANY);
                table->Add (_kdm_cc, 1, wxEXPAND | wxALL);
+               add_label_to_sizer (table, panel, _("BCC address"), true);
+               _kdm_bcc = new wxTextCtrl (panel, wxID_ANY);
+               table->Add (_kdm_bcc, 1, wxEXPAND | wxALL);
                
                _kdm_email = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (480, 128), wxTE_MULTILINE);
 -              s->Add (_kdm_email, 1.5, wxEXPAND | wxALL, _border);
 +              s->Add (_kdm_email, 1, wxEXPAND | wxALL, _border);
  
                _reset_kdm_email = new wxButton (panel, wxID_ANY, _("Reset to default text"));
                s->Add (_reset_kdm_email, 0, wxEXPAND | wxALL, _border);
                _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_from_changed, this));
                _kdm_cc->SetValue (std_to_wx (config->kdm_cc ()));
                _kdm_cc->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_cc_changed, this));
+               _kdm_bcc->SetValue (std_to_wx (config->kdm_bcc ()));
+               _kdm_bcc->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_bcc_changed, this));
                _kdm_email->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_email_changed, this));
                _kdm_email->SetValue (std_to_wx (Config::instance()->kdm_email ()));
                _reset_kdm_email->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KDMEmailPage::reset_kdm_email, this));
@@@ -1063,6 -760,11 +1069,11 @@@ private
        {
                Config::instance()->set_kdm_cc (wx_to_std (_kdm_cc->GetValue ()));
        }
+       void kdm_bcc_changed ()
+       {
+               Config::instance()->set_kdm_bcc (wx_to_std (_kdm_bcc->GetValue ()));
+       }
        
        void kdm_email_changed ()
        {
        wxTextCtrl* _kdm_subject;
        wxTextCtrl* _kdm_from;
        wxTextCtrl* _kdm_cc;
+       wxTextCtrl* _kdm_bcc;
        wxTextCtrl* _kdm_email;
        wxButton* _reset_kdm_email;
  };
@@@ -1209,7 -912,6 +1221,7 @@@ create_config_dialog (
        e->AddPage (new DefaultsPage (ps, border));
        e->AddPage (new EncodingServersPage (ps, border));
        e->AddPage (new ColourConversionsPage (ps, border));
 +      e->AddPage (new KeysPage (ps, border));
        e->AddPage (new TMSPage (ps, border));
        e->AddPage (new KDMEmailPage (ps, border));
        e->AddPage (new AdvancedPage (ps, border));