From 20669e3f88555328819d29258b25a1b443ebc3bc Mon Sep 17 00:00:00 2001 From: AssemblyJohn Date: Wed, 4 Dec 2024 16:00:30 +0200 Subject: [PATCH] Updated interface for security library Signed-off-by: AssemblyJohn --- dependencies.yaml | 4 ++-- interfaces/evse_security.yaml | 10 ++++++++++ lib/staging/ocpp/evse_security_ocpp.cpp | 4 ++++ lib/staging/ocpp/evse_security_ocpp.hpp | 1 + modules/EvseSecurity/main/evse_securityImpl.cpp | 4 ++++ modules/EvseSecurity/main/evse_securityImpl.hpp | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index ddaf4156c..dc8ebf769 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -61,13 +61,13 @@ libcurl: # of libocpp and would otherwise be overwritten by the version used there libevse-security: git: https://github.com/EVerest/libevse-security.git - git_tag: v0.9.1 + git_tag: v0.9.2 cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBEVSE_SECURITY" # OCPP libocpp: git: https://github.com/EVerest/libocpp.git - git_tag: 9836ac4766e99a79555adb15c3001c8704f8b7a7 + git_tag: 469629c615e369f4bb77b3b2f861e0d56b550d15 cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBOCPP" # Josev Josev: diff --git a/interfaces/evse_security.yaml b/interfaces/evse_security.yaml index 1af1f11fd..44d4bcfc6 100644 --- a/interfaces/evse_security.yaml +++ b/interfaces/evse_security.yaml @@ -184,6 +184,16 @@ cmds: result: description: The path of the CA bundle file type: string + get_verify_location: + description: Command to get the file path of the CA root directory that can be used for verification. Will also invoke c_rehash for that directory + arguments: + certificate_type: + description: Specifies that CA certificate type + type: string + $ref: /evse_security#/CaCertificateType + result: + description: The path of the CA certificates directory + type: string get_leaf_expiry_days_count: description: >- Command to get the days count until the given leaf certificate expires. diff --git a/lib/staging/ocpp/evse_security_ocpp.cpp b/lib/staging/ocpp/evse_security_ocpp.cpp index 4bc7227f8..74e8146ba 100644 --- a/lib/staging/ocpp/evse_security_ocpp.cpp +++ b/lib/staging/ocpp/evse_security_ocpp.cpp @@ -124,6 +124,10 @@ std::string EvseSecurity::get_verify_file(const ocpp::CaCertificateType& certifi return this->r_security.call_get_verify_file(conversions::from_ocpp(certificate_type)); } +std::string EvseSecurity::get_verify_location(const ocpp::CaCertificateType& certificate_type) { + return this->r_security.call_get_verify_location(conversions::from_ocpp(certificate_type)); +} + int EvseSecurity::get_leaf_expiry_days_count(const ocpp::CertificateSigningUseEnum& certificate_type) { return this->r_security.call_get_leaf_expiry_days_count(conversions::from_ocpp(certificate_type)); } diff --git a/lib/staging/ocpp/evse_security_ocpp.hpp b/lib/staging/ocpp/evse_security_ocpp.hpp index 8a7ff6857..21c057cd9 100644 --- a/lib/staging/ocpp/evse_security_ocpp.hpp +++ b/lib/staging/ocpp/evse_security_ocpp.hpp @@ -40,6 +40,7 @@ class EvseSecurity : public ocpp::EvseSecurity { bool include_ocsp) override; bool update_certificate_links(const ocpp::CertificateSigningUseEnum& certificate_type) override; std::string get_verify_file(const ocpp::CaCertificateType& certificate_type) override; + std::string get_verify_location(const ocpp::CaCertificateType& certificate_type) override; int get_leaf_expiry_days_count(const ocpp::CertificateSigningUseEnum& certificate_type) override; }; diff --git a/modules/EvseSecurity/main/evse_securityImpl.cpp b/modules/EvseSecurity/main/evse_securityImpl.cpp index 29fe3a5d1..745605b80 100644 --- a/modules/EvseSecurity/main/evse_securityImpl.cpp +++ b/modules/EvseSecurity/main/evse_securityImpl.cpp @@ -145,6 +145,10 @@ std::string evse_securityImpl::handle_get_verify_file(types::evse_security::CaCe return this->evse_security->get_verify_file(conversions::from_everest(certificate_type)); } +std::string evse_securityImpl::handle_get_verify_location(types::evse_security::CaCertificateType& certificate_type) { + return this->evse_security->handle_get_verify_location(conversions::from_everest(certificate_type)); +} + int evse_securityImpl::handle_get_leaf_expiry_days_count(types::evse_security::LeafCertificateType& certificate_type) { return this->evse_security->get_leaf_expiry_days_count(conversions::from_everest(certificate_type)); } diff --git a/modules/EvseSecurity/main/evse_securityImpl.hpp b/modules/EvseSecurity/main/evse_securityImpl.hpp index 768d88e40..26d20d79d 100644 --- a/modules/EvseSecurity/main/evse_securityImpl.hpp +++ b/modules/EvseSecurity/main/evse_securityImpl.hpp @@ -64,6 +64,7 @@ class evse_securityImpl : public evse_securityImplBase { handle_get_all_valid_certificates_info(types::evse_security::LeafCertificateType& certificate_type, types::evse_security::EncodingFormat& encoding, bool& include_ocsp) override; virtual std::string handle_get_verify_file(types::evse_security::CaCertificateType& certificate_type) override; + virtual std::string handle_get_verify_location(types::evse_security::CaCertificateType& certificate_type) override; virtual int handle_get_leaf_expiry_days_count(types::evse_security::LeafCertificateType& certificate_type) override; virtual bool handle_verify_file_signature(std::string& file_path, std::string& signing_certificate, std::string& signature) override;