Creating a key from unique hardware info

  • I wold like to secure my application by tying it to the particular hardware it is run on. I would like to prevent people from being able to clone the hard drive with my application and use it on a different machine. Would somebody be able to tell me how to get unique hardware info inside Qt? If this is not the right way to protect my application, please suggest a good strategy to do it. I am running my application on Ubuntu. Thanks for the help!

  • I looked into this problem before, and there isn't an easy solution. Many people use the mac address on the network card, however, if they get another card the program won't work. Others use this plus hard drive serial plus .. and combine them to form an overall unique id. Unfortunately there will be no way for you to ensure your application will not be stolen. The program can be disassembled, and the binary can be patched with jumps over the function call to perform your security checks. I personally used a combination of cryptopp(signature scheme), and a machine identifier to form a public and private key. I believe the public key is shipped with the software, and the private key is purchased.

  • Moderators

    That's a pretty extreme anti-piracy method. Especially for an open source OS with an open source community behind it. Chances of getting many sales on an app for Linux with that level of security is going to be pretty low in my opinion.

    That being said most companies will use a license server in instances like that. You can of course link it to a hard drive serial or the mac address on a card and then require activation (like Microsoft). This is the method used by some of the apps I use in linux. I usually get a named user license I can use on as many machines as I want but only one at a time. That way I don't have to buy multiple copies of expensive software for my laptop, desktop, server, etc. I can only use 1 at a time anyway.

    You are definitely going to have a tough time finding people to use an app like that on linux though. It might fly on a windows platform, but linux users are too used to freedom. :)

    Speaking as a 20 year linux user. I buy a lot of software for linux both personally and for my company. If any of it used a method like that I would find a different solution (or an open source one). You might want to leave methods like that to the Microsoft world, linux users really won't tolerate it. Unless you have an app that is so niche that people have no choice but to use yours. That's usually not the case and still a good way to annoy your actual paying users.

    I've written software for a long time and owned a software company for quite some time as well. No faster way to lose customers than draconian anti-piracy methods.

  • Can somebody suggest how can I retrieve the hardware information from Qt app on Linux?

  • Qt Champions 2018

    @jankokaj Qt does not provide such functionality, you will need to use something else.

  • Moderators

    @jankokaj Mac addresses are available in /sys/class/net/*/address files. I.e. cat /sys/class/net/*/address will show all mac addresses on your machine.

    For hard drives you can use the UUID if you wanted which you can get via lsblk --output UUID . I'm sure that info is available in /sys or /proc as well but I didn't take the time to find it. If you google it you will find those are better solutions that using lsblk as lsblk may not (or probably not even) be installed on all linux OSes.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.