summaryrefslogtreecommitdiff
path: root/src/kdm.h
blob: c012c101f810d64410988f5e9991192186d7d665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>

    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
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef LIBDCP_KDM_H
#define LIBDCP_KDM_H

#include <boost/filesystem.hpp>
#include "key.h"

namespace libdcp {

/** A single key for encrypting or decrypting an MXF.  One or more of these
 *  are delivered in a KDM.
 */
class KDMKey
{
public:
	KDMKey (unsigned char const *, int);

	std::string structure_id () const {
		return _structure_id;
	}
	
	std::string signer_thumbprint () const {
		return _signer_thumbprint;
	}
	
	std::string cpl_id () const {
		return _cpl_id;
	}
	
	std::string key_type () const {
		return _key_type;
	}

	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;
	}
	
private:
	std::string get (unsigned char const **, int) const;
	std::string get_uuid (unsigned char const **, int) const;
	
	std::string _structure_id;
	std::string _signer_thumbprint;
	std::string _cpl_id;
	std::string _not_valid_before;
	std::string _not_valid_after;
	std::string _key_type;
	std::string _key_id;
	Key _key;
};

class KDM
{
public:
	KDM (boost::filesystem::path, boost::filesystem::path);

	std::list<KDMKey> keys () const {
		return _keys;
	}

private:
	std::list<KDMKey> _keys;
};


}

#endif