Serial Key Algorithm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StefanPienaar
    New Member
    • Nov 2007
    • 17

    Serial Key Algorithm

    Hi Everyone

    Ok I really can say that I did first try and get an answer for this by googling a whole day long and I still couldn’t find what I’m looking for.

    I will be releasing an application shortly which will be used by a few users (less than say 200) but I need a way to protect it and force the user to renew his subscription once his license expires a year after purchasing it.

    What I had in mind was generating a serial key for each user after they have downloaded the app and made the payment. The serial key should be some encrypted piece of text with a fixed string followed by the date this key expires. For example:

    Fixed string: “teststring”
    Expiry date: “010109”

    Unencrypted string: “teststring0101 09”

    Somehow encrypt this string…

    Encrypted string: “JSUDHSKEOWISL”

    This is just an example but I think you get the general idea of what I’m trying to accomplish.

    The main thing is I need to encrypt a string to a “friendly” encrypted string which can be used as a serial key so no “=”’s or other non-alphanumeric characters. I then need to be able to decrypt the key again in my application, verify that the fixed string exists and that the key has not yet expired. The encryption does NOT have to be very complicated since this will be used only by a few users which are all end users.

    Any help would be greatly appreciated or if anyone has another idea I could use.

    Thanks in advance
    Stefan

    *EDIT* Oops, forgot to mention that I'm doing it in C#, thanks.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Have you looked at the System.Security .Cryptography namespace services? They offer methods for computing md5 hashes and the like, that could be helpful.
    Combine that with the secure sockets implementation provided in other namespaces, you can probably accomplish your goal.

    Comment

    • StefanPienaar
      New Member
      • Nov 2007
      • 17

      #3
      Hi, thanks, I will have a look at that.

      Just one question: Isn't hashes just one way? What I mean is you can create the encrypted string, but there is no way to decrypt it again. I'm not too sure but I think I read that somewhere while trying to find a solution for my problem.

      I will however have a look at those namespaces and report back here if I get anything working.

      Thanks again
      Stefan

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        md5 is one way I believe, yes. But that doesn't mean you can't use it.

        Look up the way the public/private key stuff works and you'll see how you can use one-way hashes

        Comment

        Working...