基于软件/硬件唯一识别PC

发布于 2024-09-17 18:05:27 字数 362 浏览 11 评论 0原文

对于生成每台 PC 的许可证密钥的要求,我需要一些代码,它将在任何 PC 上返回稳定且(接近)唯一的密钥。它不必保证唯一,但接近。不过,它确实需要相当稳定,以便给定的 PC 始终生成相同的结果,除非硬件发生重大变化。

这是针对 Windows 应用程序,使用 wxWidgets,但 Win32 或其他选项也可以。

我正在考虑 MAC 地址,但是那些可以在省电模式下定期禁用网卡的笔记本电脑呢?我遇到了 GetCurrentHwProfile 但它并不完全看起来像我想要的吗?

For a requirement to generate per-PC license keys, I need some code which will return a stable and (near) unique key on any PC. It doesn't have to be guaranteed unique, but close. It does need to be reasonably stable though, so that a given PC always generates the same result unless the hardware is substantially changed.

This is for a Windows application, using wxWidgets but a Win32 or other option is fine.

I was thinking about MAC address but what about laptops which can routinely disable the network card in power-saving mode? I came across GetCurrentHwProfile but it doesn't quite look like what I want?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

撑一把青伞 2024-09-24 18:05:27

我有一段时间对此的一个想法是使用 CryptProtectData< /a> 作为识别机器的一种方式。在该 API 的幕后,Microsoft 已经完成了您正在寻找的事情。但我从未测试过它,我很好奇它是否真的可行。

基本上,您可以使用 CryptProtectDataCRYPTPROTECT_LOCAL_MACHINE 对常量魔法值进行编码,结果就是您的机器 ID。

One idea I had a while back for this is to use CryptProtectData as a way to identify a machine. Behind-the-scenes in that API, Microsoft has done what you're looking for. I never tested it though and I'm curious if it's actually viable.

Basically you would encode a constant magic value with CryptProtectData with CRYPTPROTECT_LOCAL_MACHINE, and the result is your machine ID.

递刀给你 2024-09-24 18:05:27

我会直接使用 MAC 地址方法;当无线/局域网卡关闭时,它们仍然显示在网络连接中。因此您应该仍然能够获得 MAC。

考虑一下:只要您能够联系您的网络服务器或用于对这些 ID 进行编目的任何内容,用户就将拥有某种形式的可用网卡。

哦,您也许可以使用客户计算机支持的 ​​CPU 序列号。

I would just go with the MAC address method; when the wireless / LAN cards are turned off they still show up in Network Connections. You should therefore still be able to get the MAC.

Consider this: Any time you'd be able to contact your webserver or whatever you're cataloging these IDs with, the user is going to have to have some form of network card available.

Oh, and you might be able to use CPU serial number of the customer's computer supports it.

栖竹 2024-09-24 18:05:27

我认为到目前为止还没有发现真正简单且独特的方法。

  1. GetVolumeInformation 检索的甚至不接近唯一 ID...
  2. 使用任何硬件序列都是有问题的,因为制造商并不致力于始终支持它,特别是保持其全局唯一性
  3. GetCurrentHwProfile 检索 GUID,但它的值受轻微影响!硬件更改...
  4. 使用产品密钥...将使您能够处理被盗的软件 - 全球范围内有很多盗版安装。
  5. 创建自己的 GUID 并将其保存在注册表中(在任何地方)不会阻止通过克隆图像进行复制....
    ETC...
    从我的角度来看,最好的方法是组合:
    卷 ID + MAC 列表 + 机器 SID + 机器名称。显然,在服务器端管理许可证策略;0)

问候
米克尔.

I think there no really easy and unique method so far discovered here.

  1. GetVolumeInformation retrieves not even close to unique ID.....
  2. To use any hardware serial is problematic because manufactures are not committed to supported it always and especially to keep it globally unique
  3. GetCurrentHwProfile retrieves GUID but it's value affected by minor! hardware changes...
  4. Using Product Key ... will bring U to deal with the stolen software - there lot of pirate installations over the globe.
  5. Creation of own GUID and preserving it under registry (in any place) will not prevent duplication by cloning of image ....
    etc...
    From my perspective of view the best way is combine:
    Volume ID + MAC's list + Machine SID + Machine Name. And obviously manage license policy on the server side ;0)

