and I would like you to ask for help in this matter. The problem is I want to generate this hardware identifier from as many as possible hardware components, so the license key cannot be used on any other machine. Default implementation uses hard drive serial number and CPU identifier only, what would you recommend to use to build this identifier from?
I've been thinking about using USB serial number and network card MAC? How to read it from C++? Can I read it using C++ only or should I use some external libraries to read those serial numbers?
Any other ideas would be great! Thank you for your time
What you risk doing is alienating the users you have.
> The problem is I want to generate this hardware identifier from as many as possible hardware components
In the extreme, "Hey, I moved the mouse and now the software is unlicensed!? - wtf"
The more you tie your s/w to a given bit of hardware, the more support questions you're going to get from people changing their systems.
Be careful of how much time/effort/money you spend on "protection" vs "product improvement".
Every well known (and less well known) "protection" scheme has it's own following of miscreants ready to break it. https://duckduckgo.com/?q=pelock+keygen
If someone wants your work badly enough, the answer is only a few clicks away.
Remember, it only takes 1 person to break the lock and then through the magic of the internet, everyone else knows as well.
OK, cool. Let's say you've completely scanned the system and identified the exact environment that the program was initially installed on and that happens to be Docker or some clone there of. Or heck, a full VM.
The problem here is your approach. No one uses hardware ID's anymore. First of all they can be trivially spoofed and secondly it annoys customers that they can't upgrade anything on their PC without having to call your tech support line. Tying your installation instance to the PC's root certificate is probably the cleanest way I can think of. That stuff is found here: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/
A few pricey programs still use the usb key (you insert some stupid usb thing in or it won't run) which requires a driver for the usb device and stops working if the usb device wears out (usb is designed with disposable over durable, the connectors are poor quality) and tend to not work across OS nor OS upgrades. But its an option if your program costs as much as a new car per copy or something if you want to support it.
The 3 types I encounter most are the root mentioned above, some sort of networking (eg steam ID vs game being played, do you own it?), and the hardware usb lock. Not sure what else is used a ton? Agreed with above, locking to the pc's hardware serial numbers is a horrible user experience.
No matter what scheme protection that is used, if the software is popular it will be hacked. NOTHING will stop that.
Yes, and often, the stupidest thing will work, like back-dating the computer still works on many trials, and unplugging the internet still confuses a lot of programs as well. A electronics engineer at one of my jobs got 2 more months out of the toner cartridges with a wire to bypass the 'tell them I am empty and to buy more' chip. Multiple times the latest / greatest protection has fallen to dumb (meaning disgustingly simple/ lack of effort) hacks, my favorite still being the sharpie hack for DVD/CD copying.
usb cards go bad at alarming rates, largely due to power overdraw or other voltage related goofs on the user's part, but they are also not exactly well made. I would skip that.
Network MAC is a reasonable pick, but here again, network cards DO fail, so you have to deal with that when it happens, and that is not to mention other odd things that can go on in that realm.