如何在 c/c++ 中从 Windows PC 获取唯一的硬件/软件签名
我正在使用 C++ 开发一个小型 Windows 应用程序,我想在电脑上获得某种软件/硬件的指纹,以便我可以允许该应用程序仅在某些电脑上运行。
我知道该应用程序可以被破解,但我真的很想实现这样的东西。
我有什么想法可以实现这一点吗?
I'm developing a small windows app using c++ and i would like to get some kind of fingerprint of the software/hardware on a pc so that i can allow the app to be run only on certain pc's.
I am aware that the app can be cracked but i'm really interested in implementing something like this.
Any ideas how could i achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这基本上取决于您想要将软件与底层硬件耦合的紧密程度。 例如,您可以从注册表中获取一些硬件信息,从 LAN 卡中读取 MAC 地址,检索 gfx 制造商、CPU id 等,并对所有这些数据进行哈希处理。
然后,您可以使用此哈希作为发送到您公司的挑战代码。 然后,客户会收到此哈希的签名(使用您的私钥)版本。
启动后,您的应用程序能够检查哈希签名是好还是坏(即已由您的公司签名)。
这不仅将您的软件绑定到特定的硬件配置,而且还迫使破解者修补您的应用程序(因为他们需要修补您的可执行文件中的公钥并替换它才能编写密钥生成器)。 许多人考虑两次安装从各种来源获得的破解,而不是仅仅输入从注册机复制的有效序列。
编辑:
为了检查哈希的签名,任何来自 RSA 的内容都可以通过 DSA 到 ECC可以使用。 我可以推荐 Crypto++ 或 libTomCrypt 为此。
It basically depends on how tight you want to couple your software to the underlying hardware. For example you could get some hardware information from the registry, read out the MAC address from the LAN card, retrieve the gfx manufacturer, the CPU id, etc. and hash all these data.
You could then use this hash as a challenge code which is sent to your company. The customer then receives the signed (with your private key) version of this hash.
Upon start up your application is able to check if the signature of the hash is good or bad (i.e. has been signed by your company).
This not only binds your software to a certain hardware configuration, but also forces the crackers to patch your application (because they would need to patch the public key from your executable and replace it in order to write a keygen). Many people consider twice installing a crack obtained from various sources in contrast to just entering a valid serial copied from a keygen.
Edit:
In order to check the signature of the hash, anything from RSA over DSA to ECC can be used. I can recommend Crypto++ or libTomCrypt for that.
目前还没有可靠的方法可以在普通 PC 上执行此操作; 人们多年来一直在努力。 问题是您可能随时更改任何组件,包括 CPU 和 BIOS ROM。 最接近的人是使用受加密保护的“加密狗”,但事实证明这两者都是操作上不太令人满意,而且不太安全。
如果你有什么想法,就申请专利; 这将是非常有价值的。
There's no reliable way known to do this in a vanilla PC; people have been trying for years. The problem is that you might change any component at any time, including the CPU and the BIOS ROMs. The closest people have come is using a cryptographically protected "dongle" but that has proven both to be unsatisfactory in operation, and not very secure.
If you come up with something, patent it; it would be very valuable.
正如其他人所说,没有什么是完美的。 我对类似问题进行了半心半意的尝试,最终得到了驱动器卷 ID(不好,因为它可以重新格式化)和操作系统密钥(来自 Windows)的混合。
最后我没有花太多时间在这上面,就好像人们真的想破解你的软件一样,他们可能能够做到。 我留下了微小的许可“保护”,但它很差。
花时间/精力通过让它变得出色来让他们想要购买它。
As the others have said there is nothing perfect for what you want. I made a half-hearted attempt for a similar issue and ended up with a mix of drive volume ID (not good because it can be reformatted) and the OS key (from windows).
In the end I didn't spend much time on it as if people really want to crack your software they'll probably be able to do it. I left the dinky licensing "protection", but it is pretty poor.
Spend the time/effort on making them want to buy it by making it outstanding.