aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cert.rs7
-rw-r--r--src/cert_store.rs4
2 files changed, 5 insertions, 6 deletions
diff --git a/src/cert.rs b/src/cert.rs
index 12b9218..3f08632 100644
--- a/src/cert.rs
+++ b/src/cert.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use anyhow::Result;
-use chrono::{Date, NaiveDate, Utc};
+use chrono::{NaiveDate, Utc};
use rustls::sign::CertifiedKey;
use serde::{Deserialize, Serialize};
@@ -54,8 +54,7 @@ impl Cert {
}
pub fn is_old(&self) -> bool {
- let date = Date::<Utc>::from_utc(self.ser.date, Utc);
- let today = Utc::today();
- today - date > chrono::Duration::days(self.ser.valid_days / 2)
+ let today = Utc::now().date_naive();
+ today - self.ser.date > chrono::Duration::days(self.ser.valid_days / 2)
}
}
diff --git a/src/cert_store.rs b/src/cert_store.rs
index c1381db..97fbf32 100644
--- a/src/cert_store.rs
+++ b/src/cert_store.rs
@@ -278,7 +278,7 @@ impl CertStore {
let certser = CertSer {
hostname: domain.to_string(),
- date: Utc::today().naive_utc(),
+ date: Utc::now().date_naive(),
valid_days: cert.valid_days_left()?,
key_pem,
cert_pem,
@@ -345,7 +345,7 @@ impl CertStore {
let certser = CertSer {
hostname: domain.to_string(),
- date: Utc::today().naive_utc(),
+ date: Utc::now().date_naive(),
valid_days: 1024,
key_pem: cert.serialize_private_key_pem(),
cert_pem: cert.serialize_pem()?,