mirror of
https://github.com/pcvolkmer/cert-tools.git
synced 2025-04-19 17:06:49 +00:00
chore: code cleanup
This commit is contained in:
parent
8a6b5118a0
commit
6b5fefec71
21
src/main.rs
21
src/main.rs
@ -42,14 +42,14 @@ fn main() -> Result<(), ()> {
|
|||||||
chain.push(ca_cert);
|
chain.push(ca_cert);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{}", style(format!("Cannot read file: {}", ca)).red());
|
println!("{}", style(format!("Cannot read file: {ca}")).red());
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for cert in chain.certs() {
|
for cert in chain.certs() {
|
||||||
print_cert(cert);
|
print_cert(cert);
|
||||||
println!()
|
println!();
|
||||||
}
|
}
|
||||||
|
|
||||||
if chain.has_missing_tail() {
|
if chain.has_missing_tail() {
|
||||||
@ -77,19 +77,19 @@ fn main() -> Result<(), ()> {
|
|||||||
"{}",
|
"{}",
|
||||||
style("✓ Private Key matches first Cert Public Key")
|
style("✓ Private Key matches first Cert Public Key")
|
||||||
.green()
|
.green()
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
println!("{}", style("! Private Key does not match the first Cert Public Key").red())
|
println!("{}", style("! Private Key does not match the first Cert Public Key").red());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!("{}", style("Could not read Private Key").red())
|
println!("{}", style("Could not read Private Key").red());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{}", style(format!("Cannot read file: {}", cert)).red());
|
println!("{}", style(format!("Cannot read file: {cert}")).red());
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ fn main() -> Result<(), ()> {
|
|||||||
chain.push(ca_cert);
|
chain.push(ca_cert);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
eprintln!("{}", style(format!("Cannot read file: {}", ca)).red());
|
eprintln!("{}", style(format!("Cannot read file: {ca}")).red());
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,9 +131,7 @@ fn main() -> Result<(), ()> {
|
|||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
for cert in chain.certs() {
|
for cert in chain.certs() {
|
||||||
match cert.to_pem() {
|
if let Ok(plain) = cert.to_pem() { print!("{plain}") } else {
|
||||||
Ok(plain) => print!("{}", plain),
|
|
||||||
Err(_) => {
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}",
|
"{}",
|
||||||
style("Cannot merge files to valid chain - Cert error!").red()
|
style("Cannot merge files to valid chain - Cert error!").red()
|
||||||
@ -141,9 +139,8 @@ fn main() -> Result<(), ()> {
|
|||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
eprintln!("{}", style(format!("Cannot read file: {}", cert)).red());
|
eprintln!("{}", style(format!("Cannot read file: {cert}")).red());
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
eprintln!("{}", style("Success!").green());
|
eprintln!("{}", style("Success!").green());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user