feat: v1.1.17, decrypt hex

This commit is contained in:
2022-04-13 00:19:45 +08:00
parent 9595c6cc6d
commit 7c486dfa82
4 changed files with 9 additions and 4 deletions

View File

@@ -52,7 +52,12 @@ impl Command for CommandImpl {
let m = BigNum::from_slice(&encrypted).unwrap();
let mut r = BigNum::new().unwrap();
r.mod_exp(&m, d, n, &mut BigNumContext::new().unwrap()).unwrap();
debugging!("Encrypted raw HEX: {}", hex::encode(&r.to_vec()));
let v = r.to_vec();
debugging!("Encrypted raw HEX: 00{}", hex::encode(&v));
let pos = v.iter().position(|b| *b == 0x00);
if let Some(pos) = pos {
debugging!("Encrypted text HEX: {}", hex::encode(&v[pos+1..]));
}
});
let mut decrypter = opt_result!(Decrypter::new(&keypair), "Decrypter new failed: {}");

View File

@@ -56,7 +56,7 @@ impl Command for CommandImpl {
let m = BigNum::from_slice(&signature).unwrap();
let mut r = BigNum::new().unwrap();
r.mod_exp(&m, e, n, &mut BigNumContext::new().unwrap()).unwrap();
debugging!("Signature raw HEX: {}", hex::encode(&r.to_vec()));
debugging!("Signature raw HEX: 00{}", hex::encode(&r.to_vec()));
});
let file_in = opt_value_result!(sub_arg_matches.value_of("in"), "File in --in required");