#include <certificate_generator.h>
|
stdx::expected< X509Cert, std::error_code > | generate_x509 (EVP_PKEY *pkey, const std::string &common_name, const uint32_t serial, X509 *ca_cert, EVP_PKEY *ca_pkey, uint32_t notbefore=0, uint32_t notafter=10 *k_year) const |
| Generate X.509 cerificate. More...
|
|
◆ EvpPkey
◆ X509Cert
◆ cert_to_string()
std::string CertificateGenerator::cert_to_string |
( |
X509 * |
cert | ) |
|
|
static |
Get string representation of a X.509 certificate.
- Parameters
-
[in] | cert | X.509 certificate |
- Returns
- X.509 certificate string representation.
◆ generate_evp_pkey()
Generate EVP_PKEY containing public and private keys.
- Returns
- Unique pointer to EVP_PKEY object on success or std::error_code if key generation failed.
◆ generate_x509()
stdx::expected< X509Cert, std::error_code > CertificateGenerator::generate_x509 |
( |
EVP_PKEY * |
pkey, |
|
|
const std::string & |
common_name, |
|
|
const uint32_t |
serial, |
|
|
X509 * |
ca_cert, |
|
|
EVP_PKEY * |
ca_pkey, |
|
|
uint32_t |
notbefore = 0 , |
|
|
uint32_t |
notafter = 10 * k_year |
|
) |
| const |
Generate X.509 cerificate.
Generate X.509 cerificate that could be either self-signed or signed by some provided CA certificate. Certificate will be by default valid for 10 years.
- Parameters
-
[in] | pkey | EVP_PKEY object containing public/private key pair. |
[in] | common_name | Common name that will be used in certificate Subject name section. |
[in] | serial | Serial number that will be encoded into the certificate. |
[in] | ca_cert | Certificate that will be used to sign certificate returned by this method. If ca_cert is nullptr then returned certificate will be self-signed. |
[in] | ca_pkey | CA private key that will be used to sign the certificate, for a self signed certificate 'pkey' argument will be used. |
[in] | notbefore | Certificate validity period start. |
[in] | notafter | Certificate validity period end. |
- Returns
- X.509 certificate on success or std::error_code if certificate generation failed.
◆ pkey_to_string()
std::string CertificateGenerator::pkey_to_string |
( |
EVP_PKEY * |
pkey | ) |
|
|
static |
Get string representation of a private key.
- Parameters
-
- Returns
- Private key string representation.
◆ k_max_cn_name_length
constexpr static uint32_t CertificateGenerator::k_max_cn_name_length = 64 |
|
staticconstexprprivate |
◆ k_year
constexpr static uint32_t CertificateGenerator::k_year = 365 * 24 * 60 * 60 |
|
staticconstexprprivate |
The documentation for this class was generated from the following files: