libdcp
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
dcp::Certificate Class Reference

A wrapper for an X509 certificate. More...

#include <certificate.h>

Public Member Functions

 Certificate (std::string)
 
 Certificate (X509 *)
 
 Certificate (Certificate const &)
 
Certificateoperator= (Certificate const &)
 
std::string read_string (std::string)
 
std::string certificate (bool with_begin_end=false) const
 
std::string serial () const
 
std::string issuer () const
 
std::string subject () const
 
std::string subject_common_name () const
 
std::string subject_organization_name () const
 
std::string subject_organizational_unit_name () const
 
LocalTime not_before () const
 
LocalTime not_after () const
 
X509 * x509 () const
 
RSA * public_key () const
 
std::string thumbprint () const
 
bool has_utf8_strings () const
 

Static Private Member Functions

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)
 

Private Attributes

X509 * _certificate = nullptr
 
RSA * _public_key = nullptr
 

Detailed Description

A wrapper for an X509 certificate.

This class can take a Certificate from a string or an OpenSSL X509 object

Definition at line 65 of file certificate.h.

Constructor & Destructor Documentation

◆ Certificate() [1/2]

Certificate::Certificate ( std::string  cert)
explicit

Load an X509 certificate from a string

Parameters
certString to read from

Definition at line 75 of file certificate.cc.

◆ Certificate() [2/2]

Certificate::Certificate ( X509 *  c)
explicit
Parameters
cX509 certificate, which this object will take ownership of

Definition at line 68 of file certificate.cc.

Member Function Documentation

◆ certificate()

string Certificate::certificate ( bool  with_begin_end = false) const

Return the certificate as a string

Parameters
with_begin_endtrue to include the --—BEGIN CERTIFICATE— / --—END CERTIFICATE--— markers
Returns
Certificate string

Definition at line 211 of file certificate.cc.

◆ issuer()

string Certificate::issuer ( ) const
Returns
Certificate's issuer, in the form dnqualifier=<dnQualififer>,CN=<commonName>,OU=<organizationalUnitName&gt,O=<organizationName> and with + signs escaped to +

Definition at line 241 of file certificate.cc.

◆ public_key()

RSA * Certificate::public_key ( ) const
Returns
RSA public key from this Certificate. Caller must not free the returned value.

Definition at line 422 of file certificate.cc.

◆ read_string()

string Certificate::read_string ( std::string  cert)

Read a certificate from a string.

Parameters
certString to read.
Returns
remaining part of the input string after the certificate which was read.

Definition at line 93 of file certificate.cc.

◆ thumbprint()

string Certificate::thumbprint ( ) const
Returns
thumbprint of the to-be-signed portion of this certificate

Definition at line 393 of file certificate.cc.


The documentation for this class was generated from the following files: