1

I have the program and I need to restrict it. But I don't know what way the best. When I run the program I ask for registration key and username. Then take username+somestring+DateTime.Now. Convert it in hash and compare it with key. If true then save in AppData file with username and key. And when run the program do the same. And from this string get date. If DateTime.Now.Day != DateFromString.Day then false. But if user delete this file and change time and then register... He can open it.

What the best way add restriction for one day?

Thanks in advance.

  • Two words: Network activation. Everything else is fail. – Damon Aug 03 '12 at 15:16
  • Take a look at this solution http://stackoverflow.com/questions/3404045/how-to-protect-software-from-system-date-time-changes – cgon Aug 03 '12 at 15:29

2 Answers2

1

If you give your user some software that checks the computer's own clock then it can trivially be tricked by changing the clock.

Slightly better is to have your program authenticate with a server. But then your users will need internet access to use your program. And it is still possible for a skilled user to change the program to skip the check.

If you give your users some software then you can't 100% reliably prevent them from modifying it and running it.

Mark Byers
  • 811,555
  • 193
  • 1,581
  • 1,452
1

You need to identify in a unique way the machine on which your program has been installed.
Look at the best voted answer in this question.
Encrypt with a secret key the string obtained and send it to a webservice you have control of.

The webservice register in a database the encrypted string with the data of first run.
At the next run of your program send again the same encrypted string to the webservice.
The webservice check strings and date against the database and send back the result.

This is not an absolute fix for your problem and could be fooled.
At least this will require a different machine, a fake webservice or a crack of your code.

Community
  • 1
  • 1
Steve
  • 213,761
  • 22
  • 232
  • 286