3#ifndef OCPP_COMMON_EVSE_SECURITY_IMPL
4#define OCPP_COMMON_EVSE_SECURITY_IMPL
9#include <evse_security/evse_security.hpp>
10#include <ocpp/common/evse_security.hpp>
11#include <ocpp/common/support_older_cpp_versions.hpp>
16 fs::path csms_ca_bundle;
17 fs::path mf_ca_bundle;
18 fs::path mo_ca_bundle;
19 fs::path v2g_ca_bundle;
20 fs::path csms_leaf_cert_directory;
21 fs::path csms_leaf_key_directory;
22 fs::path secc_leaf_cert_directory;
23 fs::path secc_leaf_key_directory;
24 fs::path secc_leaf_cert_link;
25 fs::path secc_leaf_key_link;
26 fs::path cpo_cert_chain_link;
27 std::optional<std::string> private_key_password;
33 std::unique_ptr<evse_security::EvseSecurity> evse_security;
38 const CaCertificateType& certificate_type)
override;
41 const CertificateSigningUseEnum& certificate_type)
override;
43 const LeafCertificateType& certificate_type)
override;
44 std::vector<CertificateHashDataChain>
49 const std::string& ocsp_response)
override;
53 const std::string& organization,
const std::string& common,
54 bool use_tpm)
override;
56 bool include_ocsp =
false)
override;
58 std::string
get_verify_file(
const CaCertificateType& certificate_type)
override;
63namespace conversions {
65GetCertificateSignRequestStatus to_ocpp(evse_security::GetCertificateSignRequestStatus other);
66CaCertificateType to_ocpp(evse_security::CaCertificateType other);
67CertificateType to_ocpp(evse_security::CertificateType other);
68HashAlgorithmEnumType to_ocpp(evse_security::HashAlgorithm other);
69GetCertificateInfoStatus to_ocpp(evse_security::GetCertificateInfoStatus other);
70InstallCertificateResult to_ocpp(evse_security::InstallCertificateResult other);
71CertificateValidationResult to_ocpp(evse_security::CertificateValidationResult other);
72DeleteCertificateResult to_ocpp(evse_security::DeleteCertificateResult other);
80evse_security::CaCertificateType from_ocpp(CaCertificateType other);
81evse_security::LeafCertificateType from_ocpp(LeafCertificateType other);
82evse_security::LeafCertificateType from_ocpp(CertificateSigningUseEnum other);
83evse_security::CertificateType from_ocpp(CertificateType other);
84evse_security::HashAlgorithm from_ocpp(HashAlgorithmEnumType other);
85evse_security::InstallCertificateResult from_ocpp(InstallCertificateResult other);
86evse_security::DeleteCertificateResult from_ocpp(DeleteCertificateResult other);
Definition: evse_security_impl.hpp:30
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 certifica...
Definition: evse_security_impl.cpp:37
std::vector< OCSPRequestData > get_mo_ocsp_request_data(const std::string &certificate_chain) override
Retrieves the OCSP request data of a certificate chain.
Definition: evse_security_impl.cpp:79
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.
Definition: evse_security_impl.cpp:95
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.
Definition: evse_security_impl.cpp:141
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 ...
Definition: evse_security_impl.cpp:27
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 certifi...
Definition: evse_security_impl.cpp:43
bool update_certificate_links(const CertificateSigningUseEnum &certificate_type) override
Updates the certificate and key links for the given certificate_type.
Definition: evse_security_impl.cpp:129
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 ,...
Definition: evse_security_impl.cpp:100
std::vector< OCSPRequestData > get_v2g_ocsp_request_data() override
Retrieves the OCSP request data of the V2G certificates (exluding the root). This function respects t...
Definition: evse_security_impl.cpp:68
std::vector< CertificateHashDataChain > get_installed_certificates(const std::vector< CertificateType > &certificate_types) override
Retrieves all certificates installed on the filesystem applying the certificate_types filter....
Definition: evse_security_impl.cpp:51
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...
Definition: evse_security_impl.cpp:114
std::string get_verify_file(const CaCertificateType &certificate_type) override
Retrieves the PEM formatted CA bundle file for the given certificate_type.
Definition: evse_security_impl.cpp:133
DeleteCertificateResult delete_certificate(const CertificateHashDataType &certificate_hash_data) override
Deletes the certificate specified by certificate_hash_data . This function respects the requirements ...
Definition: evse_security_impl.cpp:33
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.
Definition: evse_security_impl.cpp:90
std::string get_verify_location(const CaCertificateType &certificate_type) override
Retrieves the PEM formatted CA bundle location for the given certificate_type.
Definition: evse_security_impl.cpp:137
Handler for security related operations of the charging station.
Definition: evse_security.hpp:17
Definition: types.hpp:596
Definition: types.hpp:558
Definition: types.hpp:687
Definition: types.hpp:682
Definition: types.hpp:696
Definition: types.hpp:677
Struct for OCSPRequestData.
Definition: types.hpp:654
Definition: evse_security_impl.hpp:15