Algorithm to Generate an Expiry Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sierra7
    Recognized Expert Contributor
    • Sep 2007
    • 446

    Algorithm to Generate an Expiry Date

    Hi
    Does anyone have any code that would generate a Software Key, which a user would then enter to generate a new Expiry Date ?

    I'm sure I could conjure something up but hate re-inventing wheels !

    S7
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't have any code but as far as coming up with a scheme to do so, I'm up for that discussion.

    Would it be unique to a user? Because then you could use a hash of the user's name with the expiry date as a salt. Then append or prepend the expiry date using a simple reversible encryption such as Base16.

    Comment

    • sierra7
      Recognized Expert Contributor
      • Sep 2007
      • 446

      #3
      Hi Rabbit
      Would it be unique to a user? Because then you could use a hash of the user's name with the expiry date as a salt. Then append or prepend the expiry date using a simple reversible encryption such as Base16.
      I have no idea what you are talking about!! Hash and salt? Anyway,I'm up for it! I'm just a humble engineer. That's why I asked the question. I hoped someone with more knowledge than myself would respond.

      Yes it makes sense to include the username (or Company name), so long as it can be decoded.

      To start the ball rolling, currently I hard code the expiry date into the current event of the startup form. That way it's not stored in the database. Most of my users would not be able find and change it but obviously it's not very secure.

      A month before the expiry date I give a warning to renew the license each time the application starts. For the month after expiry I put up a message to say it has expired and after that they get the message every form change. Only after 3 months to I stop them using it.

      With this arrangement I have to supply a revised front-end which is a nuisance if no other changes are required.

      What I am thinking of is something more conventional where the user opens a special form and enters the new software key. This would then decode the key and presumably put a date, or number of days into the database. My existing code would then read this and workout the current status.

      I have other ideas but that's the start.
      S7

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        A hash is basically a one way encryption. A salt is a value used to initialize the function values so that the same input doesn't result in the same output.

        You can use either a reversible encryption, which means you would have to store the key or password in the program code but is slightly more secure, or you can use a one way encryption, which is slightly less secure but easier to implement.

        Here are a couple of articles I wrote that discuss implementations of encryption algorithms in VBA.
        Last edited by NeoPa; Jan 23 '12, 12:46 AM. Reason: Amended links to show destination

        Comment

        • Mihail
          Contributor
          • Apr 2011
          • 759

          #5
          Only for subscribe to this thread.
          Thank you !

          Comment

          • sierra7
            Recognized Expert Contributor
            • Sep 2007
            • 446

            #6
            @Rabbit
            Well that's my reading for the weekend!
            Many thanks
            S7

            Comment

            • Mariostg
              Contributor
              • Sep 2010
              • 332

              #7
              Just watching this out.

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Just so we're clear, there's no way to do this that is fool proof. CD Keys get cracked all the time. What we can do, however, is provide a modicum of security that will keep out the majority of users.

                Comment

                Working...