There are several ways to manage this. If you can determine how to provide the user with a password for the keystore when the application starts, the most appropriate way would be to encrypt all the values ββwith the key and store that key in the keystore. The command line interface to the keystore is used with keytool. However, JSE does have an API for programmatically accessing the keystore.
If you canβt manually provide the password for the keystore at startup (say, for a web application), one way to do this is to write an extremely complicated obfuscation procedure that can confuse the key and save it in the properties file. It is important to remember that the obfuscation and deobfuscation logic must be multi-layered (it may include scrambling, coding, introducing false characters, etc.) and it must have at least one key that can be hidden in other classes of the application using non-intuitive names. This is not a completely safe mechanism, since someone with a decompiler and enough time and intelligence can still work around it, but this is the only one I know about that does not require you to break into your own (i.e. not easily decompiled ) the code.
Dhananjay nene
source share