Because I want to store the private key for decryption in the Rust program, I don't want others to see it. It would be better if you can prevent viewing the decrypted string in dynamic debugging!
fn main() {
println!("Hello World!");
}
For example: I output a piece of text in the above program, which can be directly found and modified during static analysis. How can I prevent reverse developers from modifying it?
My current solution is as follows, but if it is done this way, it seems to be optimized by Rust?
pub fn decrypt_builtin_project(bytes: &mut Vec<u16>, content: &mut String) {
for value in &mut *bytes {
*value ^= 3;
}
*content = String::from_utf16(&bytes[..]).unwrap();
}
main() {
let mut key = vec!(6, 6, 6, 7);
let mut content = String::new();
decrypt_builtin_project(&mut key, &mut content);
}
Is there a better solution?
I have no choice, so I put the key in the program, because what I do is a paid software, hoping to prevent others from cracking it. If I put the key in the server, it is also problematic. For example, do they capture packets and perform man-in-the-middle attacks?
I wonder if anyone has done the anti-debugging function?
For example: If the execution time from the previous line to the next line is too long, it means that someone is debugging my program, and then my program is directly exited or destroyed.
thanks for your replies.
After careful consideration, I no longer put the key in the program.
In order to make a fortune, we plan to put encryption and decryption on the server.