libdcp
|
A chain of any number of certificates, from root to leaf. More...
#include <certificate_chain.h>
Public Types | |
typedef std::vector< Certificate > | List |
Public Member Functions | |
CertificateChain (boost::filesystem::path openssl, int validity_in_days, std::string organisation="example.org", std::string organisational_unit="example.org", std::string root_common_name=".smpte-430-2.ROOT.NOT_FOR_PRODUCTION", std::string intermediate_common_name=".smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION", std::string leaf_common_name="CS.smpte-430-2.LEAF.NOT_FOR_PRODUCTION") | |
CertificateChain (std::string s) | |
void | add (Certificate c) |
void | remove (Certificate c) |
void | remove (int i) |
Certificate | root () const |
Certificate | leaf () const |
List | leaf_to_root () const |
List | root_to_leaf () const |
List | unordered () const |
bool | valid (std::string *reason=nullptr) const |
bool | chain_valid () const |
bool | private_key_valid () const |
void | sign (xmlpp::Element *parent, Standard standard) const |
void | add_signature_value (xmlpp::Element *parent, std::string ns, bool add_indentation) const |
boost::optional< std::string > | key () const |
void | set_key (std::string k) |
std::string | chain () const |
Private Member Functions | |
bool | chain_valid (List const &chain) const |
Private Attributes | |
List | _certificates |
boost::optional< std::string > | _key |
A chain of any number of certificates, from root to leaf.
A CertificateChain object can also (optionally) hold the private key corresponding to the leaf certificate.
Definition at line 74 of file certificate_chain.h.
CertificateChain::CertificateChain | ( | boost::filesystem::path | openssl, |
int | validity_in_days, | ||
std::string | organisation = "example.org" , |
||
std::string | organisational_unit = "example.org" , |
||
std::string | root_common_name = ".smpte-430-2.ROOT.NOT_FOR_PRODUCTION" , |
||
std::string | intermediate_common_name = ".smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION" , |
||
std::string | leaf_common_name = "CS.smpte-430-2.LEAF.NOT_FOR_PRODUCTION" |
||
) |
Create a chain of certificates for signing things.
openssl | Name of openssl binary (if it is on the path) or full path. |
Definition at line 188 of file certificate_chain.cc.
|
explicit |
Read a CertificateChain from a string.
s | A string containing one or more PEM-encoded certificates. |
Definition at line 334 of file certificate_chain.cc.
void CertificateChain::add | ( | Certificate | c | ) |
Add a certificate to the chain.
c | Certificate to add. |
Definition at line 385 of file certificate_chain.cc.
void CertificateChain::add_signature_value | ( | xmlpp::Element * | parent, |
std::string | ns, | ||
bool | add_indentation | ||
) | const |
Sign an XML node.
parent | Node to sign. |
ns | Namespace to use for the signature XML nodes. |
Definition at line 624 of file certificate_chain.cc.
bool CertificateChain::chain_valid | ( | ) | const |
Check to see if the chain is valid (i.e. root signs the intermediate, intermediate signs the leaf and so on) and that the private key (if there is one) matches the leaf certificate.
Definition at line 417 of file certificate_chain.cc.
Certificate CertificateChain::leaf | ( | ) | const |
Definition at line 361 of file certificate_chain.cc.
CertificateChain::List CertificateChain::leaf_to_root | ( | ) | const |
Definition at line 369 of file certificate_chain.cc.
bool CertificateChain::private_key_valid | ( | ) | const |
Check that there is a valid private key for the leaf certificate. Will return true if there are no certificates.
Definition at line 494 of file certificate_chain.cc.
void CertificateChain::remove | ( | Certificate | c | ) |
Remove a certificate from the chain.
c | Certificate to remove. |
Definition at line 392 of file certificate_chain.cc.
void CertificateChain::remove | ( | int | i | ) |
Remove the i'th certificate in the chain, as listed from root to leaf.
Definition at line 402 of file certificate_chain.cc.
Certificate CertificateChain::root | ( | ) | const |
Definition at line 353 of file certificate_chain.cc.
CertificateChain::List CertificateChain::root_to_leaf | ( | ) | const |
Definition at line 558 of file certificate_chain.cc.
void CertificateChain::sign | ( | xmlpp::Element * | parent, |
Standard | standard | ||
) | const |
Add a <Signer> and <ds:Signature> nodes to an XML node.
parent | XML node to add to. |
standard | INTEROP or SMPTE. |
Definition at line 573 of file certificate_chain.cc.
|
private |
Our certificates, not in any particular order
Definition at line 181 of file certificate_chain.h.
|
private |
Leaf certificate's private key, if known, in PEM format
Definition at line 183 of file certificate_chain.h.