Do not use expired IKMs
This commit is contained in:
parent
66271877dc
commit
94b1809ffa
1 changed files with 2 additions and 1 deletions
|
@ -136,10 +136,11 @@ impl InputKeyMaterialList {
|
||||||
|
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
pub(crate) fn get_latest_ikm(&self) -> Result<&InputKeyMaterial> {
|
pub(crate) fn get_latest_ikm(&self) -> Result<&InputKeyMaterial> {
|
||||||
|
let now = SystemTime::now();
|
||||||
self.ikm_lst
|
self.ikm_lst
|
||||||
.iter()
|
.iter()
|
||||||
.rev()
|
.rev()
|
||||||
.find(|&ikm| !ikm.is_revoked && ikm.created_at < SystemTime::now())
|
.find(|&ikm| !ikm.is_revoked && ikm.created_at < now && ikm.expire_at > now)
|
||||||
.ok_or(Error::IkmNoneAvailable)
|
.ok_or(Error::IkmNoneAvailable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue