Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a key from unique hardware info
Forum Updated to NodeBB v4.3 + New Features

Creating a key from unique hardware info

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jankokaj
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Matt86
      wrote on last edited by
      #2

      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.

      https://www.cryptopp.com/wiki/RSA_Cryptography

      1 Reply Last reply
      1
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        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.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • J Offline
          J Offline
          jankokaj
          wrote on last edited by
          #4

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

          jsulmJ A 2 Replies Last reply
          0
          • J jankokaj

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

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

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

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • J jankokaj

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

              A Offline
              A Offline
              ambershark
              wrote on last edited by
              #6

              @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.

              My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

              1 Reply Last reply
              1
              • G Offline
                G Offline
                gumtown
                wrote on last edited by gumtown
                #7

                QSysInfo::machineHostName();

                will give you your computer name.
                You could design simple a key generator with say for example, a 16 digit alpha-numeric base key, and use the machine host name emailed to you from a customer, which your software app provided from the computer it is currently running on, to generate a key by rendering the name to a checksum and apply that to each digit of the master key, and return that generated key to the customer, which the application will be running the same checksum key generator to accept the key code.
                Not too many people are going to be running the same computer user name.

                jsulmJ 1 Reply Last reply
                0
                • G gumtown

                  QSysInfo::machineHostName();

                  will give you your computer name.
                  You could design simple a key generator with say for example, a 16 digit alpha-numeric base key, and use the machine host name emailed to you from a customer, which your software app provided from the computer it is currently running on, to generate a key by rendering the name to a checksum and apply that to each digit of the master key, and return that generated key to the customer, which the application will be running the same checksum key generator to accept the key code.
                  Not too many people are going to be running the same computer user name.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @gumtown It would be easy to use such a key on more than one machine: simply change the machine host name. Better to use something like https://doc.qt.io/qt-6/qsysinfo.html#machineUniqueId as long as the id is stable.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved