CertInfo: add is_expired_after_epoch

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-04-22 16:01:52 +02:00 committed by Dietmar Maurer
parent 0796b642de
commit 134ed9e14f
1 changed files with 5 additions and 0 deletions

View File

@ -96,4 +96,9 @@ impl CertInfo {
pub fn not_after_unix(&self) -> Result<i64, Error> { pub fn not_after_unix(&self) -> Result<i64, Error> {
asn1_time_to_unix(&self.not_after()) 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)
}
} }