1
0
mirror of https://github.com/pcvolkmer/cert-tools.git synced 2025-04-19 17:06:49 +00:00

fix: only the last cert can have an empty authority key

This commit is contained in:
Paul-Christian Volkmer 2025-01-24 18:22:21 +01:00
parent 582bc7d36e
commit c9eedd087b

View File

@ -317,7 +317,11 @@ impl Chain {
pub fn is_valid(&self) -> bool { pub fn is_valid(&self) -> bool {
let mut x: Option<PKey<Public>> = None; let mut x: Option<PKey<Public>> = None;
let mut time_issue = false; let mut time_issue = false;
for cert in self.certs.iter().rev() {
for (idx, cert) in self.certs.iter().rev().enumerate() {
if cert.authority_key_id().to_string() == "*Empty*" && idx > 0 {
return false;
}
if !cert.within_timerange(&SystemTime::now()) { if !cert.within_timerange(&SystemTime::now()) {
time_issue = true; time_issue = true;
} }