A few more untested bits.
[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 libdcp {
13
14 class Certificate : public boost::noncopyable
15 {
16 public:
17         Certificate (X509 *);
18         ~Certificate ();
19
20         std::string issuer () const;
21         std::string serial () const;
22         std::string subject () const;
23
24         static std::string name_for_xml (std::string const &);
25
26 private:
27         X509* _certificate;
28 };
29
30 class CertificateChain
31 {
32 public:
33         CertificateChain () {}
34         CertificateChain (std::string const &);
35
36         boost::shared_ptr<Certificate> root () const;
37         boost::shared_ptr<Certificate> leaf () const;
38
39         std::list<boost::shared_ptr<Certificate> > leaf_to_root () const;
40
41 private:
42         friend class ::certificates;
43         std::list<boost::shared_ptr<Certificate> > _certificates;
44 };
45
46 }
47
48 #endif