dodo
0.0.1
A C++ library to create containerized Linux services
|
X509 Certificate signing request (CSR) interface. More...
#include <x509cert.hpp>
Static Public Member Functions | |
static void | free (X509_REQ *cert) |
Free / clean an X509 object. More... | |
static std::string | getFingerPrint (const X509_REQ *cert, const std::string hashname="shake256") |
Get the certificate fingerprint (a hash on the public key modulus) in string format, multiple hexadecimal bytes values separated by a colon. More... | |
static X509Common::Identity | getSubject (const X509_REQ *cert) |
Get the CSR subject identity. More... | |
static X509_REQ * | loadPEM (const std::string file) |
Load a certificate signing request (CSR) from a PEM file. More... | |
![]() | |
static X509Type | detectX509Type (const std::string file, std::string &tag) |
Detects a X509 document type from a PEM file. More... | |
static std::string | SANTypeAsString (const SANType &san_type) |
Convert the SANType name to a string. More... | |
Private Member Functions | |
X509CertificateSigningRequest ()=delete | |
Never construct, interface class. More... | |
~X509CertificateSigningRequest ()=delete | |
Never destruct, interface class. More... | |
Additional Inherited Members | |
![]() | |
enum | SANType { SANType::stDNS = GEN_DNS, SANType::stURI = GEN_URI, SANType::stEMAIL = GEN_EMAIL, SANType::stIP = GEN_IPADD } |
The SubjectAltName type. More... | |
enum | X509Type { X509Type::Unknown, X509Type::PrivateKey, X509Type::PublicKey, X509Type::CertificateSigningRequest, X509Type::Certificate } |
Enumeration of X509 document types. More... | |
![]() | |
static Identity | parseIdentity (const std::string src) |
Parse a subject or issuer string into an Identity. More... | |
X509 Certificate signing request (CSR) interface.
Note that this is an interface class, it does not manage ownership of X509_REQ structures.
See Secure sockets for details on the role of this class.
Definition at line 205 of file x509cert.hpp.
|
privatedelete |
Never construct, interface class.
|
privatedelete |
Never destruct, interface class.
|
inlinestatic |
Free / clean an X509 object.
cert | The X509_REQ object to free. |
Definition at line 226 of file x509cert.hpp.
|
static |
Get the certificate fingerprint (a hash on the public key modulus) in string format, multiple hexadecimal bytes values separated by a colon.
openssl list -digest-algorithms
shows a full list of hash (digest) names. Stick to newer hash algorithms from the SHA-3 family.
common::Exception | if the digest name is invalid. |
cert | A pointer to the X509 certificate. |
hashname | The name of the hash algorithm to use. Defaults to 'shake256'. Names are case-insensitive. |
Definition at line 121 of file x509cert.cpp.
References dodo::common::getSSLErrors(), and throw_Exception.
|
static |
Get the CSR subject identity.
cert | The source CSR / X509_REQ. |
Definition at line 112 of file x509cert.cpp.
References dodo::common::bio2String(), and dodo::network::X509Common::parseIdentity().
|
static |
Load a certificate signing request (CSR) from a PEM file.
The X509_REQ object pointed to gets owned by the caller and must be freed with free( X509_REQ* cert ). Note that the call will fail if the file is not a CSR, even if it is a valid PEM file - such as a certificate or a private key in PEM format.
file | The filename to load from. |
common::Exception | when the openSSL BIO fails to create. |
common::Exception | when the file cannot be read. |
common::Exception | when the file is not a valid PEM file. |
Definition at line 92 of file x509cert.cpp.
References dodo::common::getSSLErrors(), and throw_Exception.