Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed strict cert verification, added error string print #56

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/evse_security/crypto/openssl/openssl_supplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,21 @@ bool OpenSSLSupplier::x509_is_child(X509Handle* child, X509Handle* parent) {

// If the parent is not a self-signed certificate, assume we have a partial chain
if (x509_is_selfsigned(parent) == false) {
// TODO(ioan): see if this strict flag is required
X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_X509_STRICT);
// TODO(ioan): see if this strict flag is required, caused many problems
// X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_X509_STRICT);

X509_STORE_CTX_set_flags(ctx.get(), X509_V_FLAG_PARTIAL_CHAIN);
}

return (X509_verify_cert(ctx.get()) == 1);
if (X509_verify_cert(ctx.get()) != 1) {
int ec = X509_STORE_CTX_get_error(ctx.get());
const char* error = X509_verify_cert_error_string(ec);

EVLOG_debug << "Certificate issued by error: " << ((error != nullptr) ? error : "UNKNOWN");
return false;
}

return true;
}

bool OpenSSLSupplier::x509_is_selfsigned(X509Handle* handle) {
Expand Down
Loading