@@ -786,17 +786,20 @@ ocpp::types::DeleteCertificateStatusEnumType DefaultChargePointEventsHandler::is
786786 bool,
787787 bool,
788788 bool,
789+ bool,
789790 std::vector<std::tuple<GetCertificateIdUseEnumType, Certificate, std::vector<Certificate>>>&) */
790791void DefaultChargePointEventsHandler::iso15118GetInstalledCertificates (
791792 bool v2g_root_certificate,
792793 bool mo_root_certificate,
793794 bool v2g_certificate_chain,
795+ bool oem_root_certificate,
794796 std::vector<std::tuple<ocpp::types::GetCertificateIdUseEnumType, ocpp::x509::Certificate, std::vector<ocpp::x509::Certificate>>>&
795797 certificates)
796798{
797799 cout << " ISO15118 get installed certificates requested : v2g_root_certificate = " << (v2g_root_certificate ? " yes" : " no" )
798800 << " - mo_root_certificate = " << (mo_root_certificate ? " yes" : " no" )
799- << " - v2g_certificate_chain = " << (v2g_certificate_chain ? " yes" : " no" ) << endl;
801+ << " - v2g_certificate_chain = " << (v2g_certificate_chain ? " yes" : " no" )
802+ << " - oem_root_certificate = " << (oem_root_certificate ? " yes" : " no" ) << endl;
800803
801804 for (auto const & dir_entry : std::filesystem::directory_iterator{m_working_dir})
802805 {
@@ -833,6 +836,16 @@ void DefaultChargePointEventsHandler::iso15118GetInstalledCertificates(
833836 certificates.emplace_back (std::move (tuple));
834837 }
835838 }
839+ if (oem_root_certificate)
840+ {
841+ if (ocpp::helpers::startsWith (filename, " iso_oem_root_" ) && ocpp::helpers::endsWith (filename, " .pem" ))
842+ {
843+ auto tuple = std::make_tuple (GetCertificateIdUseEnumType::OEMRootCertificate,
844+ Certificate (dir_entry.path ()),
845+ std::vector<ocpp::x509::Certificate>());
846+ certificates.emplace_back (std::move (tuple));
847+ }
848+ }
836849 }
837850 }
838851}
@@ -856,18 +869,23 @@ ocpp::types::InstallCertificateStatusEnumType DefaultChargePointEventsHandler::i
856869 Sha2 sha256;
857870 sha256.compute (certificate.pem ().c_str (), certificate.pem ().size ());
858871
859- if (type == InstallCertificateUseEnumType::V2GRootCertificate)
860- {
861- // V2 root certificate
862- std::stringstream name;
863- name << " iso_v2g_root_" << sha256.resultString () << " .pem" ;
864- cert_filename = (m_working_dir / name.str ()).string ();
865- }
866- else
867872 {
868- // MO root certificate
869873 std::stringstream name;
870- name << " iso_mo_root_" << sha256.resultString () << " .pem" ;
874+ switch (type)
875+ {
876+ case InstallCertificateUseEnumType::V2GRootCertificate:
877+ name << " iso_v2g_root_" ;
878+ break ;
879+ case InstallCertificateUseEnumType::MORootCertificate:
880+ name << " iso_mo_root_" ;
881+ break ;
882+ case InstallCertificateUseEnumType::OEMRootCertificate:
883+ // Intended fallthrough
884+ default :
885+ name << " iso_oem_root_" ;
886+ break ;
887+ }
888+ name << sha256.resultString () << " .pem" ;
871889 cert_filename = (m_working_dir / name.str ()).string ();
872890 }
873891
0 commit comments