How to create serials key to protect an application

て烟熏妆下的殇ゞ 提交于 2019-12-03 16:13:18

I think the signature approach is currently best practice. Btw. there are a number of free libs that cover this topic.

The length of the license key is at least determined by the signature key length - a 1024 bit key produces a 128 byte license (if no other payload is added).

Often the license file consists of more information on the licensed use itself, like validity period, licensed submodules, throughput... - the signature itself is embedded within this structure. This way you gain flexibility and i strongly advise this solution, even if the license gets even bigger.

For importing the license in an application you can adopt a hybrid way (like we did). On one hand you can provide the classic "import license file" solution. On the other, we generate a random, short ID (like your GUID) and associate it with the license data. Upon registration the user enters the the short ID and the application looks up the complete license via HTTP. You must be online only once, you can still provide complex licenses and the user only needs a short ID.

EDIT

  1. The length of s signature is the length of the key. E.g. 1024 bit (or 128 byte)
  2. You can use this signature alone if your application knows what data is signed (e.g. the mail)
  3. You can sign a "license document" containing more properties than only the mail. In this case the license contains property AND signature (and is, accordingly, longer than only the signature)
  4. You dont need online connection for license check. Just import a license with the application and check whenever you like.
  5. An addition to license file import you CAN adopt an online download of the license file using a short ID as a key. The license is downloaded and offline. So you have the best of both worlds.

You may just hash the user info concatenated with a "secret" salt and then truncate the hash.

Hackers - provided they are interested in your program - will crack it, by reverse engineering the source: they'll find both the hash algorithm and the secret salt.

But this is to happen also with your sign&verify solution: they can just bypass the check making it return true.

So the sign&verify solution is more complex but not safer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!