Expose start date certificate getter.

This commit is contained in:
Jean-Christophe Amiel 2025-12-14 12:45:24 +01:00
parent c5f866738e
commit 802ef42ab5
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
4 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,7 @@ use super::easy_ext::CertInfo;
pub struct Certificate {
subject: Option<String>,
issuer: Option<String>,
pub start_date: Option<DateTime<Utc>>,
start_date: Option<DateTime<Utc>>,
pub expire_date: DateTime<Utc>,
pub serial_number: String,
pub subject_alt_name: Option<String>,
@ -62,6 +62,10 @@ impl Certificate {
pub fn issuer(&self) -> Option<&String> {
self.issuer.as_ref()
}
pub fn start_date(&self) -> Option<DateTime<Utc>> {
self.start_date
}
}
impl TryFrom<CertInfo> for Certificate {

View File

@ -450,7 +450,7 @@ impl CertificateJson {
CertificateJson {
subject: c.subject().cloned(),
issuer: c.issuer().cloned(),
start_date: c.start_date.map(|d| d.to_string()),
start_date: c.start_date().map(|d| d.to_string()),
expire_date: c.expire_date.to_string(),
serial_number: c.serial_number.to_string(),
subject_alt_name: c.subject_alt_name.clone(),

View File

@ -140,7 +140,7 @@ fn get_call_html(
if let Some(issuer) = certificate.issuer() {
values.push(("Issuer", issuer.as_str()));
}
let start_date = certificate.start_date.map(|d| d.to_string());
let start_date = certificate.start_date().map(|d| d.to_string());
if let Some(start_date) = start_date.as_ref() {
values.push(("Start Date", start_date.as_str()));
}

View File

@ -392,8 +392,8 @@ fn eval_query_certificate(
Some(issuer) => Value::String(issuer.clone()),
None => return Ok(None),
},
CertificateAttributeName::StartDate => match certificate.start_date.as_ref() {
Some(date) => Value::Date(*date),
CertificateAttributeName::StartDate => match certificate.start_date() {
Some(date) => Value::Date(date),
None => return Ok(None),
},
CertificateAttributeName::ExpireDate => Value::Date(certificate.expire_date),