feat: 1.9.7, add pinentry support
This commit is contained in:
@@ -8,7 +8,7 @@ use rust_util::util_msg;
|
||||
use yubikey::{PinPolicy, YubiKey};
|
||||
use yubikey::piv::{AlgorithmId, decrypt_data, metadata};
|
||||
|
||||
use crate::{ecdhutil, pivutil};
|
||||
use crate::{ecdhutil, pinutil, pivutil};
|
||||
use crate::pivutil::get_algorithm_id;
|
||||
|
||||
pub struct CommandImpl;
|
||||
@@ -18,7 +18,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("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, e.g. 82, 83 ..."))
|
||||
.arg(Arg::with_name("public-256").long("public-256").help("Public key (P-256)"))
|
||||
.arg(Arg::with_name("public-384").long("public-384").help("Public key (P-384)"))
|
||||
@@ -71,6 +71,8 @@ impl Command for CommandImpl {
|
||||
|
||||
if private {
|
||||
let pin_opt = sub_arg_matches.value_of("pin");
|
||||
let pin_opt = pinutil::get_pin(pin_opt);
|
||||
let pin_opt = pin_opt.as_deref();
|
||||
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user