Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - Are there any ways to obfuscate/hide strings to prevent against decompilation?

Tags:

java

string

I just have a handful of Strings that I would like to obfuscate/hide against decompilation. I'm aware that I'll never be able to achieve true prevention but I am hoping there are any/some ways that will at least prevent the actual Strings from showing up exactly as they are.

Any help would be much appreciated.

like image 461
Justin Avatar asked Oct 08 '22 06:10

Justin


2 Answers

You can put them in a resource file and encrypt it using AES (for example). Then on the application initialization extract the data.

like image 118
Eugene Retunsky Avatar answered Oct 23 '22 02:10

Eugene Retunsky


There are a number of free and commercial "java code obfuscators" that change names of non-public API and do simple transformations of string literals. This obfuscation won't stop a determined attacker, but it will discourage casual observation.

like image 1
erickson Avatar answered Oct 23 '22 01:10

erickson