Skip to content

Commit

Permalink
[ssl cert] restore the accidentally deleted X509_set_version call.
Browse files Browse the repository at this point in the history
This caused slightly malformed cert format but it  somehow passed the grpc c++ client check. On the other side, it failed the grpc dart client check. As a result, this change fixed the gui can not connect server issue.
  • Loading branch information
georgeliao committed Feb 11, 2025
1 parent b7cb7a9 commit 2108790
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cert/ssl_cert_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ class X509Cert
if (cert == nullptr)
throw std::runtime_error("Failed to allocate x509 cert structure");

set_random_serial_number(cert.get());
X509_set_version(cert.get(), 2); // 0 index based, 2 amounts to 3

set_random_serial_number(cert.get());
X509_gmtime_adj(X509_get_notBefore(cert.get()), 0); // Start time: now
const long valid_duration_sec = cert_type == CertType::Root ? 3650L * 24L * 60L * 60L : 365L * 24L * 60L * 60L;
// 10 years for root certicicate and 1 year for server and client certificate
Expand Down

0 comments on commit 2108790

Please sign in to comment.