From b23f4a3a6947178856fadde56f2e37683a2b43e2 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 17 May 2025 22:08:46 +0800 Subject: [PATCH] feat: v1.13.10 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmd_hmac_encrypt.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a35ba97..f873ac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -508,7 +508,7 @@ dependencies = [ [[package]] name = "card-cli" -version = "1.13.9" +version = "1.13.10" dependencies = [ "aes-gcm-stream", "authenticator 0.3.1", diff --git a/Cargo.toml b/Cargo.toml index e14e1cc..706b02a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "card-cli" -version = "1.13.9" +version = "1.13.10" authors = ["Hatter Jiang "] edition = "2018" diff --git a/src/cmd_hmac_encrypt.rs b/src/cmd_hmac_encrypt.rs index dc0be0f..d652d32 100644 --- a/src/cmd_hmac_encrypt.rs +++ b/src/cmd_hmac_encrypt.rs @@ -25,12 +25,15 @@ impl Command for CommandImpl { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { let json_output = cmdutil::check_json_output(sub_arg_matches); + let without_hmac_encrypt = sub_arg_matches.is_present("without-hmac-encrypt"); + if without_hmac_encrypt && !sub_arg_matches.is_present("with-pbe-encrypt") { + return simple_error!("hmac and pbe encryption must present at least one"); + } let text = sub_arg_matches.value_of("plaintext").unwrap().to_string(); let mut pin_opt = sub_arg_matches.value_of("password").map(|p| p.to_string()); let ciphertext = do_encrypt(&text, &mut pin_opt, sub_arg_matches)?; - let without_hmac_encrypt = sub_arg_matches.is_present("without-hmac-encrypt"); let ciphertext = if without_hmac_encrypt { ciphertext } else {