mirror of
https://github.com/pcvolkmer/cert-tools.git
synced 2025-07-01 14:02:54 +00:00
feat: show if file is invalid
This commit is contained in:
@ -57,7 +57,7 @@ pub enum StringValue {
|
||||
impl Display for StringValue {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
StringValue::Valid(val) => write!(f, "{}", val),
|
||||
StringValue::Valid(val) => write!(f, "{val}"),
|
||||
StringValue::Invalid => write!(f, "*Invalid*"),
|
||||
StringValue::Empty => write!(f, "*Empty*"),
|
||||
}
|
||||
@ -271,6 +271,10 @@ impl Chain {
|
||||
return Err("Certificate chain contains invalid certificate".to_string());
|
||||
}
|
||||
|
||||
if certs.is_empty() {
|
||||
return Err("No Certificates found".to_string());
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
certs: certs.into_iter().flatten().collect::<Vec<_>>(),
|
||||
})
|
||||
|
@ -72,7 +72,7 @@ fn main() -> Result<(), ()> {
|
||||
match PrivateKey::read(Path::new(&key)) {
|
||||
Ok(private_key) => {
|
||||
if let Some(cert) = chain.certs().first() {
|
||||
if cert.public_key_matches(private_key) {
|
||||
if cert.public_key_matches(&private_key) {
|
||||
println!(
|
||||
"{}",
|
||||
style("✓ Private Key matches first Cert Public Key")
|
||||
|
Reference in New Issue
Block a user