Skip to content

Commit

Permalink
using get_certficate_hierarchy directly and only adding ocsp data if …
Browse files Browse the repository at this point in the history
…its valid

Signed-off-by: pietfried <[email protected]>
  • Loading branch information
Pietfried committed Mar 19, 2024
1 parent 22e17ee commit 3c668d0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/evse_security/evse_security.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,8 @@ OCSPRequestDataList EvseSecurity::get_v2g_ocsp_request_data() {
// Iterate cache, get hashes
hierarchy.for_each([&](const X509Node& node) {
std::string responder_url = node.certificate.get_responder_url();
if (!responder_url.empty()) {
auto certificate_hash_data = node.hash;
auto certificate_hash_data = node.hash;
if (!responder_url.empty() and certificate_hash_data.is_valid()) {
OCSPRequestData ocsp_request_data = {certificate_hash_data, responder_url};
ocsp_request_data_list.push_back(ocsp_request_data);
}
Expand All @@ -666,14 +666,12 @@ OCSPRequestDataList EvseSecurity::get_ocsp_request_data(const std::string& certi

try {
X509CertificateBundle leaf_bundle(certificate_chain, EncodingFormat::PEM);

auto leaf_certificates = leaf_bundle.split();
X509CertificateHierarchy hierarchy = X509CertificateHierarchy::build_hierarchy(leaf_certificates);
X509CertificateHierarchy hierarchy = leaf_bundle.get_certficate_hierarchy();

hierarchy.for_each([&](const X509Node& node) {
std::string responder_url = node.certificate.get_responder_url();
if (!responder_url.empty()) {
auto certificate_hash_data = node.hash;
auto certificate_hash_data = node.hash;
if (!responder_url.empty() and certificate_hash_data.is_valid()) {
OCSPRequestData ocsp_request_data = {certificate_hash_data, responder_url};
ocsp_request_data_list.push_back(ocsp_request_data);
}
Expand Down

0 comments on commit 3c668d0

Please sign in to comment.