feat: v1.11.12, optimize no-pin

This commit is contained in:
2025-03-28 23:25:53 +08:00
parent 3a40d7f0ad
commit 417e3f6a49
11 changed files with 17 additions and 13 deletions

2
Cargo.lock generated
View File

@@ -508,7 +508,7 @@ dependencies = [
[[package]] [[package]]
name = "card-cli" name = "card-cli"
version = "1.11.11" version = "1.11.12"
dependencies = [ dependencies = [
"aes-gcm-stream", "aes-gcm-stream",
"authenticator 0.3.1", "authenticator 0.3.1",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "card-cli" name = "card-cli"
version = "1.11.11" version = "1.11.12"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"

View File

@@ -42,7 +42,7 @@ impl Command for CommandImpl {
SubCommand::with_name(self.name()).about("PIV sign(with SHA256) subcommand") SubCommand::with_name(self.name()).about("PIV sign(with SHA256) subcommand")
.arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_slot_arg())
.arg(cmdutil::build_pin_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("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("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")) .arg(Arg::with_name("sign-file").short("S").long("sign-file").takes_value(false).help("Sign file"))

View File

@@ -17,7 +17,7 @@ impl Command for CommandImpl {
SubCommand::with_name(self.name()).about("PIV decrypt(RSA) subcommand") SubCommand::with_name(self.name()).about("PIV decrypt(RSA) subcommand")
.arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_slot_arg())
.arg(cmdutil::build_pin_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("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(Arg::with_name("stdin").long("stdin").help("Standard input (Ciphertext)"))
.arg(cmdutil::build_json_arg()) .arg(cmdutil::build_json_arg())

View File

@@ -17,9 +17,9 @@ impl Command for CommandImpl {
fn subcommand<'a>(&self) -> App<'a, 'a> { fn subcommand<'a>(&self) -> App<'a, 'a> {
SubCommand::with_name(self.name()).about("PIV ECDH subcommand") 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_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-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("public-384").long("public-384").help("Public key (P-384)"))
.arg(Arg::with_name("private").long("private").help("Private key(PIV)")) .arg(Arg::with_name("private").long("private").help("Private key(PIV)"))

View File

@@ -18,7 +18,7 @@ impl Command for CommandImpl {
SubCommand::with_name(self.name()).about("PIV EC sign(with SHA256) subcommand") SubCommand::with_name(self.name()).about("PIV EC sign(with SHA256) subcommand")
.arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_slot_arg())
.arg(cmdutil::build_pin_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("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("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")) .arg(Arg::with_name("input").short("i").long("input").takes_value(true).help("Input"))

View File

@@ -17,7 +17,7 @@ impl Command for CommandImpl {
SubCommand::with_name(self.name()).about("PIV RSA sign(with SHA256) subcommand") SubCommand::with_name(self.name()).about("PIV RSA sign(with SHA256) subcommand")
.arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_slot_arg())
.arg(cmdutil::build_pin_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(Arg::with_name("sha256").short("2").long("sha256").takes_value(true).help("Digest SHA256 HEX"))
.arg(cmdutil::build_json_arg()) .arg(cmdutil::build_json_arg())
} }

View File

@@ -24,9 +24,9 @@ impl Command for CommandImpl {
fn subcommand<'a>(&self) -> App<'a, 'a> { fn subcommand<'a>(&self) -> App<'a, 'a> {
let app = SubCommand::with_name(self.name()).about("Sign JWT subcommand") 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_slot_arg())
.arg(cmdutil::build_pin_arg())
.arg(cmdutil::build_no_pin_arg())
.arg(cmdutil::build_json_arg()); .arg(cmdutil::build_json_arg());
fill_sign_jwt_app_args(app) fill_sign_jwt_app_args(app)
} }

View File

@@ -27,9 +27,9 @@ impl Command for CommandImpl {
fn subcommand<'a>(&self) -> App<'a, 'a> { fn subcommand<'a>(&self) -> App<'a, 'a> {
SubCommand::with_name(self.name()).about("SSH PIV sign cert subcommand") 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_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("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("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")) .arg(Arg::with_name("pub").short("f").long("pub").alias("pub-file").required(true).takes_value(true).help("SSH public key file"))

View File

@@ -20,7 +20,7 @@ impl Command for CommandImpl {
SubCommand::with_name(self.name()).about("SSH piv sign subcommand") SubCommand::with_name(self.name()).about("SSH piv sign subcommand")
.arg(cmdutil::build_slot_arg()) .arg(cmdutil::build_slot_arg())
.arg(cmdutil::build_pin_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("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")) .arg(Arg::with_name("in").long("in").required(true).takes_value(true).help("In file, - for stdin"))
} }

View File

@@ -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") 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> { pub fn build_keychain_name_arg() -> Arg<'static, 'static> {
Arg::with_name("keychain-name") Arg::with_name("keychain-name")
.long("keychain-name") .long("keychain-name")