ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Public Member Functions | List of all members
ocpp::EvseSecurityImpl Class Reference
Inheritance diagram for ocpp::EvseSecurityImpl:
ocpp::EvseSecurity

Public Member Functions

 EvseSecurityImpl (const SecurityConfiguration &file_paths)
 
InstallCertificateResult install_ca_certificate (const std::string &certificate, const CaCertificateType &certificate_type) override
 Installs the CA certificate for the given certificate_type . This function respects the requirements of OCPP specified for the CSMS initiated message InstallCertificate.req . More...
 
DeleteCertificateResult delete_certificate (const CertificateHashDataType &certificate_hash_data) override
 Deletes the certificate specified by certificate_hash_data . This function respects the requirements of OCPP specified for the CSMS initiated message DeleteCertificate.req. More...
 
InstallCertificateResult update_leaf_certificate (const std::string &certificate_chain, const CertificateSigningUseEnum &certificate_type) override
 Verifies the given certificate_chain for the given certificate_type using the respective CA certificates for the leaf and if valid installs the certificate. Before installing the certificate, this function checks if a private key is present for the given certificate. This function respects the requirements of OCPP specified for the CSMS initiated message CertificateSigned.req . More...
 
CertificateValidationResult verify_certificate (const std::string &certificate_chain, const LeafCertificateType &certificate_type) override
 Verifies the given certificate_chain for the given certificate_type against the respective CA certificates for the leaf according to the requirements specified in OCPP. More...
 
std::vector< CertificateHashDataChainget_installed_certificates (const std::vector< CertificateType > &certificate_types) override
 Retrieves all certificates installed on the filesystem applying the certificate_types filter. This function respects the requirements of OCPP specified for the CSMS initiated message GetInstalledCertificateIds.req . More...
 
std::vector< OCSPRequestDataget_v2g_ocsp_request_data () override
 Retrieves the OCSP request data of the V2G certificates (exluding the root). This function respects the requirements of OCPP specified for the CSMS initiated message GetCertificateStatus.req . More...
 
std::vector< OCSPRequestDataget_mo_ocsp_request_data (const std::string &certificate_chain) override
 Retrieves the OCSP request data of a certificate chain. More...
 
void update_ocsp_cache (const CertificateHashDataType &certificate_hash_data, const std::string &ocsp_response) override
 Updates the OCSP cache for the given certificate_hash_data with the given ocsp_response. More...
 
bool is_ca_certificate_installed (const CaCertificateType &certificate_type) override
 Indicates if a CA certificate for the given certificate_type is installed on the filesystem. More...
 
GetCertificateSignRequestResult generate_certificate_signing_request (const CertificateSigningUseEnum &certificate_type, const std::string &country, const std::string &organization, const std::string &common, bool use_tpm) override
 Generates a certificate signing request for the given certificate_type , country , organization and common , uses the TPM if use_tpm is true. More...
 
GetCertificateInfoResult get_leaf_certificate_info (const CertificateSigningUseEnum &certificate_type, bool include_ocsp=false) override
 Searches the filesystem on the specified directories for the given certificate_type and retrieves the most recent certificate that is already valid and the respective key. If no certificate is present or no key is matching the certificate, this function returns a GetKeyPairStatus other than "Accepted". The function update_leaf_certificate will install two files for each leaf, one containing the single leaf and one containing the leaf including any possible SUBCAs. More...
 
bool update_certificate_links (const CertificateSigningUseEnum &certificate_type) override
 Updates the certificate and key links for the given certificate_type. More...
 
std::string get_verify_file (const CaCertificateType &certificate_type) override
 Retrieves the PEM formatted CA bundle file for the given certificate_type. More...
 
std::string get_verify_location (const CaCertificateType &certificate_type) override
 Retrieves the PEM formatted CA bundle location for the given certificate_type. More...
 
int get_leaf_expiry_days_count (const CertificateSigningUseEnum &certificate_type) override
 Gets the expiry day count for the leaf certificate of the given certificate_type. More...
 
virtual InstallCertificateResult install_ca_certificate (const std::string &certificate, const CaCertificateType &certificate_type)=0
 Installs the CA certificate for the given certificate_type . This function respects the requirements of OCPP specified for the CSMS initiated message InstallCertificate.req . More...
 
virtual DeleteCertificateResult delete_certificate (const CertificateHashDataType &certificate_hash_data)=0
 Deletes the certificate specified by certificate_hash_data . This function respects the requirements of OCPP specified for the CSMS initiated message DeleteCertificate.req. More...
 
virtual InstallCertificateResult update_leaf_certificate (const std::string &certificate_chain, const CertificateSigningUseEnum &certificate_type)=0
 Verifies the given certificate_chain for the given certificate_type using the respective CA certificates for the leaf and if valid installs the certificate. Before installing the certificate, this function checks if a private key is present for the given certificate. This function respects the requirements of OCPP specified for the CSMS initiated message CertificateSigned.req . More...
 
