feat: v1.9.6

This commit is contained in:
2024-06-16 10:20:23 +08:00
parent d4b9b852c1
commit 7d5af78078
6 changed files with 36 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ use rust_util::{util_msg, XResult};
use rust_util::util_clap::{Command, CommandError};
use crate::pgpcardutil;
use crate::util::{base64_encode, try_decode};
use crate::util::{base64_encode, read_stdin, try_decode};
#[derive(Debug, Clone, Copy)]
enum EncryptAlgo {
@@ -34,6 +34,7 @@ impl Command for CommandImpl {
.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("ciphertext").short("c").long("ciphertext").takes_value(true).help("Cipher text (HEX or Base64)"))
.arg(Arg::with_name("stdin").long("stdin").help("Standard input (Ciphertext)"))
.arg(Arg::with_name("algo").long("algo").takes_value(true).help("Algo: RSA, X25519/ECDH"))
.arg(Arg::with_name("json").long("json").help("JSON output"))
}
@@ -53,6 +54,8 @@ impl Command for CommandImpl {
let ciphertext_bytes = if let Some(ciphertext) = ciphertext {
opt_result!(try_decode(ciphertext), "Decode cipher failed: {}")
} else if sub_arg_matches.is_present("stdin") {
read_stdin()?
} else {
return simple_error!("--ciphertext must be assigned");
};