Estoy creando una licencia que es específico de una máquina. La licencia se basa en los siguientes elementos:C# Creación de un ID único basado en los identificadores de hardware
- Dirección MAC
- CPU Número de serie
- ordenador volumen de serie Número de Drive0
estoy asumiendo que si 2 de los 3 coincidencia, mi licencia es valida Por lo tanto, la puede obtener una nueva tarjeta de red, y la licencia sigue siendo válida, etc.
¿Es esta una buena aproximación o voy a tener problemas con esto que no se ajuste o cambio de forma regular?
estoy tratando de obtener un identificador único para el equipo para que pueda validar la licencia.
Por favor, hágamelo saber cómo se ve o si usted tiene una mejor solución!
¡Gracias nuevamente!
** Esto es lo que se le ocurrió **
Terminé usando sólo el VolumeSerial, cpuid y VideoControllerDescription.
public enum HardwareProfileComponents
{
ComputerModel,
VolumeSerial,
CpuId,
MemoryCapacity,
VideoControllerDescription
}
public static Dictionary<string, string> HardwareProfile()
{
var retval = new Dictionary<string, string>
{
{HardwareProfileComponents.ComputerModel.ToString(), GetComputerModel()},
{HardwareProfileComponents.VolumeSerial.ToString(), GetVolumeSerial()},
{HardwareProfileComponents.CpuId.ToString(), GetCpuId()},
{HardwareProfileComponents.MemoryCapacity.ToString(), GetMemoryAmount()},
{HardwareProfileComponents.VideoControllerDescription.ToString(), GetVideoControllerDescription()}
};
return retval;
}
private static string GetVideoControllerDescription()
{
Console.WriteLine("GetVideoControllerDescription");
var s1 = new ManagementObjectSearcher("select * from Win32_VideoController");
foreach (ManagementObject oReturn in s1.Get())
{
var desc = oReturn["AdapterRam"];
if (desc == null) continue;
return oReturn["Description"].ToString().Trim();
}
return string.Empty;
}
private static string GetComputerModel()
{
Console.WriteLine("GetComputerModel");
var s1 = new ManagementObjectSearcher("select * from Win32_ComputerSystem");
foreach (ManagementObject oReturn in s1.Get())
{
return oReturn["Model"].ToString().Trim();
}
return string.Empty;
}
private static string GetMemoryAmount()
{
Console.WriteLine("GetMemoryAmount");
var s1 = new ManagementObjectSearcher("select * from Win32_PhysicalMemory");
foreach (ManagementObject oReturn in s1.Get())
{
return oReturn["Capacity"].ToString().Trim();
}
return string.Empty;
}
private static string GetVolumeSerial()
{
Console.WriteLine("GetVolumeSerial");
var disk = new ManagementObject(@"win32_logicaldisk.deviceid=""c:""");
disk.Get();
string volumeSerial = disk["VolumeSerialNumber"].ToString();
disk.Dispose();
return volumeSerial;
}
private static string GetCpuId()
{
Console.WriteLine("GetCpuId");
var managClass = new ManagementClass("win32_processor");
var managCollec = managClass.GetInstances();
foreach (ManagementObject managObj in managCollec)
{
//Get only the first CPU's ID
return managObj.Properties["processorID"].Value.ToString();
}
return string.Empty;
}
En primer lugar, no se puede hacer: un GUID es un UUID calculado específicamente, por lo que al usar el término GUID en sí mismo, se define en formas específicas de cálculo. – TomTom
Cambié el título para evitar llamarlo un "GUID", ya que es un tipo específico de identificación como notas de @TomTom. –
¿por qué no se puede hacer? – ivowiblo