Envoy::Ssl::CertificateDetailsPtr Utility::certificateDetails(X509* cert, const std::string& path,
const auto days_until_expiry = Utility::getDaysUntilExpiration(cert, time_source).value_or(0);
Envoy::Ssl::ParsedX509NamePtr parseX509NameFromCertificate(X509& cert, CertName desired_name) {
const time_t current_time = std::chrono::system_clock::to_time_t(time_source.systemTime());
static_cast<GENERAL_NAMES*>(X509_get_ext_d2i(&cert, NID_subject_alt_name, nullptr, nullptr)));
san.assign(reinterpret_cast<const char*>(ASN1_STRING_get0_data(str)), ASN1_STRING_length(str));
san.assign(reinterpret_cast<const char*>(ASN1_STRING_get0_data(str)), ASN1_STRING_length(str));
san.assign(reinterpret_cast<const char*>(ASN1_STRING_get0_data(str)), ASN1_STRING_length(str));
return std::chrono::duration_cast<std::chrono::seconds>(expiration_time.time_since_epoch());
// Casting to <time_t (64bit)> to prevent multiplication overflow when certificate valid-from date
return std::chrono::system_clock::from_time_t(static_cast<time_t>(days) * 24 * 60 * 60 + seconds);
// Casting to <time_t (64bit)> to prevent multiplication overflow when certificate not-after date
return std::chrono::system_clock::from_time_t(static_cast<time_t>(days) * 24 * 60 * 60 + seconds);