virtual CertificateValidationResult verify_certificate (const std::string &certificate_chain, const LeafCertificateType &certificate_type)=0
 Verifies the given certificate_chain for the given certificate_type against the respective CA certificates for the leaf according to the requirements specified in OCPP. More...
 
virtual std::vector< CertificateHashDataChainget_installed_certificates (const std::vector< CertificateType > &certificate_types)=0
 Retrieves all certificates installed on the filesystem applying the certificate_types filter. This function respects the requirements of OCPP specified for the CSMS initiated message GetInstalledCertificateIds.req . More...
 
virtual std::vector< OCSPRequestDataget_v2g_ocsp_request_data ()=0
 Retrieves the OCSP request data of the V2G certificates (exluding the root). This function respects the requirements of OCPP specified for the CSMS initiated message GetCertificateStatus.req . More...
 
virtual std::vector< OCSPRequestDataget_mo_ocsp_request_data (const std::string &certificate_chain)=0
 Retrieves the OCSP request data of a certificate chain. More...
 
virtual void update_ocsp_cache (const CertificateHashDataType &certificate_hash_data, const std::string &ocsp_response)=0
 Updates the OCSP cache for the given certificate_hash_data with the given ocsp_response. More...
 
virtual bool is_ca_certificate_installed (const CaCertificateType &certificate_type)=0
 Indicates if a CA certificate for the given certificate_type is installed on the filesystem. More...
 
virtual GetCertificateSignRequestResult generate_certificate_signing_request (const CertificateSigningUseEnum &certificate_type, const std::string &country, const std::string &organization, const std::string &common, bool use_tpm)=0
 Generates a certificate signing request for the given certificate_type , country , organization and common , uses the TPM if use_tpm is true. More...
 
virtual GetCertificateInfoResult get_leaf_certificate_info (const CertificateSigningUseEnum &certificate_type, bool include_ocsp=false)=0
 Searches the filesystem on the specified directories for the given certificate_type and retrieves the most recent certificate that is already valid and the respective key. If no certificate is present or no key is matching the certificate, this function returns a GetKeyPairStatus other than "Accepted". The function update_leaf_certificate will install two files for each leaf, one containing the single leaf and one containing the leaf including any possible SUBCAs. More...
 
virtual bool update_certificate_links (const CertificateSigningUseEnum &certificate_type)=0
 Updates the certificate and key links for the given certificate_type. More...
 
virtual std::string get_verify_file (const CaCertificateType &certificate_type)=0
 Retrieves the PEM formatted CA bundle file for the given certificate_type. More...
 
virtual std::string get_verify_location (const CaCertificateType &certificate_type)=0
 Retrieves the PEM formatted CA bundle location for the given certificate_type. More...
 
virtual int get_leaf_expiry_days_count (const CertificateSigningUseEnum &certificate_type)=0
 Gets the expiry day count for the leaf certificate of the given certificate_type. More...
 

Member Function Documentation

◆ delete_certificate()

DeleteCertificateResult ocpp::EvseSecurityImpl::delete_certificate ( const CertificateHashDataType certificate_hash_data)
overridevirtual

Deletes the certificate specified by certificate_hash_data . This function respects the requirements of OCPP specified for the CSMS initiated message DeleteCertificate.req.

Parameters
certificate_hash_dataspecifies the certificate to be deleted
Returns
result of the operation

Implements ocpp::EvseSecurity.

◆ generate_certificate_signing_request()

GetCertificateSignRequestResult ocpp::EvseSecurityImpl::generate_certificate_signing_request ( const CertificateSigningUseEnum &  certificate_type,
const std::string &  country,
const std::string &  organization,
const std::string &  common,
bool  use_tpm 
)
overridevirtual

Generates a certificate signing request for the given certificate_type , country , organization and common , uses the TPM if use_tpm is true.

Parameters
certificate_type
country
organization
common
use_tpmIf the TPM should be used for the CSR request
Returns
the status and an optional PEM formatted certificate signing request string

Implements ocpp::EvseSecurity.

◆ get_installed_certificates()

std::vector< CertificateHashDataChain > ocpp::EvseSecurityImpl::get_installed_certificates ( const std::vector< CertificateType > &  certificate_types)
overridevirtual

Retrieves all certificates installed on the filesystem applying the certificate_types filter. This function respects the requirements of OCPP specified for the CSMS initiated message GetInstalledCertificateIds.req .

Parameters
certificate_types
Returns
contains the certificate hash data chains of the requested certificate_types

Implements ocpp::EvseSecurity.

◆ get_leaf_certificate_info()

GetCertificateInfoResult ocpp::EvseSecurityImpl::get_leaf_certificate_info ( const CertificateSigningUseEnum &  certificate_type,
bool  include_ocsp = false 
)
overridevirtual

Searches the filesystem on the specified directories for the given certificate_type and retrieves the most recent certificate that is already valid and the respective key. If no certificate is present or no key is matching the certificate, this function returns a GetKeyPairStatus other than "Accepted". The function update_leaf_certificate will install two files for each leaf, one containing the single leaf and one containing the leaf including any possible SUBCAs.

