Various probably quite untidy progress on KDMs.
[libdcp.git] / src / certificates.h
1 #ifndef LIBDCP_CERTIFICATES_H
2 #define LIBDCP_CERTIFICATES_H
3
4 #include <string>
5 #include <list>
6 #include <boost/noncopyable.hpp>
7 #include <boost/shared_ptr.hpp>
8 #include <openssl/x509.h>
9
10 class certificates;
11
12 namespace xmlpp {
13         class Element;
14 }
15
16 namespace libdcp {
17
18 class Certificate : public boost::noncopyable
19 {
20 public:
21         Certificate (X509 *);
22         ~Certificate ();
23
24         std::string certificate () const;
25         std::string issuer () const;
26         std::string serial () const;
27         std::string subject () const;
28
29         static std::string name_for_xml (std::string const &);
30
31 private:
32         X509* _certificate;
33 };
34
35 class CertificateChain
36 {
37 public:
38         CertificateChain () {}
39         CertificateChain (std::string const &);
40
41         boost::shared_ptr<Certificate> root () const;
42         boost::shared_ptr<Certificate> leaf () const;
43
44         std::list<boost::shared_ptr<Certificate> > leaf_to_root () const;
45
46 private:
47         friend class ::certificates;
48         std::list<boost::shared_ptr<Certificate> > _certificates;
49 };
50
51 }
52
53 #endif