I've coded a Java app and I plan to distribute it online. Each release will be locked with a secret serial key I made.
I need to secure my jar file from decompiler etc. Here is what I've done so far:
- User enters his serial key into a form
- The serial is sent to my dev server through a php script
- The script generates a new jar bin file which is encrypted in AES 128
- My "loader" downloads the jar file as bytes and decrypts it.
- It invokes the main method.
- User can use the app as he like to
- User close the app
- The cache is cleared and everything returns to step 1 or before.
I've made the steps 1 to 3, but I need to know if it is possible to make a custom classloader that grabs bytes from HTTP, decrypts them and invokes the main method. As the file is fully crypted (saved as bin on the PHP server), I can't use a basic class loader. About step 8, is it possible to unload content from the computer's memory?