Parameters
certificate_typetype of the leaf certificate
include_ocspif OCSP data should be included
Returns
contains response result, with info related to the certificate chain and response status

Implements ocpp::EvseSecurity.

◆ get_leaf_expiry_days_count()

int ocpp::EvseSecurityImpl::get_leaf_expiry_days_count ( const CertificateSigningUseEnum &  certificate_type)
overridevirtual

Gets the expiry day count for the leaf certificate of the given certificate_type.

Parameters
certificate_type
Returns
day count until the leaf certificate expires

Implements ocpp::EvseSecurity.

◆ get_mo_ocsp_request_data()

std::vector< OCSPRequestData > ocpp::EvseSecurityImpl::get_mo_ocsp_request_data ( const std::string &  certificate_chain)
overridevirtual

Retrieves the OCSP request data of a certificate chain.

Parameters
certificate_chainPEM formatted certificate or certificate chain
certificate_typetype of the leaf certificate
Returns
contains OCSP request data

Implements ocpp::EvseSecurity.

◆ get_v2g_ocsp_request_data()

std::vector< OCSPRequestData > ocpp::EvseSecurityImpl::get_v2g_ocsp_request_data ( )
overridevirtual

Retrieves the OCSP request data of the V2G certificates (exluding the root). This function respects the requirements of OCPP specified for the CSMS initiated message GetCertificateStatus.req .

Returns
contains OCSP request data

Implements ocpp::EvseSecurity.

◆ get_verify_file()

std::string ocpp::EvseSecurityImpl::get_verify_file ( const CaCertificateType &  certificate_type)
overridevirtual

Retrieves the PEM formatted CA bundle file for the given certificate_type.

Parameters
certificate_type
Returns
CA certificate file

Implements ocpp::EvseSecurity.

◆ get_verify_location()

std::string ocpp::EvseSecurityImpl::get_verify_location ( const CaCertificateType &  certificate_type)
overridevirtual

Retrieves the PEM formatted CA bundle location for the given certificate_type.

Parameters
certificate_type
Returns
CA certificate file

Implements ocpp::EvseSecurity.

◆ install_ca_certificate()

InstallCertificateResult ocpp::EvseSecurityImpl::install_ca_certificate ( const std::string &  certificate,
const CaCertificateType &  certificate_type 
)
overridevirtual

Installs the CA certificate for the given certificate_type . This function respects the requirements of OCPP specified for the CSMS initiated message InstallCertificate.req .

Parameters
certificatePEM formatted CA certificate
certificate_typespecifies the CA certificate type
Returns
result of the operation

Implements ocpp::EvseSecurity.

◆ is_ca_certificate_installed()

bool ocpp::EvseSecurityImpl::is_ca_certificate_installed ( const CaCertificateType &  certificate_type)
overridevirtual

Indicates if a CA certificate for the given certificate_type is installed on the filesystem.

Parameters
certificate_type
Returns
true if CA certificate is present, else false

Implements ocpp::EvseSecurity.

◆ update_certificate_links()

bool ocpp::EvseSecurityImpl::update_certificate_links ( const CertificateSigningUseEnum &  certificate_type)
overridevirtual

Updates the certificate and key links for the given certificate_type.

Implements ocpp::EvseSecurity.

◆ update_leaf_certificate()

InstallCertificateResult ocpp::EvseSecurityImpl::update_leaf_certificate ( const std::string &  certificate_chain,
const CertificateSigningUseEnum &  certificate_type 
)
overridevirtual

Verifies the given certificate_chain for the given certificate_type using the respective CA certificates for the leaf and if valid installs the certificate. Before installing the certificate, this function checks if a private key is present for the given certificate. This function respects the requirements of OCPP specified for the CSMS initiated message CertificateSigned.req .

Parameters
certificate_chainPEM formatted certificate or certificate chain
certificate_typetype of the leaf certificate
Returns
result of the operation

Implements ocpp::EvseSecurity.

◆ update_ocsp_cache()

void ocpp::EvseSecurityImpl::update_ocsp_cache ( const CertificateHashDataType certificate_hash_data,
const std::string &  ocsp_response 
)
overridevirtual

Updates the OCSP cache for the given certificate_hash_data with the given ocsp_response.

Parameters
certificate_hash_dataidentifies the certificate for which the ocsp_response is specified
ocsp_responsethe actual OCSP data

Implements ocpp::EvseSecurity.

◆ verify_certificate()

CertificateValidationResult ocpp::EvseSecurityImpl::verify_certificate ( const std::string &  certificate_chain,
const LeafCertificateType &  certificate_type 
)
overridevirtual

Verifies the given certificate_chain for the given certificate_type against the respective CA certificates for the leaf according to the requirements specified in OCPP.

Parameters
certificate_chainPEM formatted certificate or certificate chain
certificate_typetype of the leaf certificate
Returns
result of the operation

Implements ocpp::EvseSecurity.


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