efb8099bcbbd86b5f3402a4b41eedc1f5e44e905
[libdcp.git] / src / signer.h
1 /*
2     Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include <boost/filesystem.hpp>
21 #include "certificates.h"
22
23 namespace xmlpp {
24         class Element;
25         class Node;
26 }
27
28 namespace libdcp {
29
30 class Signer
31 {
32 public:
33         Signer (CertificateChain c, boost::filesystem::path k)
34                 : _certificates (c)
35                 , _key (k)
36         {}
37
38         void sign (xmlpp::Element* parent, bool interop) const;
39         void add_signature_value (xmlpp::Node* parent, std::string ns) const;
40
41         CertificateChain const & certificates () const {
42                 return _certificates;
43         }
44         
45 private:        
46
47         void add_signer (xmlpp::Element* parent, std::string ns) const;
48         
49         CertificateChain _certificates;
50         /** Filename of signer key */
51         boost::filesystem::path _key;
52 };
53
54 }