diff --git a/src/lib.rs b/src/lib.rs index 0520dfb..d43488e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; pub fn hex_encode>(s: T) -> String { s.as_ref() .iter() - .map(|b| format!("{:02x}", b)) + .map(|b| format!("{b:02x}")) .collect::>() .join(":") .to_ascii_uppercase() @@ -242,7 +242,7 @@ impl Certificate { } } - pub fn public_key_matches(&self, private_key: PrivateKey) -> bool { + pub fn public_key_matches(&self, private_key: &PrivateKey) -> bool { if self.key_modulo().to_string() == private_key.modulus.to_string() { return true; } @@ -306,7 +306,7 @@ impl Chain { } x = match cert.public_key() { Ok(public_key) => Some(public_key), - Err(_) => None, + Err(()) => None, } } !time_issue && !self.certs.is_empty() diff --git a/ui/src/main.rs b/ui/src/main.rs index e111082..c8e295f 100644 --- a/ui/src/main.rs +++ b/ui/src/main.rs @@ -415,7 +415,7 @@ impl Ui { Ok(private_key) => { if let Some(chain) = &self.chain { if let Some(first) = chain.certs().first() { - if first.public_key_matches(private_key) { + if first.public_key_matches(&private_key) { column![Container::new(text( "Private Key matches first Cert Public Key" )) @@ -558,7 +558,7 @@ Authority-Key-Id: {} 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) { output.push( "✓ Private Key matches first Cert Public Key".to_string(), ); @@ -679,7 +679,7 @@ Authority-Key-Id: {} match PrivateKey::read(Path::new(&key)) { Ok(private_key) => { if let Some(cert) = chain.certs().first() { - return if cert.public_key_matches(private_key) && chain.is_valid() { + return if cert.public_key_matches(&private_key) && chain.is_valid() { result } else { IndicatorState::Error