Enable/disable code access through license key - Application versioning
I have written a POS application, and now i want to create different versions of it. Something like a basic version, a premium version an开发者_C百科d a Full version. So if a client pays more they get more features in the same application. Is it possible that i could keep one standard application but features in my application get enabled / disabled depending upon what license key user enters. Restrict parts of code that can be executed only if a certain key was entered.
Any ideas guys...
There are many ways to do this, all of them breakable if skilled people are willing to put the time into it ;-) However, depending on the solution you choose, it will require progressively more work in your end, so be realistic and choose wisely.
For the actual license key, I highly recommend that you generate it using a standard public-private key encryption scheme such as rsa. That is, you create a license key text string that contains the name of the user (so you can track illegally shared license keys) and information about which code should be active. Encrypt the license on your end using the private key and distribute the app with the public key included. When the app starts, you read the license key and decrypt it using the public key. This will make it virtually impossible for people to modify or generate fake keys.
Now for the actual activation of code, here are two options I have used in production code: either simply include flags in the license key saying which parts of the code should be active and activate it using basic if then statements. Alternatively, depending on your programming language, you can dynamically load pieces of code from the license key making those parts of the code unusable without a proper key file (I did this in java with a custom class loader).... however, this last solution requires much much more work than the first, so think things through before you start designing your solution.
精彩评论