feat: 1.9.7, add pinentry support
This commit is contained in:
@@ -6,7 +6,7 @@ use rust_util::util_msg;
|
||||
use yubikey::{piv, YubiKey};
|
||||
use yubikey::piv::{AlgorithmId, SlotId};
|
||||
|
||||
use crate::{pivutil, rsautil};
|
||||
use crate::{pinutil, pivutil, rsautil};
|
||||
use crate::util::base64_encode;
|
||||
|
||||
pub struct CommandImpl;
|
||||
@@ -17,7 +17,7 @@ impl Command for CommandImpl {
|
||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||
SubCommand::with_name(self.name()).about("PIV RSA sign(with SHA256) subcommand")
|
||||
.arg(Arg::with_name("slot").short("s").long("slot").takes_value(true).help("PIV slot, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e"))
|
||||
.arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin"))
|
||||
.arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).help("PIV card user PIN"))
|
||||
.arg(Arg::with_name("sha256").short("2").long("sha256").takes_value(true).help("Digest SHA256 HEX"))
|
||||
.arg(Arg::with_name("json").long("json").help("JSON output"))
|
||||
}
|
||||
@@ -27,6 +27,8 @@ impl Command for CommandImpl {
|
||||
if json_output { util_msg::set_logger_std_out(false); }
|
||||
|
||||
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 pin = opt_value_result!(pin_opt, "User pin must be assigned");
|
||||
|
||||
let sha256_hex_opt = sub_arg_matches.value_of("sha256").map(|s| s.to_string());
|
||||
|
||||
Reference in New Issue
Block a user