diff --git a/Cargo.lock b/Cargo.lock index 934c6d7..03319e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -508,7 +508,7 @@ dependencies = [ [[package]] name = "card-cli" -version = "1.11.11" +version = "1.11.12" dependencies = [ "aes-gcm-stream", "authenticator 0.3.1", diff --git a/Cargo.toml b/Cargo.toml index 6e4ad3b..d24da85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "card-cli" -version = "1.11.11" +version = "1.11.12" authors = ["Hatter Jiang "] edition = "2018" diff --git a/src/cmd_file_sign.rs b/src/cmd_file_sign.rs index 60daf91..1212230 100644 --- a/src/cmd_file_sign.rs +++ b/src/cmd_file_sign.rs @@ -42,7 +42,7 @@ impl Command for CommandImpl { SubCommand::with_name(self.name()).about("PIV sign(with SHA256) subcommand") .arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("file").short("f").long("file").takes_value(true).required(true).help("Input file")) .arg(Arg::with_name("filename").short("n").long("filename").takes_value(true).help("Filename")) .arg(Arg::with_name("sign-file").short("S").long("sign-file").takes_value(false).help("Sign file")) diff --git a/src/cmd_piv_decrypt.rs b/src/cmd_piv_decrypt.rs index 395e2e9..652b868 100644 --- a/src/cmd_piv_decrypt.rs +++ b/src/cmd_piv_decrypt.rs @@ -17,7 +17,7 @@ impl Command for CommandImpl { SubCommand::with_name(self.name()).about("PIV decrypt(RSA) subcommand") .arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("ciphertext").long("ciphertext").short("c").takes_value(true).help("Encrypted data (HEX or Base64)")) .arg(Arg::with_name("stdin").long("stdin").help("Standard input (Ciphertext)")) .arg(cmdutil::build_json_arg()) diff --git a/src/cmd_piv_ecdh.rs b/src/cmd_piv_ecdh.rs index e8f6351..6c8ca0b 100644 --- a/src/cmd_piv_ecdh.rs +++ b/src/cmd_piv_ecdh.rs @@ -17,9 +17,9 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("PIV ECDH subcommand") - .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) .arg(cmdutil::build_slot_arg()) + .arg(cmdutil::build_pin_arg()) + .arg(cmdutil::build_no_pin_arg()) .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)")) .arg(Arg::with_name("private").long("private").help("Private key(PIV)")) diff --git a/src/cmd_piv_ecsign.rs b/src/cmd_piv_ecsign.rs index bb5ac7b..edad93a 100644 --- a/src/cmd_piv_ecsign.rs +++ b/src/cmd_piv_ecsign.rs @@ -18,7 +18,7 @@ impl Command for CommandImpl { SubCommand::with_name(self.name()).about("PIV EC sign(with SHA256) subcommand") .arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("algorithm").short("a").long("algorithm").takes_value(true).help("Algorithm, p256 or p384")) .arg(Arg::with_name("file").short("f").long("file").takes_value(true).help("Input file")) .arg(Arg::with_name("input").short("i").long("input").takes_value(true).help("Input")) diff --git a/src/cmd_piv_rsasign.rs b/src/cmd_piv_rsasign.rs index 589c3a4..f3ac9b8 100644 --- a/src/cmd_piv_rsasign.rs +++ b/src/cmd_piv_rsasign.rs @@ -17,7 +17,7 @@ impl Command for CommandImpl { SubCommand::with_name(self.name()).about("PIV RSA sign(with SHA256) subcommand") .arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("sha256").short("2").long("sha256").takes_value(true).help("Digest SHA256 HEX")) .arg(cmdutil::build_json_arg()) } diff --git a/src/cmd_sign_jwt.rs b/src/cmd_sign_jwt.rs index 50c6274..6d8d7ea 100644 --- a/src/cmd_sign_jwt.rs +++ b/src/cmd_sign_jwt.rs @@ -24,9 +24,9 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand") - .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) .arg(cmdutil::build_slot_arg()) + .arg(cmdutil::build_pin_arg()) + .arg(cmdutil::build_no_pin_arg()) .arg(cmdutil::build_json_arg()); fill_sign_jwt_app_args(app) } diff --git a/src/cmd_ssh_piv_cert.rs b/src/cmd_ssh_piv_cert.rs index 19e3d46..a0cb050 100644 --- a/src/cmd_ssh_piv_cert.rs +++ b/src/cmd_ssh_piv_cert.rs @@ -27,9 +27,9 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("SSH PIV sign cert subcommand") - .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) .arg(cmdutil::build_slot_arg()) + .arg(cmdutil::build_pin_arg()) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("key-id").short("k").long("key-id").takes_value(true).default_value("default_key_id").help("SSH user CA key id")) .arg(Arg::with_name("principal").short("P").long("principal").takes_value(true).default_value("root").multiple(true).help("SSH user CA principal")) .arg(Arg::with_name("pub").short("f").long("pub").alias("pub-file").required(true).takes_value(true).help("SSH public key file")) diff --git a/src/cmd_ssh_piv_sign.rs b/src/cmd_ssh_piv_sign.rs index 16f739e..3a3b69a 100644 --- a/src/cmd_ssh_piv_sign.rs +++ b/src/cmd_ssh_piv_sign.rs @@ -20,7 +20,7 @@ impl Command for CommandImpl { SubCommand::with_name(self.name()).about("SSH piv sign subcommand") .arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_pin_arg()) - .arg(Arg::with_name("no-pin").long("no-pin").help("No PIN")) + .arg(cmdutil::build_no_pin_arg()) .arg(Arg::with_name("namespace").short("n").long("namespace").takes_value(true).help("Namespace")) .arg(Arg::with_name("in").long("in").required(true).takes_value(true).help("In file, - for stdin")) } diff --git a/src/cmdutil.rs b/src/cmdutil.rs index 2646670..bc618a0 100644 --- a/src/cmdutil.rs +++ b/src/cmdutil.rs @@ -13,6 +13,10 @@ pub fn build_pin_arg() -> Arg<'static, 'static> { Arg::with_name("pin").short("p").long("pin").takes_value(true).help("PIV card user PIN") } +pub fn build_no_pin_arg() -> Arg<'static, 'static> { + Arg::with_name("no-pin").long("no-pin").help("No PIN") +} + pub fn build_keychain_name_arg() -> Arg<'static, 'static> { Arg::with_name("keychain-name") .long("keychain-name")