chore: pgp card decrypt
This commit is contained in:
@@ -21,11 +21,9 @@ impl Command for CommandImpl {
|
|||||||
if json_output {
|
if json_output {
|
||||||
rust_util::util_msg::set_logger_std_out(false);
|
rust_util::util_msg::set_logger_std_out(false);
|
||||||
}
|
}
|
||||||
let pass = sub_arg_matches.value_of("pass");
|
let pass_opt = sub_arg_matches.value_of("pass");
|
||||||
let pass = match pass {
|
let pass = opt_value_result!(pass_opt, "Pass must be assigned");
|
||||||
Some(p) => p,
|
if pass.len() < 6 { return simple_error!("Pass length:{}, must >= 6!", pass.len()); }
|
||||||
None => return simple_error!("Pass must be assigned"),
|
|
||||||
};
|
|
||||||
let cipher = sub_arg_matches.value_of("cipher");
|
let cipher = sub_arg_matches.value_of("cipher");
|
||||||
let cipher_base64 = sub_arg_matches.value_of("cipher-base64");
|
let cipher_base64 = sub_arg_matches.value_of("cipher-base64");
|
||||||
|
|
||||||
@@ -48,6 +46,7 @@ impl Command for CommandImpl {
|
|||||||
json.insert("cipher_hex", hex::encode(&cipher_bytes));
|
json.insert("cipher_hex", hex::encode(&cipher_bytes));
|
||||||
json.insert("cipher_base64", base64::encode(&cipher_bytes));
|
json.insert("cipher_base64", base64::encode(&cipher_bytes));
|
||||||
json.insert("text_hex", hex::encode(&text));
|
json.insert("text_hex", hex::encode(&text));
|
||||||
|
json.insert("text_base64", base64::encode(&text));
|
||||||
json.insert("text_utf8", String::from_utf8_lossy(&text).to_string());
|
json.insert("text_utf8", String::from_utf8_lossy(&text).to_string());
|
||||||
|
|
||||||
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
||||||
|
|||||||
Reference in New Issue
Block a user