feat: update pgpcarddecrypt
This commit is contained in:
@@ -72,10 +72,12 @@ impl Command for CommandImpl {
|
|||||||
EncryptAlgo::RSA => trans.decipher(Cryptogram::RSA(&cipher_bytes))?,
|
EncryptAlgo::RSA => trans.decipher(Cryptogram::RSA(&cipher_bytes))?,
|
||||||
EncryptAlgo::ECDH => trans.decipher(Cryptogram::ECDH(&cipher_bytes))?,
|
EncryptAlgo::ECDH => trans.decipher(Cryptogram::ECDH(&cipher_bytes))?,
|
||||||
};
|
};
|
||||||
// let text = trans.decipher(Cryptogram::RSA(&cipher_bytes))?;
|
|
||||||
success!("Clear text HEX: {}", hex::encode(&text));
|
success!("Clear text HEX: {}", hex::encode(&text));
|
||||||
success!("Clear text base64: {}", base64_encode(&text));
|
success!("Clear text base64: {}", base64_encode(&text));
|
||||||
success!("Clear text UTF-8: {}", String::from_utf8_lossy(&text));
|
let text_opt = String::from_utf8(text.clone()).ok();
|
||||||
|
if let Some(text) = &text_opt {
|
||||||
|
success!("Clear text UTF-8: {}", text);
|
||||||
|
}
|
||||||
|
|
||||||
if json_output {
|
if json_output {
|
||||||
let mut json = BTreeMap::<&'_ str, String>::new();
|
let mut json = BTreeMap::<&'_ str, String>::new();
|
||||||
@@ -83,7 +85,9 @@ impl Command for CommandImpl {
|
|||||||
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_base64", base64_encode(&text));
|
||||||
json.insert("text_utf8", String::from_utf8_lossy(&text).to_string());
|
if let Some(text) = text_opt {
|
||||||
|
json.insert("text_utf8", text);
|
||||||
|
}
|
||||||
|
|
||||||
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
println!("{}", serde_json::to_string_pretty(&json).unwrap());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user