2 Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
20 /** @file src/encrypted_kdm.h
21 * @brief EncryptedKDM class.
24 #ifndef LIBDCP_ENCRYPTED_KDM_H
25 #define LIBDCP_ENCRYPTED_KDM_H
27 #include "local_time.h"
29 #include <boost/filesystem.hpp>
30 #include <boost/optional.hpp>
31 #include <boost/date_time/local_time/local_time.hpp>
40 class EncryptedKDMData;
43 class CertificateChain;
46 /** @class EncryptedKDM
47 * @brief An encrypted KDM.
49 * This is a KDM whose keys are encrypted using the target projector's private key.
50 * An EncryptedKDM object can be initialised from a KDM XML file, or created from
51 * a DecryptedKDM (using DecryptedKDM::encrypt).
56 EncryptedKDM (std::string);
57 EncryptedKDM (EncryptedKDM const & kdm);
58 EncryptedKDM & operator= (EncryptedKDM const &);
61 /** Write this KDM as XML to a file.
62 * @param file File to write to.
64 void as_xml (boost::filesystem::path file) const;
66 /** @return This KDM as XML */
67 std::string as_xml () const;
69 /** @return The base64-encoded and encrypted keys that this KDM delivers.
70 * Note that the returned `keys' contain more than just the asset decryption
71 * keys (also key id, CPL id etc.)
73 std::list<std::string> keys () const;
75 boost::optional<std::string> annotation_text () const;
76 std::string content_title_text () const;
77 std::string issue_date () const;
78 std::string cpl_id () const;
82 friend class DecryptedKDM;
84 /** Construct an EncryptedKDM from a set of details */
86 boost::shared_ptr<const CertificateChain> signer,
87 Certificate recipient,
88 std::vector<Certificate> trusted_devices,
89 std::string device_list_description,
91 std::string cpl_content_title_text,
92 boost::optional<std::string> annotation_text,
93 LocalTime not_valid_before,
94 LocalTime not_valid_after,
95 Formulation formulation,
96 std::list<std::pair<std::string, std::string> > key_ids,
97 std::list<std::string> keys
100 data::EncryptedKDMData* _data;
103 extern bool operator== (EncryptedKDM const & a, EncryptedKDM const & b);