MySQL 9.0.0
Source Code Documentation
CertificateHandler Class Reference

#include <certificate_handler.h>

Public Member Functions

 CertificateHandler (mysql_harness::Path ca_key_path, mysql_harness::Path ca_cert_path, mysql_harness::Path router_key_path, mysql_harness::Path router_cert_path)
 Handle X.509 Router and CA keys and certificates. More...
 
bool no_cert_files_exists () const
 Check if none of the Router and CA key/certificate files exists. More...
 
bool router_cert_files_exists () const
 Check if Router key and certificate files exists. More...
 
stdx::expected< void, std::error_code > create ()
 Create Router and CA key and certificate files at configured paths. More...
 

Private Attributes

CertificateGenerator cert_gen_
 
mysql_harness::Path ca_key_path_
 
mysql_harness::Path ca_cert_path_
 
mysql_harness::Path router_key_path_
 
mysql_harness::Path router_cert_path_
 
const std::string k_CA_CN {"MySQL_Router_Auto_Generated_CA_Certificate"}
 
const std::string k_router_CN
 

Constructor & Destructor Documentation

◆ CertificateHandler()

CertificateHandler::CertificateHandler ( mysql_harness::Path  ca_key_path,
mysql_harness::Path  ca_cert_path,
mysql_harness::Path  router_key_path,
mysql_harness::Path  router_cert_path 
)
inline

Handle X.509 Router and CA keys and certificates.

Parameters
[in]ca_key_pathPath to CA key file.
[in]ca_cert_pathPath to CA certificate file.
[in]router_key_pathPath to Router key file.
[in]router_cert_pathPath to Router certificate file.

Member Function Documentation

◆ create()

stdx::expected< void, std::error_code > CertificateHandler::create ( )

Create Router and CA key and certificate files at configured paths.

Returns
std::error_code on failure

◆ no_cert_files_exists()

bool CertificateHandler::no_cert_files_exists ( ) const

Check if none of the Router and CA key/certificate files exists.

Return values
trueNo certificate file exists.
falseSome certificate files exists.

◆ router_cert_files_exists()

bool CertificateHandler::router_cert_files_exists ( ) const

Check if Router key and certificate files exists.

Return values
trueBoth Router key and certificate files exists.
falseRouter certificate and/or key file is missing.

Member Data Documentation

◆ ca_cert_path_

mysql_harness::Path CertificateHandler::ca_cert_path_
private

◆ ca_key_path_

mysql_harness::Path CertificateHandler::ca_key_path_
private

◆ cert_gen_

CertificateGenerator CertificateHandler::cert_gen_
private

◆ k_CA_CN

const std::string CertificateHandler::k_CA_CN {"MySQL_Router_Auto_Generated_CA_Certificate"}
private

◆ k_router_CN

const std::string CertificateHandler::k_router_CN
private
Initial value:
{
"MySQL_Router_Auto_Generated_Router_Certificate"}

◆ router_cert_path_

mysql_harness::Path CertificateHandler::router_cert_path_
private

◆ router_key_path_

mysql_harness::Path CertificateHandler::router_key_path_
private

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