I have a Java client and a server and I want that everyone who connects to my server with the client uses the original client (not hacked or modified) (modifying is very easy by decompiling the code).
My idea: When the client connects to the server, the server sends a random hash to the client. One class of the client calculates a checksum of the jar-file and creates a new hashcode containing the hash from the server and the checksum. The client sends the new hash back to the server and the server checks if it is valid. Now I will just obfuscate this one class, or I will use another strong protection, that nobody can fake the checksum of the jar-file.
My question is: What do you think about it? Will it work how I imagine it?