From a120ade5428d14314b6440414f8c470486f13565 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 27 Mar 2022 17:53:10 +0800 Subject: [PATCH] chore: pgp --- src/cmd_challconfig.rs | 2 +- src/cmd_pgpcardsign.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cmd_challconfig.rs b/src/cmd_challconfig.rs index 9f0939e..74c121c 100644 --- a/src/cmd_challconfig.rs +++ b/src/cmd_challconfig.rs @@ -50,7 +50,7 @@ impl Command for CommandImpl { device_config.challenge_response_hmac(&hmac_key, false, false); if let Err(err) = yubi.write_config(config, &mut device_config) { - failure!("{:?}", err); + failure!("Config device failed: {:?}", err); } else { success!("Device configured"); } diff --git a/src/cmd_pgpcardsign.rs b/src/cmd_pgpcardsign.rs index 645b3eb..93a13cb 100644 --- a/src/cmd_pgpcardsign.rs +++ b/src/cmd_pgpcardsign.rs @@ -21,13 +21,11 @@ impl Command for CommandImpl { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { let json_output = sub_arg_matches.is_present("json"); - if json_output { - rust_util::util_msg::set_logger_std_out(false); - } - let pin_opt = sub_arg_matches.value_of("pin"); - let pin = opt_value_result!(pin_opt, "User pin must be assigned"); + if json_output { rust_util::util_msg::set_logger_std_out(false); } + + let pin = opt_value_result!(sub_arg_matches.value_of("pin"), "User pin must be assigned"); if pin.len() < 6 { return simple_error!("User pin length:{}, must >= 6!", pin.len()); } - + let sha256 = sub_arg_matches.value_of("sha256"); let sha384 = sub_arg_matches.value_of("sha384"); let sha512 = sub_arg_matches.value_of("sha512");