X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fcertificates.h;h=198773f1a39c97ff1eb345d56a7847fcb47d59f9;hb=f8005516a681b805ccc2d929f63312ac711fdc24;hp=06baa547fb649b798b1c2796a683c3d8cc63db8a;hpb=341bdc0e4f78fed5f231e741142e2e74415f56b7;p=libdcp.git diff --git a/src/certificates.h b/src/certificates.h index 06baa547..198773f1 100644 --- a/src/certificates.h +++ b/src/certificates.h @@ -24,9 +24,8 @@ #include #include #include -#ifdef LIBDCP_WINDOWS -#include "wincrypt.h" -#endif +#include +#undef X509_NAME #include class certificates; @@ -37,30 +36,43 @@ namespace xmlpp { namespace libdcp { -class Certificate : public boost::noncopyable +class Certificate { public: Certificate () : _certificate (0) {} - Certificate (std::string const &); + Certificate (boost::filesystem::path); + Certificate (std::string); Certificate (X509 *); + Certificate (Certificate const &); ~Certificate (); - std::string certificate () const; + Certificate& operator= (Certificate const &); + + /** @param with_begin_end true to include BEGIN CERTIFICATE / END CERTIFICATE markers + * @return the whole certificate as a string. + */ + std::string certificate (bool with_begin_end = false) const; std::string issuer () const; std::string serial () const; std::string subject () const; + /** @return RSA public key from this Certificate. Caller must not free the returned value. */ + RSA* public_key () const; + std::string thumbprint () const; private: + void read_string (std::string); + static std::string name_for_xml (X509_NAME *); static std::string asn_to_utf8 (ASN1_STRING *); static std::string get_name_part (X509_NAME *, int); X509* _certificate; + mutable RSA* _public_key; }; class CertificateChain