How can I make my product as a trial version for 30 days?
I have created my product and also generated license key for that but I want to ask that key after 30 days. I have do it with registry value storing the date with adding 30 days in that. But I found that if the user change the system date with 30 days before my logic not work.
So is there any solution for the trial version software without checking system date and allow only 30 days of trial?
You could have another registry key that you increment after every day's use. That way, even if they change the computer's date, this key would indicate to your program that it's been running for > 30 days.
Additionally, this value could be encrypted so that if the user tries to manually change it, the program can refuse to run because it was unable to decrypt the value and get a valid number out of it.
To get around reinstalls, you could add some information to any file saved with the trial version of your app which is unique to that specific version of the app (perhaps a timestamp from when it was installed). When a trial version of your app tries to open a file, it will check this signature and ensure that it was created with that same instance, otherwise refuse to open the file. This essentially neuters the ability to simply reinstall the app and continue using it.
At the end of the day though, the user has complete control over their machine and can probably find a way around whatever it is you want to do (short of accessing a web service where these details are kept before you let the user use the app). You probably shouldn't expend so much energy trying to stop the guys who are willing to go through this extra trouble, but instead spend that extra time/money/energy improving the app for those who are willing to pay.
I have one simple solution for you.
Take 2 variables for registry: 1. date 2. counter
steps:
Set a counter = 1
Copy system date to date
Check each time if the date is different than the current date, than copy that date to the registry date, also increment the counter by 1. If the date is same, don't do anything.
Now you can check you counter for trial days expiration
By using these trick, if user change the system date to previous date than also it works.
For registry you can encrypt the date & counter so that technical person would not recognize your logic!
cheers...
ADDED
This logic fails only when user doesn't change the date for each day! Again we have the solution for that!
I don't know whether it is possible or not but you can always have some solution:
- count the total time for trial period & store it in registry.
- Now count the total time for each run and add it in another variable. (I hope that it can be done by timer)
- Compare above two values for taking decision for expiration.
You could use a licensing component. You can make one yourself (see the LicenseManager class), or buy one from a vendor (for example CryptoLicensing).
You need to have a way of detecting if the user changes the date from when you first started the trial. In solutions I've used before, we have saved the "last executed" date and the "first executed" date and if the clock changes to anything more than two days of "last executed" we expire the trial. You also need a "days executed" counter so that they can't keep moving the date two days back (forgot to mention that part) - the counter gets incremented on each execution.
Of course, software licensing systems like this are always avoidable by uninstalling and reinstalling with appropriate refreshing of the registry - the trick is obfuscating and duplicating your license information enough to make this difficult, but eventually, it will get found (especially if you're using an unobfuscated .NET codebase).