X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fkdm.cc;h=fe7fe393381a8c977dd62e6c71012fb0283f944f;hb=f9862aff32f7ea5aa10f9362d7598480b1c9cf28;hp=4132b242a99b9d56ca2a7d9c8d13306237143084;hpb=83591a4390db550a7d1495b9699c62315e2d7710;p=libdcp.git diff --git a/src/kdm.cc b/src/kdm.cc index 4132b242..fe7fe393 100644 --- a/src/kdm.cc +++ b/src/kdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,23 +17,27 @@ */ -#include -#include -#include -#include -#include -#include -#include -#include "AS_DCP.h" -#include "KM_util.h" +/** @file src/kdm.cc + * @brief KDM and KDMKey classes. + */ + #include "util.h" #include "kdm.h" #include "compose.hpp" #include "exceptions.h" #include "signer.h" #include "cpl.h" -#include "mxf_asset.h" -#include "xml/kdm_smpte.h" +#include "mxf.h" +#include "kdm_smpte_xml.h" +#include "AS_DCP.h" +#include "KM_util.h" +#include +#include +#include +#include +#include +#include +#include using std::list; using std::string; @@ -43,7 +47,7 @@ using std::setw; using std::setfill; using std::cout; using boost::shared_ptr; -using namespace libdcp; +using namespace dcp; KDM::KDM (boost::filesystem::path kdm, boost::filesystem::path private_key) : _xml_kdm (new xml::DCinemaSecurityMessage (kdm)) @@ -87,7 +91,9 @@ KDM::KDM (boost::filesystem::path kdm, boost::filesystem::path private_key) } KDM::KDM ( - shared_ptr cpl, shared_ptr signer, shared_ptr recipient_cert, + boost::shared_ptr cpl, + boost::shared_ptr signer, + boost::shared_ptr recipient_cert, boost::posix_time::ptime not_valid_before, boost::posix_time::ptime not_valid_after, string annotation_text, string issue_date ) @@ -108,7 +114,7 @@ KDM::KDM ( apu.recipient.x509_subject_name = recipient_cert->subject (); apu.composition_playlist_id = "urn:uuid:" + cpl->id (); // apu.content_authenticator = signer->certificates().leaf()->thumbprint (); - apu.content_title_text = cpl->name (); + apu.content_title_text = cpl->content_title_text (); apu.content_keys_not_valid_before = ptime_to_string (not_valid_before); apu.content_keys_not_valid_after = ptime_to_string (not_valid_after); apu.authorized_device_info.device_list_identifier = "urn:uuid:" + make_uuid (); @@ -124,10 +130,10 @@ KDM::KDM ( */ apu.authorized_device_info.device_list.push_back ("2jmj7l5rSw0yVb/vlWAYkK/YBwk="); - list > assets = cpl->assets (); - for (list >::iterator i = assets.begin(); i != assets.end(); ++i) { + list > content = cpl->content (); + for (list >::iterator i = content.begin(); i != content.end(); ++i) { /* XXX: non-MXF assets? */ - shared_ptr mxf = boost::dynamic_pointer_cast (*i); + shared_ptr mxf = boost::dynamic_pointer_cast (*i); if (mxf) { apu.key_id_list.push_back (xml::TypedKeyId (mxf->key_type(), "urn:uuid:" + mxf->key_id())); } @@ -138,9 +144,9 @@ KDM::KDM ( /* AuthenticatedPrivate */ - for (list >::iterator i = assets.begin(); i != assets.end(); ++i) { + for (list >::iterator i = content.begin(); i != content.end(); ++i) { /* XXX: non-MXF assets? */ - shared_ptr mxf = boost::dynamic_pointer_cast (*i); + shared_ptr mxf = boost::dynamic_pointer_cast (*i); if (mxf) { KDMKey kkey ( signer, cpl->id (), mxf->key_type (), mxf->key_id (), @@ -202,7 +208,13 @@ KDM::as_xml () const } KDMKey::KDMKey ( - shared_ptr signer, string cpl_id, string key_type, string key_id, boost::posix_time::ptime from, boost::posix_time::ptime until, Key key + boost::shared_ptr signer, + string cpl_id, + string key_type, + string key_id, + boost::posix_time::ptime from, + boost::posix_time::ptime until, + Key key ) : _cpl_id (cpl_id) , _key_type (key_type) @@ -275,7 +287,7 @@ KDMKey::operator= (KDMKey const & other) } string -KDMKey::encrypted_base64 (shared_ptr recipient_cert) const +KDMKey::encrypted_base64 (boost::shared_ptr recipient_cert) const { assert (_key_type.length() == 4); assert (_not_valid_before.length() == 25); @@ -383,7 +395,7 @@ KDMKey::put_uuid (uint8_t ** d, string id) const } bool -libdcp::operator== (libdcp::KDMKey const & a, libdcp::KDMKey const & b) +dcp::operator== (dcp::KDMKey const & a, dcp::KDMKey const & b) { if (memcmp (a._signer_thumbprint, b._signer_thumbprint, 20) != 0) { return false;