I am about to sell a program I have written in C# and I want to control licenses for it, strictly. That means I want to let the client connect to my server every single time it starts. This also gives me the ability to disable keys (in case of chargebacks on paypal or distribution of the code). Of course this might be a hassle for other users, but it is necessary in this case. Since I was unable to find any good .NET Licensing systems that are uncracked, I wanted to take the approach of writing a little one myself. My plan was to do the following:
- Generate a key.dat containing 1024 characters that gets shipped with the software (individual to each user)
- In the application entrypoint add a httprequest to my server that sends the key.dat + current timestamp, encrypted.
- My HTTP server (running PHP) decrypts the request and checks if the key is valid (in my database) and replies with the "access level" (license type). If the key is invalid or disabled it replies with an errorcode. Just like with the request, the reply is being salted with a timestamp, so someone can't validate his program by sending a valid packet to himself. The timestamp is being checked in the client. The reply is encrypted with RSA and a previously generated public key.
- Client receives response, decrypts with private key and reacts.
Is RSA the correct approach for this, so I can assure that the packets are sent by me and are not crafted (by noone else having the public key)? Is there a better approach for solving this problem?