I have read several solutions about that. The most fitful to my need is this one. I think that what I need is something quite general.
That said I have to go deeper since I have to make a license system that works in two steps:
- no serial added-----> 30 DAYS FROM INSTALLATION
- serial added--------> X MONTHS FROM SERIAL ADD DATE
This has some practical problems. This is how I have tought to do it.
- Installation from setup.
- store installation date in registry (in what hive would it be the best??? not the name of the program nor the company name)
- store installation date in file (again where? and with what filename??)
This step has some practical problems already. I am using Excelsior installer which is a very basic installer. So it can just copy files and stop. It would be very easy to let all the job done from my C# program (e.g. if the hive in question in the registry or the file are not found) but that would mean to give the user the ability to override the system by deleting the hive or the file. So I'd still stick to find a way to do this by the installer.
------from that point and for 30 days the license is in trial mode------
After 30 days the license serial is required and this information is stored in the same location as point 1.
Each time the program is launched the license time is checked.
Should there be a backward time jump (e.g. the user sets the date back) the license is deleted. (would that be too harsch??)
I am fully aware that this is no prevention for piracy but that is not my target. I am just searching for a system that has no evident weakness.
I have thought about storing information in registry + file so that if a registry restore is performed or the file is deleted I have one more chance to keep information.
Differently from this I won't store the username in the sha1 encrypted data (what's the purpose of this????) but the number of months the serial lasts for.
So again please just let me know if in my procedure there is something blatantly wrong or weak.
Thank you in advance.