Emission and control of software license registration file

6

I have a system for controlling and issuing electronic license registration files so that I can control how many machines my software can run. My teacher advised me to use the processor's CPUID to validate and generate a license file (get CPUID and make a calculation on top of it, so the result would be unique for each processor) and the validation would be done at the time of installation, the requests would be made to the server that would request the CPUID of the machine and return the license file.

Are there other ways to do this license record control? Is there any API or feature? And how can the implementation be done?

Here's my basic prototype that gets CPUID and performs a calculation. There are two functions string getCPUID() and double CalculaCpuId(string cpuid) is the basis for generating the electronic license record file.

Function getCPUID :

private string getCPUID()
{
    String cpuid = "";
    try
    {
        ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select ProcessorID From Win32_processor");
        ManagementObjectCollection mbsList = mbs.Get();

        foreach (ManagementObject mo in mbsList)
        {
            cpuid = mo["ProcessorID"].ToString();
        }

        return cpuid;
    }
    catch (Exception) { return cpuid; }
}

Function CalculaCpuId :

private double CalculaCpuId(string cpuid) 
{
    if (string.IsNullOrEmpty(cpuid))
        return 0;

    double resultado = 0;
    int soma = 0;
    string digito;

    for (int i = 0; i < cpuid.Length; i++)
    {
        digito = cpuid[i].ToString();
        soma += Convert.ToInt32(digito, 16);
    }

    resultado = (soma / ((Math.Pow(2, 2)) + 4));

    return resultado;
}

I'm using Visual Studio to develop my system that needs the license record control.

    
asked by anonymous 21.12.2015 / 01:15

1 answer

2

Getting the processor ID is not a solution, this information may not even be available. And this has not even been done to identify which processor is individual.

Any solution trying to identify the machine has the potential to fail.

One that uses and works best in some situations is get the serial number of the disk . It is far from a perfect solution, on the contrary, it has its own shortcomings. I do not like WMI much, but if you want to continue using it, look for DeviceID .

There are ready-made software that can do this for you.

    
21.12.2015 / 01:33