-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added dependency to libevse-security and used this for implementation…
… of evse_security interface. This internal evse_security_impl is used of no external implementation is given in the ChargePoint constructor Signed-off-by: pietfried <[email protected]>
- Loading branch information
Showing
19 changed files
with
573 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ date: | |
websocketpp: | ||
git: https://github.com/zaphoyd/websocketpp.git | ||
git_tag: 0.8.2 | ||
libevse-security: | ||
git: [email protected]:EVerest/libevse-security.git | ||
git_tag: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest | ||
#ifndef OCPP_COMMON_EVSE_SECURITY_IMPL | ||
#define OCPP_COMMON_EVSE_SECURITY_IMPL | ||
|
||
#include <filesystem> | ||
#include <optional> | ||
|
||
#include <evse_security.hpp> | ||
#include <ocpp/common/evse_security.hpp> | ||
|
||
namespace ocpp { | ||
|
||
struct SecurityConfiguration { | ||
std::filesystem::path csms_ca_bundle; | ||
std::filesystem::path mf_ca_bundle; | ||
std::filesystem::path mo_ca_bundle; | ||
std::filesystem::path v2g_ca_bundle; | ||
std::filesystem::path csms_leaf_cert_directory; | ||
std::filesystem::path csms_leaf_key_directory; | ||
std::filesystem::path secc_leaf_cert_directory; | ||
std::filesystem::path secc_leaf_key_directory; | ||
std::optional<std::string> private_key_password; | ||
}; | ||
|
||
class EvseSecurityImpl : public EvseSecurity { | ||
|
||
private: | ||
std::unique_ptr<evse_security::EvseSecurity> evse_security; | ||
|
||
public: | ||
explicit EvseSecurityImpl(const SecurityConfiguration& file_paths); | ||
InstallCertificateResult install_ca_certificate(const std::string& certificate, | ||
const CaCertificateType& certificate_type) override; | ||
DeleteCertificateResult delete_certificate(const CertificateHashDataType& certificate_hash_data) override; | ||
InstallCertificateResult update_leaf_certificate(const std::string& certificate_chain, | ||
const CertificateSigningUseEnum& certificate_type) override; | ||
InstallCertificateResult verify_certificate(const std::string& certificate_chain, | ||
const CertificateSigningUseEnum& certificate_type) override; | ||
std::vector<CertificateHashDataChain> | ||
get_installed_certificates(const std::vector<CertificateType>& certificate_types) override; | ||
std::vector<OCSPRequestData> get_ocsp_request_data() override; | ||
void update_ocsp_cache(const CertificateHashDataType& certificate_hash_data, | ||
const std::string& ocsp_response) override; | ||
bool is_ca_certificate_installed(const CaCertificateType& certificate_type) override; | ||
std::string generate_certificate_signing_request(const CertificateSigningUseEnum& certificate_type, | ||
const std::string& country, const std::string& organization, | ||
const std::string& common) override; | ||
std::optional<KeyPair> get_key_pair(const CertificateSigningUseEnum& certificate_type) override; | ||
std::string get_verify_file(const CaCertificateType& certificate_type) override; | ||
int get_leaf_expiry_days_count(const CertificateSigningUseEnum& certificate_type) override; | ||
}; | ||
|
||
namespace conversions { | ||
|
||
CaCertificateType to_ocpp(evse_security::CaCertificateType other); | ||
CertificateSigningUseEnum to_ocpp(evse_security::LeafCertificateType other); | ||
CertificateType to_ocpp(evse_security::CertificateType other); | ||
HashAlgorithmEnumType to_ocpp(evse_security::HashAlgorithm other); | ||
InstallCertificateResult to_ocpp(evse_security::InstallCertificateResult other); | ||
DeleteCertificateResult to_ocpp(evse_security::DeleteCertificateResult other); | ||
|
||
CertificateHashDataType to_ocpp(evse_security::CertificateHashData other); | ||
CertificateHashDataChain to_ocpp(evse_security::CertificateHashDataChain other); | ||
OCSPRequestData to_ocpp(evse_security::OCSPRequestData other); | ||
KeyPair to_ocpp(evse_security::KeyPair other); | ||
|
||
evse_security::CaCertificateType from_ocpp(CaCertificateType other); | ||
evse_security::LeafCertificateType from_ocpp(CertificateSigningUseEnum other); | ||
evse_security::CertificateType from_ocpp(CertificateType other); | ||
evse_security::HashAlgorithm from_ocpp(HashAlgorithmEnumType other); | ||
evse_security::InstallCertificateResult from_ocpp(InstallCertificateResult other); | ||
evse_security::DeleteCertificateResult from_ocpp(DeleteCertificateResult other); | ||
|
||
evse_security::CertificateHashData from_ocpp(CertificateHashDataType other); | ||
evse_security::CertificateHashDataChain from_ocpp(CertificateHashDataChain other); | ||
evse_security::OCSPRequestData from_ocpp(OCSPRequestData other); | ||
evse_security::KeyPair from_ocpp(KeyPair other); | ||
|
||
}; // namespace conversions | ||
|
||
} // namespace ocpp | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.