summaryrefslogtreecommitdiff
path: root/src/certificates.h
blob: a1a409ac0902fb9ccd0a7bac43fe5973f8d1229c (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
#ifndef LIBDCP_CERTIFICATES_H
#define LIBDCP_CERTIFICATES_H

#include <string>
#include <list>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <openssl/x509.h>

class certificates;

namespace libdcp {

class Certificate : public boost::noncopyable
{
public:
	Certificate (X509 *);
	~Certificate ();

	std::string certificate () const;
	std::string issuer () const;
	std::string serial () const;
	std::string subject () const;

	static std::string name_for_xml (std::string const &);

private:
	X509* _certificate;
};

class CertificateChain
{
public:
	CertificateChain () {}
	CertificateChain (std::string const &);

	boost::shared_ptr<Certificate> root () const;
	boost::shared_ptr<Certificate> leaf () const;

	std::list<boost::shared_ptr<Certificate> > leaf_to_root () const;

private:
	friend class ::certificates;
	std::list<boost::shared_ptr<Certificate> > _certificates;
};

}

#endif