生成基于硬件的computerID
我有一个关于生成用于许可目的的特定计算机 ID 的问题。优选地,该ID应该是基于硬件的,因此如果用户重新格式化,则不应改变。此外,用户更改生成 ID 的信息应该不容易(或者最好甚至不可能)。目前,我只有两个组件可以组合:CPUID 标准和功能标志以及机器中第一个物理驱动器的几何结构和总大小。虽然这对于大多数普通 PC 来说似乎都很好,但许多上网本都是使用完全相同的硬件制成的,因此在这种情况下,您会为许多机器获得相同的 ID。你们中的任何人都可以建议我可以使用的其他硬件组件吗?
我有两个要求:
它不能使用 WMI。
它必须能够在很多情况下工作(包括没有或很少权限的用户)。我想过使用物理驱动器的序列号,但如果用户不在管理员模式下,这似乎很难检索。
我在 Windows 上使用 C++ 工作。
预先感谢您的任何建议。
I had a question regarding generating a specific computer ID for licensing purposes. Preferably this ID should be hardware based, and thus should not change if the user reformats for example. Also it should not be easy (or preferably even impossible) for the user to change the information that the ID is generated from. Currently I only have two components that I combine, the CPUID standard and feature flags and the geometry and total size of the first physical drive in the machine. While this seems to be good for most general PC's, a lot of netbooks for example are made with the exact same hardware and so you would get the same ID for many machines in that case. Can any of you suggest some other hardware component I could use?
I have two requirements:
It must not use WMI.
It must work in a large number of situations (including for users with no or few privileges). I thought of using the serial of the physical drive, but that seems hard to retrieve if the user is not in administrator mode.
I am working in C++ on Windows.
Thanks in advance for any suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
也许这个方法会对你有所帮助。
http://www.codeproject.com/Articles /319181/Haephrati-搜索可靠的硬件 ID
Maybe this method will help you.
http://www.codeproject.com/Articles/319181/Haephrati-Searching-for-a-reliable-Hardware-ID
您可以使用第一个 MAC 地址,该地址由硬件制造商分配,永远不会改变。
像这样的事情:
恕我直言,这对于价值高达一千美元的软件许可来说已经足够了,所需要的只是防止临时消费者与邻居共享您的软件。积极主动的海盗可以绕过它,但拥有足够知识和动机的海盗并不频繁,不值得您花费更多努力来击败他们,更重要的是,您不想给诚实的客户带来不便。
如果您的软件非常有价值,以至于有动机的盗版者构成了真正的威胁,那么硬件加密狗的成本和不便就变得合理了。
我也不相信堆积更多的硬件签名、磁盘驱动器 ID、主板配置等。安全性的提高是微乎其微的,而出现问题的可能性却大大增加,因此您最终会浪费时间来支持具有不寻常设置的客户,并惹恼那些简单地放弃您的未知号码。
使用 MAC 地址实现一个简单的系统,似乎总是有效。接受偶尔的盗版者可能会因为破坏您的许可证而受到惩罚。集中精力改进您的软件,以便赢得更多诚实的客户。
一个系统可能有多个网卡(例如以太网和无线),并且用户可以更改显示顺序(用户为什么要这样做?)。为了处理这个问题,许可证需要与系统上任何位置的网卡相匹配,需要如下代码:
You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.
Something like this:
IMHO, this is sufficient for licensing software valued up to a thousand dollars, where all that is necessary is to prevent casual consumers from sharing your software with their neighbours. A motivated pirate can get around it, but pirates with sufficient knowledge and motivation are not frequent enough to make it worthwhile for you to spend any more effort trying to defeat them and, even more important, you do not want to inconvenience your honest clients.
If your software is so valuable that motivated pirates are a real threat, then the cost and inconvenience of a hardware dongle becomes justified.
Neither do I believe in piling on more hardware signatures, disk drive IDs, motherboard configurations and so on. The increase in security is minimal and the chance that something may go wrong increases greatly so that you will end up wasting hours supporting clients with unusual setups and pissing off unknown numbers who simply give up on you.
Implement a simple system with the MAC address, which always seems to work. Accept that an occasional pirate may get their kicks from breaking your licence. Focus your efforts on improving your software so that you will gain more honest clients.
A system may have more than one network card ( e.g. ethernet and wireless ) and it is possible for the user to change the presentation order ( why would a user do this? ). To handle this, a licence would need to match a network card present anywhere on the system, requiring code something like this:
几年前我尝试做类似的事情但失败了。我尝试使用我可以读取的硬件 ID 的组合。大多数 CPU 都有一个 CPUID,这是一个用于唯一识别和跟踪它们的唯一编号。但问题是,并不能保证每个 CPU 都会有这个 ID。事实上,当我尝试时,Intel Celeron系列并没有这个ID。某些主板(主要是英特尔)还附带一个可供您使用的唯一 ID。
此处是介绍如何获取此信息的文章的链接。
我还将任何/所有 MAC ID 与 CPU ID 和 CPU ID 结合使用。 MB ID 作为种子来生成唯一的 GUID。您用作种子的硬件 ID 越多,执行效果就越好。问题是,如果您升级任何硬件组件,ID 会发生变化,并且软件密钥会失效。
另请记住,虚拟机使这一情况变得更加复杂。我认为最好的选择就是效仿微软的做法。
微软确实使用了类似的方法,他们获取安装了操作系统的计算机的硬件指纹,并将其与注册密钥一起传送以激活操作系统/Office 套件的副本。如果您大幅升级硬件(我认为是 4 个硬件组件),密钥将会发生变化,您将必须联系 Microsoft 并提供证据来重新验证您的 Windows 副本。
I tried doing something similar a few years ago and failed. I tried using a combination of hardware ID's that I could read. Most CPU's have a CPUID, a unique number that is used to uniquely identify and track them. However the problem is that its not garunteed that each CPU out there will have this ID. In fact, when I tried it the Intel Celeron series did not have this ID. Certain Motherboards(mainly Intel) also shipped with a unique ID that you can use.
Here is a link to an article that describes how to get this information.
I also used any / all MAC ID's in combination with the CPU ID & MB ID as a seed to generate unique GUID. The more hardware ID's you use as seed the better this performed.The problem is that if you do upgrade any of the hardware components the ID changes and the software Key gets invalidated.
Also keep in mind that Virtual Machines complicate this even further. I think your best bet would be to do what Microsoft does.
Microsoft does use a similar approach where they take a Hardware fingerprint of a machine on which the OS is installed and communicate it along with the Registration Key to activate a copy of the OS / Office suite. If you upgrade your hardware significantly(I think 4 hardware components) the Key will change and you will have to contact Microsoft and provide proof to re-validate your copy of Windows.
如果您只需要生成一次,则 GUID 对于创建它的计算机来说将是唯一的。问题是每次生成一个值时都会得到不同的值。但如果每台机器都是一次性的,则 GUID 就可以了。
如果每台机器需要相同并生成多次,则 MAC 地址是机器的通用 ID(尽管您可能有多个 MAC 可供选择)。
If you only need to generate it once, the a GUID will be unique to the machine that created it. The problem is you'll get a different value every time you generate one. But if it's a one-off per machine, a GUID will work.
If it needs to be the same per machine and generated multiple times, the the MAC address is the universal ID for machines (though you may have multiple MACs to choose from).
如果这样的事情既简单又可靠,微软早就发现了它并申请了专利。
一些硬件老爹曾尝试过保护软件,包括发布一种名为 的“加密狗” ' 与每个许可的软件包一起使用。嘿,尊贵的新客户!只需插入加密狗并运行您的新软件!
看到鲁布·戈德堡(Rube Goldberg)排列的三四个加密狗将一个插入另一个并挂在并行端口上,每个加密狗都启用自己的软件包,真是一场骚乱。
If such a thing were easy and reliable, Microsoft would have found and patented it long ago.
There have been attempts to protect software by some hardware doo-dad, including shipping a thing called a 'dongle' with every licensed software package. Hey Valuable New Customer! Just plug in the dongle and run your new software!
It was a riot to see a Rube Goldberg arrangement of three or four dongles plugged one into the next and hanging off the parallel port, each enabling its own software package.
许多选项之一是使用 CPU ID。例如,比 Windows 注册表或网卡更好。您不希望用户每次更换网卡等时打扰您。我认为 cpuid项目可以作为示例和起点。
One of many options is to use CPU ID. Better than Windows Registry, or network card, for example. You don't want users to bother you each time they change network card etc. I think cpuid project can be used as an example and starting point.