2 Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
20 /** @file src/certificate.h
21 * @brief Certificate class.
24 #ifndef LIBDCP_CERTIFICATE_H
25 #define LIBDCP_CERTIFICATE_H
28 #include <openssl/x509.h>
29 #include <boost/filesystem.hpp>
41 /** @class Certificate
42 * @brief A wrapper for an X509 certificate.
44 * This class can take a Certificate from a string or an OpenSSL X509 object.
54 Certificate (std::string);
56 Certificate (Certificate const &);
59 Certificate& operator= (Certificate const &);
61 std::string certificate (bool with_begin_end = false) const;
62 std::string serial () const;
64 std::string issuer () const;
66 std::string subject () const;
67 std::string subject_common_name () const;
68 std::string subject_organization_name () const;
69 std::string subject_organizational_unit_name () const;
75 RSA* public_key () const;
77 std::string thumbprint () const;
79 bool extra_data () const {
84 bool read_string (std::string);
86 static std::string name_for_xml (X509_NAME *);
87 static std::string asn_to_utf8 (ASN1_STRING *);
88 static std::string get_name_part (X509_NAME *, int);
91 mutable RSA* _public_key;
92 /** true if extra data was found when this certificate was read
98 bool operator== (Certificate const & a, Certificate const & b);
99 bool operator< (Certificate const & a, Certificate const & b);
100 std::ostream& operator<< (std::ostream&s, Certificate const & c);