How to bind the Unique Ids of Computer System into Software

289 Views Asked by At

I have a Windows Stand Alone Application software that i need to be password protected.For this i have hashed the unique ids of the system and put into the License text file of the Application folder.

Here is my code to get the License key

public string Value()
    {
        if (string.IsNullOrEmpty(fingerPrint))
        {
            fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId()
                //+"\nDISK >> "+ diskId() + "\nVIDEO >> " + videoId() +"\nMAC >> "+ macId()
                                 );
        } 
        return fingerPrint;
    }
    private string GetHash(string s)
    {
        Label2.Text = s;
        MD5 sec = new MD5CryptoServiceProvider();
        ASCIIEncoding enc = new ASCIIEncoding();
        byte[] bt = enc.GetBytes(s);
        return GetHexString(sec.ComputeHash(bt));
    }

Now here is my doubt points:

  1. How to make the software valid for some specified period of time.
  2. How to Check the License key and Time Duration validation each time software gets started..
  3. Is my way of approach is correct.

I have tried to implement this in this way because i have heard that windows registry is not the secure way to implement Licensing as any one can easily copy that..

Please help me with your Valuable suggestions. Thanks in advance.

2

There are 2 best solutions below

0
On

You now have a key that you can use to hardware lock the license to the machine and that's one steps to copy protect your application.

Now you need to save the key to a file and protect it using a private/public key mechanism to prevent the user from tampering the file. In this file you can also save the time duration and any other info you want.

Here you can find a sample on how to do it using the RSA keys, the SignedXml object and how to validate: http://www.dotnetlicensing.net/

0
On

You could also try SmartBind (from Wibu Systems). That would also cover the doubting points you mention. It directly ties your software to mac-adress, ip number, bios, cpu-id, hard drives, sid, basically anything that is present in the end-users system.