From 932b942a51bef4e2dd2de9f83aa5b68ad07f60f9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 7 Jul 2013 00:39:15 +0100 Subject: Working decryption via KDM. --- src/dcp.cc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/dcp.cc') diff --git a/src/dcp.cc b/src/dcp.cc index c2118ed0..684e249d 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -46,6 +46,7 @@ #include "reel.h" #include "cpl.h" #include "encryption.h" +#include "kdm.h" using std::string; using std::list; @@ -65,7 +66,7 @@ DCP::DCP (string directory) void DCP::write_xml (XMLMetadata const & metadata, shared_ptr crypt) const { - for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { (*i)->write_xml (metadata, crypt); } @@ -106,7 +107,7 @@ DCP::write_pkl (string pkl_uuid, XMLMetadata const & metadata, shared_ptrwrite_to_pkl (asset_list); } - for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { (*i)->write_to_pkl (asset_list); } @@ -158,7 +159,7 @@ DCP::write_assetmap (string pkl_uuid, int pkl_length, XMLMetadata const & metada chunk->add_child("Offset")->add_child_text ("0"); chunk->add_child("Length")->add_child_text (lexical_cast (pkl_length)); - for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { (*i)->write_to_assetmap (asset_list); } @@ -261,8 +262,8 @@ DCP::equals (DCP const & other, EqualityOptions opt, boost::function >::const_iterator a = _cpls.begin (); - list >::const_iterator b = other._cpls.begin (); + list >::const_iterator a = _cpls.begin (); + list >::const_iterator b = other._cpls.begin (); while (a != _cpls.end ()) { if (!(*a)->equals (*b->get(), opt, note)) { @@ -293,7 +294,7 @@ list > DCP::assets () const { list > a; - for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { list > t = (*i)->assets (); a.merge (t); } @@ -306,7 +307,7 @@ DCP::assets () const bool DCP::encrypted () const { - for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) { if ((*i)->encrypted ()) { return true; } @@ -314,3 +315,17 @@ DCP::encrypted () const return false; } + +void +DCP::add_kdm (KDM const & kdm) +{ + list ciphers = kdm.ciphers (); + + for (list >::iterator i = _cpls.begin(); i != _cpls.end(); ++i) { + for (list::iterator j = ciphers.begin(); j != ciphers.end(); ++j) { + if (j->cpl_id() == (*i)->id()) { + (*i)->add_kdm (kdm); + } + } + } +} -- cgit v1.2.3