[pbs-devel] [PATCH v2 backup 06/27] CertInfo: add is_expired_after_epoch
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Apr 22 16:01:52 CEST 2021
Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
src/tools/cert.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/tools/cert.rs b/src/tools/cert.rs
index d3c221a4..bcc3e69b 100644
--- a/src/tools/cert.rs
+++ b/src/tools/cert.rs
@@ -96,4 +96,9 @@ impl CertInfo {
pub fn not_after_unix(&self) -> Result<i64, Error> {
asn1_time_to_unix(&self.not_after())
}
+
+ /// Check if the certificate is expired at or after a specific unix epoch.
+ pub fn is_expired_after_epoch(&self, epoch: i64) -> Result<bool, Error> {
+ Ok(self.not_after_unix()? < epoch)
+ }
}
--
2.20.1
More information about the pbs-devel
mailing list