diff --git a/Cargo.lock b/Cargo.lock index 087242b..ed2327e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2221,7 +2221,7 @@ dependencies = [ [[package]] name = "webauthn-cli" -version = "0.1.3" +version = "0.1.4" dependencies = [ "authenticator", "base64 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 55cf76f..3d51c70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webauthn-cli" -version = "0.1.3" +version = "0.1.4" authors = ["Hatter Jiang "] edition = "2018" diff --git a/src/cmd_pgpcardadmin.rs b/src/cmd_pgpcardadmin.rs index 4151d1b..0ac65cf 100644 --- a/src/cmd_pgpcardadmin.rs +++ b/src/cmd_pgpcardadmin.rs @@ -10,6 +10,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("OpenPGP Card Admin subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("12345678").help("OpenPGP card admin pin")) + .arg(Arg::with_name("pass").long("pass").takes_value(true).help("[deprecated] now OpenPGP card admin pin")) .arg(Arg::with_name("name").short("n").long("name").takes_value(true).required(false).help("Set name")) .arg(Arg::with_name("url").long("url").takes_value(true).required(false).help("Set URL")) .arg(Arg::with_name("lang").long("lang").takes_value(true).required(false).help("Set lang")) @@ -17,7 +18,8 @@ impl Command for CommandImpl { } fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { - let pin = opt_value_result!(sub_arg_matches.value_of("pin"), "Pass must be assigned"); + let pin_opt = sub_arg_matches.value_of("pass").or(sub_arg_matches.value_of("pin")); + let pin = opt_value_result!(pin_opt, "Pass must be assigned"); if pin.len() < 8 { return simple_error!("Admin pin length:{}, must >= 8!", pin.len()); } let card_admin = crate::pgpcardutil::get_card_admin(pin)?; diff --git a/src/cmd_pgpcarddecrypt.rs b/src/cmd_pgpcarddecrypt.rs index a89b995..57a8165 100644 --- a/src/cmd_pgpcarddecrypt.rs +++ b/src/cmd_pgpcarddecrypt.rs @@ -12,6 +12,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("OpenPGP Card Decrypt subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin")) + .arg(Arg::with_name("pass").long("pass").takes_value(true).help("[deprecated] now OpenPGP card user pin")) .arg(Arg::with_name("cipher").short("c").long("cipher").takes_value(true).help("Cipher text HEX")) .arg(Arg::with_name("cipher-base64").short("b").long("cipher-base64").takes_value(true).help("Cipher text base64")) .arg(Arg::with_name("json").long("json").help("JSON output")) @@ -21,7 +22,8 @@ impl Command for CommandImpl { let json_output = sub_arg_matches.is_present("json"); 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"); + let pin_opt = sub_arg_matches.value_of("pass").or(sub_arg_matches.value_of("pin")); + let pin = opt_value_result!(pin_opt, "User pin must be assigned"); if pin.len() < 6 { return simple_error!("User pin length:{}, must >= 6!", pin.len()); } let cipher = sub_arg_matches.value_of("cipher"); diff --git a/src/cmd_pgpcardsign.rs b/src/cmd_pgpcardsign.rs index 93a13cb..da458ad 100644 --- a/src/cmd_pgpcardsign.rs +++ b/src/cmd_pgpcardsign.rs @@ -13,6 +13,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("OpenPGP Card Sign subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin")) + .arg(Arg::with_name("pass").long("pass").takes_value(true).help("[deprecated] now OpenPGP card user pin")) .arg(Arg::with_name("sha256").short("2").long("sha256").takes_value(true).help("Digest SHA256 HEX")) .arg(Arg::with_name("sha384").short("3").long("sha384").takes_value(true).help("Digest SHA384 HEX")) .arg(Arg::with_name("sha512").short("5").long("sha512").takes_value(true).help("Digest SHA512 HEX")) @@ -23,7 +24,8 @@ impl Command for CommandImpl { let json_output = sub_arg_matches.is_present("json"); 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"); + let pin_opt = sub_arg_matches.value_of("pass").or(sub_arg_matches.value_of("pin")); + let pin = opt_value_result!(pin_opt, "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"); diff --git a/src/cmd_pivsign.rs b/src/cmd_pivsign.rs index ddb2de7..9aff537 100644 --- a/src/cmd_pivsign.rs +++ b/src/cmd_pivsign.rs @@ -13,6 +13,7 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("PIV Sign subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).default_value("123456").help("OpenPGP card user pin")) + .arg(Arg::with_name("pass").long("pass").takes_value(true).help("[deprecated] now OpenPGP card user pin")) .arg(Arg::with_name("json").long("json").help("JSON output")) } @@ -22,7 +23,8 @@ impl Command for CommandImpl { rust_util::util_msg::set_logger_std_out(false); } warning!("This feature is not complete"); - let pin = opt_value_result!(sub_arg_matches.value_of("pin"), "User pin must be assigned"); + let pin_opt = sub_arg_matches.value_of("pass").or(sub_arg_matches.value_of("pin")); + let pin = opt_value_result!(pin_opt, "User pin must be assigned"); let mut yk = opt_result!(YubiKey::open(), "YubiKey not found: {}"); opt_result!(yk.verify_pin(pin.as_bytes()), "YubiKey verify pin failed: {}");