CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    53

    Serial generator

    Hi.

    I'm in need of some code which will generate random serial numbers for my software. It will also need to recognise whether a serial number passed in is valid, ie. it matches the format of codes which the program generates.

    Can anyone point me in the right direction of articles etc, explaining how to do this please. Or, even better, point me towards c++ code already written, if possible.

    Thanks,

    Jim

  2. #2
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401
    You can look into public key algorithms like rsa or dsa.

    Chose some message text.
    The serial number is the signature of the message text generated with the private key.
    The program can validate the signature of the same message text with the public key.

    So your key generator program includes the private key and the message text. The message text does not have to be secret, but the private key has to.

    The program that uses the license key must include the same message text and the public key. Both of them are public.

    openssl is a C-Library that has algorithms for dsa and rsa (and sha-1 which you might need as well).

    cryptopp (crypto++) is a C++ library. The latter one is "hardcore C++", very difficult to read and not as well documented as openssl.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured