Add error message if cert contains invalid UTF8 data

This commit is contained in:
2025-12-28 16:58:17 +01:00
parent c6e5dcc213
commit 6ccbd5b3cb

View File

@@ -65,7 +65,13 @@ fn parse_certificate(cert_file: String, date_format: String) -> CertParseResult
for tmp in x509.subject_name().entries() { for tmp in x509.subject_name().entries() {
let cname = match tmp.data().as_utf8() { let cname = match tmp.data().as_utf8() {
Ok(a) => a, Ok(a) => a,
Err(_) => continue, Err(e) => {
eprintln!(
"Skipping invalid UTF8 data in cert file {}: {}",
cert_file, e
);
continue;
}
}; };
cnames.push(cname.to_string()); cnames.push(cname.to_string());
} }