feat: update piv-ecdh

This commit is contained in:
2023-03-15 00:29:59 +08:00
parent 9955341c81
commit 118a797d7c

View File

@@ -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 {