chore: piv, pivsign
This commit is contained in:
@@ -29,8 +29,6 @@ impl Command for CommandImpl {
|
||||
let cipher = sub_arg_matches.value_of("cipher");
|
||||
let cipher_base64 = sub_arg_matches.value_of("cipher-base64");
|
||||
|
||||
let mut json = BTreeMap::<&'_ str, String>::new();
|
||||
|
||||
let cipher_bytes = if let Some(cipher) = cipher {
|
||||
opt_result!(hex::decode(cipher), "Decode cipher failed: {}")
|
||||
} else if let Some(cipher_base64) = cipher_base64 {
|
||||
@@ -44,18 +42,16 @@ impl Command for CommandImpl {
|
||||
success!("Clear text HEX: {}", hex::encode(&text));
|
||||
success!("Clear text base64: {}", base64::encode(&text));
|
||||
success!("Clear text UTF-8: {}", String::from_utf8_lossy(&text));
|
||||
|
||||
if json_output {
|
||||
let mut json = BTreeMap::<&'_ str, String>::new();
|
||||
json.insert("cipher_hex", hex::encode(&cipher_bytes));
|
||||
json.insert("cipher_base64", base64::encode(&cipher_bytes));
|
||||
json.insert("text_hex", hex::encode(&text));
|
||||
json.insert("text_utf8", String::from_utf8_lossy(&text).to_string());
|
||||
}
|
||||
|
||||
|
||||
if json_output {
|
||||
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user