From: Carl Hetherington Date: Tue, 6 Mar 2018 01:15:43 +0000 (+0000) Subject: Merge EncryptionContext with DecryptionContext and use HMAC when decrypting. X-Git-Tag: v1.6.0~20 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=380d7af94562883cdcaa60726d0ffa36f3dab304;p=libdcp.git Merge EncryptionContext with DecryptionContext and use HMAC when decrypting. --- diff --git a/src/asset_reader.h b/src/asset_reader.h index eaf2721a..dbd2761b 100644 --- a/src/asset_reader.h +++ b/src/asset_reader.h @@ -36,21 +36,19 @@ #include "dcp_assert.h" #include "asset.h" -#include "decryption_context.h" +#include "crypto_context.h" #include #include #include namespace dcp { -class DecryptionContext; - template class AssetReader : public boost::noncopyable { public: - explicit AssetReader (Asset const * asset, boost::optional key) - : _decryption_context (new DecryptionContext (key)) + explicit AssetReader (Asset const * asset, boost::optional key, Standard standard) + : _crypto_context (new DecryptionContext (key, standard)) { _reader = new R (); DCP_ASSERT (asset->file ()); @@ -68,12 +66,12 @@ public: boost::shared_ptr get_frame (int n) const { - return boost::shared_ptr (new F (_reader, n, _decryption_context)); + return boost::shared_ptr (new F (_reader, n, _crypto_context)); } protected: R* _reader; - boost::shared_ptr _decryption_context; + boost::shared_ptr _crypto_context; }; } diff --git a/src/asset_writer.cc b/src/asset_writer.cc index 4f5cf4be..c4302f4a 100644 --- a/src/asset_writer.cc +++ b/src/asset_writer.cc @@ -38,7 +38,7 @@ #include "asset_writer.h" #include "mxf.h" #include "dcp_assert.h" -#include "encryption_context.h" +#include "crypto_context.h" #include #include @@ -54,7 +54,7 @@ AssetWriter::AssetWriter (MXF* mxf, boost::filesystem::path file) , _frames_written (0) , _finalized (false) , _started (false) - , _encryption_context (new EncryptionContext (mxf->key(), mxf->standard())) + , _crypto_context (new EncryptionContext (mxf->key(), mxf->standard())) { } diff --git a/src/asset_writer.h b/src/asset_writer.h index bc055d70..dcf57aad 100644 --- a/src/asset_writer.h +++ b/src/asset_writer.h @@ -39,12 +39,12 @@ #define LIBDCP_ASSET_WRITER_H #include "types.h" +#include "crypto_context.h" #include namespace dcp { class MXF; -class EncryptionContext; /** @class AssetWriter * @brief Parent class for classes which can write MXF-based assets. @@ -77,7 +77,7 @@ protected: bool _finalized; /** true if something has been written to this asset */ bool _started; - boost::shared_ptr _encryption_context; + boost::shared_ptr _crypto_context; }; } diff --git a/src/atmos_asset.cc b/src/atmos_asset.cc index ab17493d..1e4d9c18 100644 --- a/src/atmos_asset.cc +++ b/src/atmos_asset.cc @@ -91,7 +91,7 @@ AtmosAsset::pkl_type (Standard) const shared_ptr AtmosAsset::start_read () const { - return shared_ptr (new AtmosAssetReader (this, key ())); + return shared_ptr (new AtmosAssetReader (this, key(), SMPTE)); } shared_ptr diff --git a/src/atmos_asset_writer.cc b/src/atmos_asset_writer.cc index 60529a2c..07d310f6 100644 --- a/src/atmos_asset_writer.cc +++ b/src/atmos_asset_writer.cc @@ -36,7 +36,7 @@ #include "exceptions.h" #include "dcp_assert.h" #include "compose.hpp" -#include "encryption_context.h" +#include "crypto_context.h" #include using std::min; @@ -89,7 +89,7 @@ AtmosAssetWriter::write (uint8_t const * data, int size) _state->frame_buffer.Size (size); memcpy (_state->frame_buffer.Data(), data, size); - ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _encryption_context->encryption(), _encryption_context->hmac()); + ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac()); if (ASDCP_FAILURE (r)) { boost::throw_exception (MiscError (String::compose ("could not write atmos MXF frame (%1)", int (r)))); } diff --git a/src/decryption_context.cc b/src/decryption_context.cc deleted file mode 100644 index 1c1838a8..00000000 --- a/src/decryption_context.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2012-2016 Carl Hetherington - - This file is part of libdcp. - - libdcp 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. - - libdcp 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 libdcp. If not, see . - - In addition, as a special exception, the copyright holders give - permission to link the code of portions of this program with the - OpenSSL library under certain conditions as described in each - individual source file, and distribute linked combinations - including the two. - - You must obey the GNU General Public License in all respects - for all of the code used other than OpenSSL. If you modify - file(s) with this exception, you may extend this exception to your - version of the file(s), but you are not obligated to do so. If you - do not wish to do so, delete this exception statement from your - version. If you delete this exception statement from all source - files in the program, then also delete it here. -*/ - -#include "decryption_context.h" -#include "exceptions.h" -#include -#include - -using boost::optional; -using namespace dcp; - -DecryptionContext::DecryptionContext (optional key) - : _decryption (0) -{ - if (!key) { - return; - } - - _decryption = new ASDCP::AESDecContext; - if (ASDCP_FAILURE (_decryption->InitKey (key->value ()))) { - throw MiscError ("could not set up decryption context"); - } -} - -DecryptionContext::~DecryptionContext () -{ - delete _decryption; -} diff --git a/src/decryption_context.h b/src/decryption_context.h deleted file mode 100644 index fb8342cf..00000000 --- a/src/decryption_context.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2012-2016 Carl Hetherington - - This file is part of libdcp. - - libdcp 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. - - libdcp 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 libdcp. If not, see . - - In addition, as a special exception, the copyright holders give - permission to link the code of portions of this program with the - OpenSSL library under certain conditions as described in each - individual source file, and distribute linked combinations - including the two. - - You must obey the GNU General Public License in all respects - for all of the code used other than OpenSSL. If you modify - file(s) with this exception, you may extend this exception to your - version of the file(s), but you are not obligated to do so. If you - do not wish to do so, delete this exception statement from your - version. If you delete this exception statement from all source - files in the program, then also delete it here. -*/ - -#ifndef LIBDCP_DECRYPTION_CONTEXT_H -#define LIBDCP_DECRYPTION_CONTEXT_H - -#include "key.h" -#include - -namespace ASDCP { - class AESDecContext; -} - -namespace dcp { - -class DecryptionContext -{ -public: - DecryptionContext (boost::optional key = boost::optional ()); - ~DecryptionContext (); - - ASDCP::AESDecContext* decryption () const { - return _decryption; - } - -private: - ASDCP::AESDecContext* _decryption; -}; - -} - -#endif diff --git a/src/encryption_context.cc b/src/encryption_context.cc deleted file mode 100644 index 7712a25b..00000000 --- a/src/encryption_context.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2012-2016 Carl Hetherington - - This file is part of libdcp. - - libdcp 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. - - libdcp 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 libdcp. If not, see . - - In addition, as a special exception, the copyright holders give - permission to link the code of portions of this program with the - OpenSSL library under certain conditions as described in each - individual source file, and distribute linked combinations - including the two. - - You must obey the GNU General Public License in all respects - for all of the code used other than OpenSSL. If you modify - file(s) with this exception, you may extend this exception to your - version of the file(s), but you are not obligated to do so. If you - do not wish to do so, delete this exception statement from your - version. If you delete this exception statement from all source - files in the program, then also delete it here. -*/ - -#include "encryption_context.h" -#include "exceptions.h" -#include -#include - -using boost::optional; -using namespace dcp; - -EncryptionContext::EncryptionContext (optional key, Standard standard) - : _encryption (0) - , _hmac (0) -{ - if (!key) { - return; - } - - _encryption = new ASDCP::AESEncContext; - if (ASDCP_FAILURE (_encryption->InitKey (key->value ()))) { - throw MiscError ("could not set up encryption context"); - } - - uint8_t cbc_buffer[ASDCP::CBC_BLOCK_SIZE]; - - Kumu::FortunaRNG rng; - if (ASDCP_FAILURE (_encryption->SetIVec (rng.FillRandom (cbc_buffer, ASDCP::CBC_BLOCK_SIZE)))) { - throw MiscError ("could not set up CBC initialization vector"); - } - - _hmac = new ASDCP::HMACContext; - - ASDCP::LabelSet_t type; - if (standard == INTEROP) { - type = ASDCP::LS_MXF_INTEROP; - } else { - type = ASDCP::LS_MXF_SMPTE; - } - - if (ASDCP_FAILURE (_hmac->InitKey (key->value(), type))) { - throw MiscError ("could not set up HMAC context"); - } -} - -EncryptionContext::~EncryptionContext () -{ - delete _encryption; - delete _hmac; -} diff --git a/src/encryption_context.h b/src/encryption_context.h deleted file mode 100644 index 68173950..00000000 --- a/src/encryption_context.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2012-2016 Carl Hetherington - - This file is part of libdcp. - - libdcp 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. - - libdcp 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 libdcp. If not, see . - - In addition, as a special exception, the copyright holders give - permission to link the code of portions of this program with the - OpenSSL library under certain conditions as described in each - individual source file, and distribute linked combinations - including the two. - - You must obey the GNU General Public License in all respects - for all of the code used other than OpenSSL. If you modify - file(s) with this exception, you may extend this exception to your - version of the file(s), but you are not obligated to do so. If you - do not wish to do so, delete this exception statement from your - version. If you delete this exception statement from all source - files in the program, then also delete it here. -*/ - -#include "key.h" -#include "types.h" -#include - -namespace ASDCP { - class AESEncContext; - class HMACContext; -} - -namespace dcp { - -class EncryptionContext -{ -public: - EncryptionContext (boost::optional key, Standard standard); - ~EncryptionContext (); - - ASDCP::AESEncContext* encryption () const { - return _encryption; - } - - ASDCP::HMACContext* hmac () const { - return _hmac; - } - -private: - ASDCP::AESEncContext* _encryption; - ASDCP::HMACContext* _hmac; -}; - -} diff --git a/src/frame.h b/src/frame.h index f20a1bb3..7b5e6366 100644 --- a/src/frame.h +++ b/src/frame.h @@ -34,7 +34,7 @@ #ifndef LIBDCP_FRAME_H #define LIBDCP_FRAME_H -#include "decryption_context.h" +#include "crypto_context.h" #include "exceptions.h" #include #include @@ -51,7 +51,7 @@ public: /* XXX: unfortunate guesswork on this buffer size */ _buffer = new B (Kumu::Megabyte); - if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->decryption()))) { + if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), c->hmac()))) { boost::throw_exception (DCPReadError ("could not read frame")); } } diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index cebd8fa1..5a014910 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -176,7 +176,7 @@ MonoPictureAsset::start_write (boost::filesystem::path file, bool overwrite) shared_ptr MonoPictureAsset::start_read () const { - return shared_ptr (new MonoPictureAssetReader (this, key ())); + return shared_ptr (new MonoPictureAssetReader (this, key(), standard())); } string diff --git a/src/mono_picture_asset_writer.cc b/src/mono_picture_asset_writer.cc index b48e46e9..30a6ee96 100644 --- a/src/mono_picture_asset_writer.cc +++ b/src/mono_picture_asset_writer.cc @@ -39,7 +39,7 @@ #include "exceptions.h" #include "picture_asset.h" #include "dcp_assert.h" -#include "encryption_context.h" +#include "crypto_context.h" #include #include @@ -87,7 +87,7 @@ MonoPictureAssetWriter::write (uint8_t const * data, int size) uint64_t const before_offset = _state->mxf_writer.Tell (); string hash; - ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _encryption_context->encryption(), _encryption_context->hmac(), &hash); + ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac(), &hash); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError ("error in writing video MXF", _file.string(), r)); } diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index 23deb1e8..7ac807cb 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -42,7 +42,7 @@ #include "colour_conversion.h" #include "compose.hpp" #include "j2k.h" -#include "decryption_context.h" +#include "crypto_context.h" #include #include @@ -79,7 +79,7 @@ MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, share /* XXX: unfortunate guesswork on this buffer size */ _buffer = new ASDCP::JP2K::FrameBuffer (4 * Kumu::Megabyte); - ASDCP::Result_t const r = reader->ReadFrame (n, *_buffer, c->decryption()); + ASDCP::Result_t const r = reader->ReadFrame (n, *_buffer, c->context(), c->hmac()); if (ASDCP_FAILURE (r)) { boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 (%2)", n, static_cast(r)))); diff --git a/src/mono_picture_frame.h b/src/mono_picture_frame.h index 612ffa3c..1b818144 100644 --- a/src/mono_picture_frame.h +++ b/src/mono_picture_frame.h @@ -58,7 +58,6 @@ namespace ASDCP { namespace dcp { class OpenJPEGImage; -class DecryptionContext; /** @class MonoPictureFrame * @brief A single frame of a 2D (monoscopic) picture asset. diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index a0472f3f..cd692736 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of libdcp. @@ -43,8 +43,8 @@ #include "dcp_assert.h" #include "util.h" #include "compose.hpp" -#include "encryption_context.h" -#include "decryption_context.h" +#include "crypto_context.h" +#include "crypto_context.h" #include #include #include @@ -60,6 +60,7 @@ using boost::split; using boost::is_any_of; using boost::shared_array; using boost::dynamic_pointer_cast; +using boost::optional; using namespace dcp; SMPTESubtitleAsset::SMPTESubtitleAsset () @@ -93,7 +94,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) reader->ReadTimedTextResource (s); xml->read_string (s); parse_xml (xml); - read_mxf_descriptor (reader, shared_ptr (new DecryptionContext ())); + read_mxf_descriptor (reader, shared_ptr (new DecryptionContext (optional(), SMPTE))); } } else { /* Plain XML */ @@ -175,7 +176,7 @@ SMPTESubtitleAsset::read_mxf_descriptor (shared_ptr if (i->Type == ASDCP::TimedText::MT_OPENTYPE) { ASDCP::TimedText::FrameBuffer buffer; buffer.Capacity (10 * 1024 * 1024); - reader->ReadAncillaryResource (i->ResourceID, buffer, dec->decryption()); + reader->ReadAncillaryResource (i->ResourceID, buffer, dec->context(), dec->hmac()); char id[64]; Kumu::bin2UUIDhex (i->ResourceID, ASDCP::UUIDlen, id, sizeof (id)); @@ -229,8 +230,8 @@ SMPTESubtitleAsset::set_key (Key key) } string s; - shared_ptr dec (new DecryptionContext (key)); - reader->ReadTimedTextResource (s, dec->decryption()); + shared_ptr dec (new DecryptionContext (key, SMPTE)); + reader->ReadTimedTextResource (s, dec->context(), dec->hmac()); shared_ptr xml (new cxml::Document ("SubtitleReel")); xml->read_string (s); parse_xml (xml); @@ -329,7 +330,7 @@ SMPTESubtitleAsset::write (boost::filesystem::path p) const } /* XXX: no encryption */ - r = writer.WriteTimedTextResource (xml_as_string (), enc.encryption(), enc.hmac()); + r = writer.WriteTimedTextResource (xml_as_string (), enc.context(), enc.hmac()); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError ("could not write XML to timed text resource", p.string(), r)); } @@ -343,7 +344,7 @@ SMPTESubtitleAsset::write (boost::filesystem::path p) const ASDCP::TimedText::FrameBuffer buffer; buffer.SetData (j->data.data().get(), j->data.size()); buffer.Size (j->data.size()); - r = writer.WriteAncillaryResource (buffer, enc.encryption(), enc.hmac()); + r = writer.WriteAncillaryResource (buffer, enc.context(), enc.hmac()); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError ("could not write font to timed text resource", p.string(), r)); } diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h index cf7e714d..9169a3d6 100644 --- a/src/smpte_subtitle_asset.h +++ b/src/smpte_subtitle_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of libdcp. @@ -38,6 +38,7 @@ #include "subtitle_asset.h" #include "local_time.h" #include "mxf.h" +#include "crypto_context.h" #include namespace ASDCP { @@ -49,7 +50,6 @@ namespace ASDCP { namespace dcp { class SMPTELoadFontNode; -class DecryptionContext; /** @class SMPTESubtitleAsset * @brief A set of subtitles to be read and/or written in the SMPTE format. diff --git a/src/sound_asset.cc b/src/sound_asset.cc index b8ed6fb5..641dc09a 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -202,7 +202,7 @@ SoundAsset::start_write (boost::filesystem::path file) shared_ptr SoundAsset::start_read () const { - return shared_ptr (new SoundAssetReader (this, key ())); + return shared_ptr (new SoundAssetReader (this, key(), standard())); } string diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index 1bb2959d..8df4d911 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -36,7 +36,7 @@ #include "exceptions.h" #include "dcp_assert.h" #include "compose.hpp" -#include "encryption_context.h" +#include "crypto_context.h" #include #include @@ -143,7 +143,7 @@ SoundAssetWriter::write (float const * const * data, int frames) void SoundAssetWriter::write_current_frame () { - ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _encryption_context->encryption(), _encryption_context->hmac()); + ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac()); if (ASDCP_FAILURE (r)) { boost::throw_exception (MiscError (String::compose ("could not write audio MXF frame (%1)", int (r)))); } diff --git a/src/stereo_picture_asset.cc b/src/stereo_picture_asset.cc index e5ed363e..d78b4c2c 100644 --- a/src/stereo_picture_asset.cc +++ b/src/stereo_picture_asset.cc @@ -85,7 +85,7 @@ StereoPictureAsset::start_write (boost::filesystem::path file, bool overwrite) shared_ptr StereoPictureAsset::start_read () const { - return shared_ptr (new StereoPictureAssetReader (this, key ())); + return shared_ptr (new StereoPictureAssetReader (this, key(), standard())); } bool diff --git a/src/stereo_picture_asset_writer.cc b/src/stereo_picture_asset_writer.cc index db770e8b..14900e6d 100644 --- a/src/stereo_picture_asset_writer.cc +++ b/src/stereo_picture_asset_writer.cc @@ -35,7 +35,7 @@ #include "exceptions.h" #include "dcp_assert.h" #include "picture_asset.h" -#include "encryption_context.h" +#include "crypto_context.h" #include #include @@ -88,8 +88,8 @@ StereoPictureAssetWriter::write (uint8_t const * data, int size) Kumu::Result_t r = _state->mxf_writer.WriteFrame ( _state->frame_buffer, _next_eye == EYE_LEFT ? ASDCP::JP2K::SP_LEFT : ASDCP::JP2K::SP_RIGHT, - _encryption_context->encryption(), - _encryption_context->hmac(), + _crypto_context->context(), + _crypto_context->hmac(), &hash ); diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc index e645c7df..8b8f9b91 100644 --- a/src/stereo_picture_frame.cc +++ b/src/stereo_picture_frame.cc @@ -38,7 +38,7 @@ #include "colour_conversion.h" #include "compose.hpp" #include "j2k.h" -#include "decryption_context.h" +#include "crypto_context.h" #include #include @@ -55,7 +55,7 @@ StereoPictureFrame::StereoPictureFrame (ASDCP::JP2K::MXFSReader* reader, int n, /* XXX: unfortunate guesswork on this buffer size */ _buffer = new ASDCP::JP2K::SFrameBuffer (4 * Kumu::Megabyte); - if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->decryption()))) { + if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), c->hmac()))) { boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n))); } } diff --git a/src/stereo_picture_frame.h b/src/stereo_picture_frame.h index 88792804..a173b1c1 100644 --- a/src/stereo_picture_frame.h +++ b/src/stereo_picture_frame.h @@ -53,7 +53,6 @@ namespace ASDCP { namespace dcp { class OpenJPEGImage; -class DecryptionContext; /** A single frame of a 3D (stereoscopic) picture asset */ class StereoPictureFrame : public boost::noncopyable diff --git a/src/wscript b/src/wscript index a76ca6a1..323ceaee 100644 --- a/src/wscript +++ b/src/wscript @@ -47,10 +47,8 @@ def build(bld): dcp.cc dcp_time.cc decrypted_kdm.cc - decryption_context.cc decrypted_kdm_key.cc encrypted_kdm.cc - encryption_context.cc exceptions.cc file.cc font_asset.cc @@ -116,6 +114,7 @@ def build(bld): certificate.h chromaticity.h colour_conversion.h + context.h cpl.h dcp.h dcp_assert.h @@ -123,9 +122,7 @@ def build(bld): data.h decrypted_kdm.h decrypted_kdm_key.h - decryption_context.h encrypted_kdm.h - encryption_context.h exceptions.h font_asset.h frame.h diff --git a/tools/dcpdecryptmxf.cc b/tools/dcpdecryptmxf.cc index b6e28b25..6a10c641 100644 --- a/tools/dcpdecryptmxf.cc +++ b/tools/dcpdecryptmxf.cc @@ -33,7 +33,7 @@ #include "encrypted_kdm.h" #include "decrypted_kdm.h" -#include "decryption_context.h" +#include "crypto_context.h" #include "key.h" #include "util.h" #include "atmos_asset.h" @@ -98,7 +98,7 @@ atmos ( exit (EXIT_FAILURE); } - dcp::DecryptionContext dc (key.get()); + dcp::DecryptionContext dc (key.get(), dcp::SMPTE); ASDCP::ATMOS::AtmosDescriptor desc; if (ASDCP_FAILURE (reader.FillAtmosDescriptor (desc))) { @@ -109,7 +109,7 @@ atmos ( ASDCP::DCData::FrameBuffer buffer (Kumu::Megabyte); for (size_t i = 0; i < desc.ContainerDuration; ++i) { - reader.ReadFrame (i, buffer, dc.decryption(), 0); + reader.ReadFrame (i, buffer, dc.context(), 0); } return 0;