Move the ca_creation_time function to the common module.

- Move the `ca_creation_time` function to the `common` module so
    that other code can use it.
This commit is contained in:
Neal H. Walfield 2024-11-18 15:50:04 +01:00
parent 5619472ae2
commit 915e8da4da
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
2 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,6 @@
use std::time::Duration;
use std::time::SystemTime;
use anyhow::Result;
use openpgp::packet::UserID;
@ -127,3 +130,13 @@ impl PreferredUserID {
self.trust_amount
}
}
/// The creation time for the trust root and intermediate CAs.
///
/// We use a creation time in the past (Feb 2002) so that it is still
/// possible to use the CA when the reference time is in the past.
// XXX: This is copied from sequoia-cert-store. It would be nice to
// import it, but it is private.
pub fn ca_creation_time() -> SystemTime {
SystemTime::UNIX_EPOCH + Duration::new(1014235320, 0)
}

View File

@ -1,6 +1,6 @@
use std::{
fmt::Write,
time::{Duration, SystemTime},
time::SystemTime,
};
use anyhow::Error;
@ -26,9 +26,10 @@ use wot::PARTIALLY_TRUSTED;
use crate::Convert;
use crate::Sq;
use crate::Time;
use super::OutputType;
use crate::common::ca_creation_time;
use crate::error_chain;
use crate::output::wrapping::NBSP;
use super::OutputType;
/// Prints a Path Error
pub fn print_path_error(err: Error) {
@ -435,13 +436,3 @@ impl OutputType for ConciseHumanReadableOutputNetwork<'_, '_, '_> {
Ok(())
}
}
/// The creation time for the trust root and intermediate CAs.
///
/// We use a creation time in the past (Feb 2002) so that it is still
/// possible to use the CA when the reference time is in the past.
// XXX: This is copied from sequoia-cert-store. It would be nice to
// import it, but it is private.
fn ca_creation_time() -> SystemTime {
SystemTime::UNIX_EPOCH + Duration::new(1014235320, 0)
}