Regards
Mickel.

幻想少年梦 2024-09-24 18:05:27

如果您想要比机器本身告诉您的东西更难欺骗的东西,您可能需要提供专用于此目的的 USB 加密狗(而不仅仅是闪存驱动器)。

If you want something a bit harder to spoof than whatever the machine itself can tell you, you'll probably need to provide a USB dongle dedicated for this purpose (not just a flash drive).

半岛未凉 2024-09-24 18:05:27

对于一个相当脑残的测试,我使用操作系统的 ProductID 代码和计算机名称 - 两者都从注册表中提取。并不是真正安全,但无论如何都是假装安全。

编辑

要回答约翰关于我正在读取哪些键的问题:

SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductID

SYSTEM\CurrentControlset\Control\ComputerName\ComputerName\ComputerName

For a pretty brain dead test I am using the ProductID code of the OS and the computer name - both extracted from the registry. Not really secure, but its all pretend security anyway.

edit

To answer John's question about what keys I am reading:

SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductID

SYSTEM\CurrentControlset\Control\ComputerName\ComputerName\ComputerName

命硬 2024-09-24 18:05:27

使用安装windows的硬盘的序列号怎么样?

函数 GetVolumeInformation() 会给你这样的序列号。
要访问硬盘供应商分配的 ID 而不是 Windows 分配的 ID,可以使用 Win32_PhysicalMedia 类。

要确定安装 Windows 的驱动器,您可以使用函数 ExpandEnvironmentStrings() 扩展变量 %windir"

如果您的体系结构允许,另一个选择是使用 UuidCreate() 在安装时生成随机 GUID 并将其永久保存只要注册表保留,该 GUID 就可以用作 ID。

第三种选择是在启动时使用知名服务器分配 ID。 软件可以在注册表中查找 ID,如果没有找到,则会联系服务器并向服务器提供其 MAC 地址、主机名、硬盘序列号、机器 SID 和任意数量的可识别信息(密钥)。

,该 根据给定的信息确定客户端是否已经注册,服务器可以有宽松的策略,例如只需要大多数密钥进行匹配,以便即使在完全清除的情况下该机制也可以工作。注册表以及是否更换了部分(但不是全部)硬件。

How about using the serial number of the harddisk where windows is installed?

The function GetVolumeInformation() will give you such serial number.
To access the ID assigned by the harddisk vendor instead of the ID assigned by Windows, you can use the Win32_PhysicalMedia Class.

To determine the drive where windows is installed, you could expand the variable %windir" by using the function ExpandEnvironmentStrings()

Another option, if your architecture allows, is to use UuidCreate() to generate a random GUID at installation time and save it permanently in the registry. This GUID can then be used as the ID as long as the registry remains. A new registry database is generally considered as a new installation.

A third option is to have a well-known server assigning the IDs. Upon starting up, the software could look up for the ID in the registry and if not found, would contact the server and supply it with its MAC address, hostname, harddisk serial number, Machine SID and any number of indentifyable information (keys).

The server then determines if the client is already registered or not based on the information given. The server could have a relaxed policy and for example only require most of the keys for a match, so that the mechanism would work even in the event of a complete wipe out of the registry and if part (but not all) of the hardware was replaced.

叫嚣ゝ 2024-09-24 18:05:27

使用 CPU 的序列号怎么样?我记得微软曾经为此提供了一个 API,它可以运行必要的汇编代码,并返回有关 CPU 的各种信息,包括序列号。不确定它是否适用于 AMD 芯片,我认为这是英特尔特定的。

当然,CPU Id 足够安全且静态!

How about using the serial number of a CPU. I remember Microsoft used to provide an api for this that would run the necessary assembler code and give you back all sorts of info about the CPU including serial number. Not sure if it'd work with AMD chips or not, I think it was intel specific.

Surely CPU Id is secure and static enough!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文