Skip to content

Commit

Permalink
x509-cert: creates a validity to infinity (#1528)
Browse files Browse the repository at this point in the history
This is used for idevid certificates burned in hardware.
  • Loading branch information
baloo authored Sep 24, 2024
1 parent 37d32ce commit af100a0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions x509-cert/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ where
_profile: PhantomData,
})
}

/// Creates a `Validity` which starts now and does not expire.
#[cfg(all(feature = "std", feature = "hazmat"))]
pub fn infinity() -> der::Result<Self> {
let now = SystemTime::now();

Ok(Self {
not_before: Time::try_from(now)?,
not_after: Time::INFINITY,
_profile: PhantomData,
})
}
}

impl<'a, P: Profile> DecodeValue<'a> for Validity<P> {
Expand Down

0 comments on commit af100a0

Please sign in to comment.