diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c94fb6..1ce4593 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.14) -project(everest-evse_security VERSION 0.3.0 +project(everest-evse_security VERSION 0.4.0 DESCRIPTION "Implementation of EVSE related security operations" LANGUAGES CXX C ) diff --git a/include/evse_security/evse_security.hpp b/include/evse_security/evse_security.hpp index 9046471..af63ff9 100644 --- a/include/evse_security/evse_security.hpp +++ b/include/evse_security/evse_security.hpp @@ -96,7 +96,19 @@ class EvseSecurity { bool is_ca_certificate_installed(CaCertificateType certificate_type); /// @brief Generates a certificate signing request for the given \p certificate_type , \p country , \p organization - /// and \p common + /// and \p common , uses the TPM if \p use_tpm is true + /// @param certificate_type + /// @param country + /// @param organization + /// @param common + /// @param use_tpm If the TPM should be used for the CSR request + /// @return the PEM formatted certificate signing request + std::string generate_certificate_signing_request(LeafCertificateType certificate_type, const std::string& country, + const std::string& organization, const std::string& common, + bool use_tpm); + + /// @brief Generates a certificate signing request for the given \p certificate_type , \p country , \p organization + /// and \p common without using the TPM /// @param certificate_type /// @param country /// @param organization diff --git a/lib/evse_security/evse_security.cpp b/lib/evse_security/evse_security.cpp index a818ea6..c6a2b8d 100644 --- a/lib/evse_security/evse_security.cpp +++ b/lib/evse_security/evse_security.cpp @@ -559,7 +559,7 @@ bool EvseSecurity::is_ca_certificate_installed(CaCertificateType certificate_typ std::string EvseSecurity::generate_certificate_signing_request(LeafCertificateType certificate_type, const std::string& country, const std::string& organization, - const std::string& common) { + const std::string& common, bool use_tpm) { fs::path key_path; const auto file_name = std::string("SECC_LEAF_") + filesystem_utils::get_random_file_name(KEY_EXTENSION.string()); @@ -574,9 +574,6 @@ std::string EvseSecurity::generate_certificate_signing_request(LeafCertificateTy std::string csr; CertificateSigningRequestInfo info; - // TODO(ioan): get this from the parameter when the interface will support it - bool use_tpm = false; - info.n_version = 0; info.commonName = common; info.country = country; @@ -598,6 +595,13 @@ std::string EvseSecurity::generate_certificate_signing_request(LeafCertificateTy return csr; } +std::string EvseSecurity::generate_certificate_signing_request(LeafCertificateType certificate_type, + const std::string& country, + const std::string& organization, + const std::string& common) { + return generate_certificate_signing_request(certificate_type, country, organization, common, false); +} + GetKeyPairResult EvseSecurity::get_key_pair(LeafCertificateType certificate_type, EncodingFormat encoding) { EVLOG_debug << "Requesting key/pair: " << conversions::leaf_certificate_type_to_string(certificate_type);