X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fkdm.h;h=ba17ee6b1fcf8e1028afc26567175d3560664783;hb=b405b414993458babbb4532ddeeef9928ec7c06e;hp=253589fed63f2dcd906f8d607ea34b23b25987bc;hpb=66ef19cdb8ab4e4613762acee98a2bcb999ab65c;p=libdcp.git diff --git a/src/kdm.h b/src/kdm.h index 253589fe..ba17ee6b 100644 --- a/src/kdm.h +++ b/src/kdm.h @@ -21,35 +21,74 @@ #define LIBDCP_KDM_H #include +#include +#include #include "key.h" +#include "metadata.h" namespace libdcp { +namespace xml { + class DCinemaSecurityMessage; +}; + +class Signer; +class Certificate; +class CPL; + /** A single key for encrypting or decrypting an MXF. One or more of these * are delivered in a KDM. */ -class KDMKey : public boost::noncopyable +class KDMKey { public: KDMKey (uint8_t const *, int); + KDMKey ( + boost::shared_ptr signer, + std::string cpl_id, std::string key_id, boost::posix_time::ptime from, boost::posix_time::ptime until, Key key + ); + + KDMKey (KDMKey const &); + + KDMKey& operator= (KDMKey const &); + + std::string cpl_id () const { + return _cpl_id; + } + + std::string key_id () const { + return _key_id; + } + + std::string not_valid_before () const { + return _not_valid_before; + } + + std::string not_valid_after () const { + return _not_valid_after; + } + Key key () const { return _key; } + + std::string encrypted_base64 (boost::shared_ptr) const; private: void get (uint8_t *, uint8_t const **, int) const; std::string get (uint8_t const **, int) const; std::string get_uuid (uint8_t const **) const; void put (uint8_t **, uint8_t const *, int) const; + void put (uint8_t **, std::string) const; void put_uuid (uint8_t **, std::string) const; uint8_t _signer_thumbprint[20]; std::string _cpl_id; - std::string _not_valid_before; - std::string _not_valid_after; std::string _key_type; std::string _key_id; + std::string _not_valid_before; + std::string _not_valid_after; Key _key; }; @@ -58,12 +97,24 @@ class KDM public: KDM (boost::filesystem::path, boost::filesystem::path); + KDM ( + boost::shared_ptr cpl, boost::shared_ptr, boost::shared_ptr recipient_cert, + boost::posix_time::ptime not_valid_before, boost::posix_time::ptime not_valid_after, + std::string annotation_text, std::string issue_date + ); + std::list keys () const { return _keys; } + void as_xml (boost::filesystem::path) const; + std::string as_xml () const; + private: + /** Unencrypted MXF content keys */ std::list _keys; + + boost::shared_ptr xml_kdm; };