libdcp
encrypted_kdm.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
3 
4  This file is part of libdcp.
5 
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.
10 
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.
15 
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/>.
18 
19  In addition, as a special exception, the copyright holders give
20  permission to link the code of portions of this program with the
21  OpenSSL library under certain conditions as described in each
22  individual source file, and distribute linked combinations
23  including the two.
24 
25  You must obey the GNU General Public License in all respects
26  for all of the code used other than OpenSSL. If you modify
27  file(s) with this exception, you may extend this exception to your
28  version of the file(s), but you are not obligated to do so. If you
29  do not wish to do so, delete this exception statement from your
30  version. If you delete this exception statement from all source
31  files in the program, then also delete it here.
32 */
33 
34 
40 #ifndef LIBDCP_ENCRYPTED_KDM_H
41 #define LIBDCP_ENCRYPTED_KDM_H
42 
43 
44 #include "local_time.h"
45 #include "types.h"
46 #include <boost/filesystem.hpp>
47 #include <boost/optional.hpp>
48 #include <boost/date_time/local_time/local_time.hpp>
49 
50 
51 namespace cxml {
52  class Node;
53 }
54 
55 
56 namespace dcp {
57 
58 
59 namespace data {
60  class EncryptedKDMData;
61 }
62 
63 
64 class CertificateChain;
65 class Certificate;
66 
67 
76 {
77 public:
78  explicit EncryptedKDM (std::string);
79  EncryptedKDM (EncryptedKDM const & kdm);
80  EncryptedKDM & operator= (EncryptedKDM const &);
81  ~EncryptedKDM ();
82 
86  void as_xml (boost::filesystem::path file) const;
87 
89  std::string as_xml () const;
90 
95  std::vector<std::string> keys () const;
96 
97  std::string id () const;
98  boost::optional<std::string> annotation_text () const;
99  std::string content_title_text () const;
100  std::string issue_date () const;
101  std::string cpl_id () const;
102  LocalTime not_valid_before () const;
103  LocalTime not_valid_after () const;
104  std::string recipient_x509_subject_name () const;
105  CertificateChain signer_certificate_chain () const;
106 
107 private:
108 
109  friend class DecryptedKDM;
110 
113  std::shared_ptr<const CertificateChain> signer,
114  Certificate recipient,
115  std::vector<std::string> trusted_devices,
116  std::string cpl_id,
117  std::string cpl_content_title_text,
118  boost::optional<std::string> annotation_text,
119  LocalTime not_valid_before,
120  LocalTime not_valid_after,
121  Formulation formulation,
122  bool disable_forensic_marking_picture,
123  boost::optional<int> disable_forensic_marking_audio,
124  std::vector<std::pair<std::string, std::string>> key_ids,
125  std::vector<std::string> keys
126  );
127 
128  data::EncryptedKDMData* _data = nullptr;
129 };
130 
131 
132 extern bool operator== (EncryptedKDM const & a, EncryptedKDM const & b);
133 
134 }
135 
136 
137 #endif
A chain of any number of certificates, from root to leaf.
A wrapper for an X509 certificate.
Definition: certificate.h:66
A decrypted KDM.
Definition: decrypted_kdm.h:76
An encrypted KDM.
Definition: encrypted_kdm.h:76
std::string as_xml() const
std::vector< std::string > keys() const
EncryptedKDM(std::shared_ptr< const CertificateChain > signer, Certificate recipient, std::vector< std::string > trusted_devices, std::string cpl_id, std::string cpl_content_title_text, boost::optional< std::string > annotation_text, LocalTime not_valid_before, LocalTime not_valid_after, Formulation formulation, bool disable_forensic_marking_picture, boost::optional< int > disable_forensic_marking_audio, std::vector< std::pair< std::string, std::string >> key_ids, std::vector< std::string > keys)
A representation of a local time (down to the second), including its offset from GMT (equivalent to x...
Definition: local_time.h:64
LocalTime class.
Namespace for everything in libdcp.
Definition: array_data.h:50
Formulation
Definition: types.h:287
Miscellaneous types.