From 118a797d7c5fb501c09830405dc9815f91b5bb13 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Wed, 15 Mar 2023 00:29:59 +0800 Subject: [PATCH] feat: update piv-ecdh --- src/cmd_pivecdh.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cmd_pivecdh.rs b/src/cmd_pivecdh.rs index bbcc4cf..140cc55 100644 --- a/src/cmd_pivecdh.rs +++ b/src/cmd_pivecdh.rs @@ -21,7 +21,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("PIV ECDH subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).help("PIV card user pin")) - .arg(Arg::with_name("slot").short("s").long("slot").takes_value(true).help("PIV slot")) + .arg(Arg::with_name("slot").short("s").long("slot").takes_value(true).help("PIV slot, e.g. 82, 83 ...")) .arg(Arg::with_name("public").long("public").help("Public key")) .arg(Arg::with_name("private").long("private").help("Private key(PIV)")) .arg(Arg::with_name("epk").long("epk").takes_value(true).help("E-Public key")) @@ -78,8 +78,8 @@ impl Command for CommandImpl { if private { let pin_opt = sub_arg_matches.value_of("pin"); - let slot = opt_value_result!(sub_arg_matches.value_of("slot"), "Slot must assigned"); - let epk = opt_value_result!(sub_arg_matches.value_of("epk"), "EPK must assigned"); + let slot = opt_value_result!(sub_arg_matches.value_of("slot"), "--slot must assigned, e.g. 82, 83 ..."); + let epk = opt_value_result!(sub_arg_matches.value_of("epk"), "--epk must assigned"); let mut yk = opt_result!(YubiKey::open(), "YubiKey not found: {}"); let retired_slot_id = opt_result!(RetiredSlotId::from_str(slot), "Slot not found: {}"); @@ -128,7 +128,6 @@ impl Command for CommandImpl { slot_id, ), "Decrypt piv failed: {}"); - if json_output { json.insert("shared_secret_hex", hex::encode(&decrypted_shared_secret)); } else {