2

We are building a C# 4.0 windows application. I need to implement a functionality in which the License Key for the application has to expire every week, so that the user can ask the team for new License Key.

Just a simple logic would do and I don’t mind about hacking as this application is for within the organization use only.

Could you please suggest how this can be achieved in C# with an example?

RSP
  • 231
  • 1
  • 3
  • 14
  • Who are you protecting against? Casual users, people who know regedit, programmers,... –  Dec 20 '11 at 06:51
  • http://stackoverflow.com/questions/4583630/serial-numbers-generation-without-user-data – meziantou Dec 20 '11 at 07:33

1 Answers1

4

I would use a salted hash

You take something specific to them, such as their customer id and other identifying information. You put it into a string, adding your own secret key as a salt, and hash the value (MD5? Sha1? Take your pick...)

The hash value is their key.

If they have a server specific license consider adding mac address into the pre-hash string so they can't copy the license to multiple servers.

Since license duration is involved, consider adding the date created to the pre-hash string.

Another thing to consider is why make the key expire every week? I mean, if it's internal to your organization, why do you even need licenses? Aren't you guys on the same team? (And by that I mean, all working toward the same common goal - bettering your enterprise.)

corsiKa
  • 81,495
  • 25
  • 153
  • 204