I would like to know if I can encrypt a string inside a compiled java file.
For example, i need to decode a zip file with symmetric key and I need to store that key in a java class in a private constant:
private static final String ZIP_PASSW="secret"
But i don’t want that a simple reversing bytecode shows the raw password… Do you think exists something to avoid it?
Thank you
PS: I can not understand why S.O. said that my question does not meet its standards without this PS
When you say you need to decode a zip file with a symmetric key, is that definitely what you need to do? Rather than thinking about the detail of how to store the password as plaintext or how to encode it or whatever, you might need to look at your overall architecture. For example perhaps your code could call a secured webservice to get the key rather than storing it? Obviously, without a better picture of what you are aiming for it is hard to suggest a viable alternative, but what you are describing is going to be hard to keep properly secure – it will be secure by obscurity, but it won’t be strong against someone determined to find your key.
If that isn’t secure enough for what you need to do, then the most standard response would probably to integrate some kind of PGP key exchange rather than using symmetric encryption.