Is there any operation system limitations? I think following approach will be quite simple:
Choose a way of getting machine id. For example this can be MachineGuid registry entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography. (Generating a unique machine id)
Define features which you are planning to licence and the way to identify them. You can just name them. If your product is simple it can be a feature itself.
Create public/private key pair.
Retrieve customer's machine id in some way. You can ask him to send it manually or you can create a simple utility or it can be a special command in your application.
Combine feature id and machine id in some way and sign result with your private key. For example you can make that combination by concatenation. In that case result string may look like this: "YourApplicationName-12345678-9abc-def0-1234-56789abcdef0"
Signature will be a sequence of bytes, so if you want to pass it in text form you should make some conversion to it. For example you can convert signature to Base64 string. The combination of feature id, machine id and signature of their combination will be a licence key!
Include public key in your application distribution and add logic for licence verification. If licence is valid then you should check that it's being used on correct machine and in correct application.
Please tell if something is unclear and I will try to provide detailed answer.
EDIT: I'm sure that implementation of all of this can be done in 1 day, but I agree with others who suggest you to use existing solutions. There are plenty for different platforms and programming languages.
Put the capabilities of the product (number of users, Host IP, date of expiration, whatever) in a plain text file. Sign the file with a public key, then check the signature at runtime.
If they're motivated they can decompile the code, yank out the checks or whatever, but it'll deter tampering, and it'll look all nice and official.
There's no way you can do a good job in a day and chances are the overall effect will be negative. It'll annoy your loyal and honest customers and it won't stop dishonest ones.
Instead, spend that day in coming up with a way to measure somehow how much piracy your product is getting. Once you know this, you can estimate how much money you are losing and how much effort you really should put into protection or other approaches.
If you still want to do it though, the easiest way is to collect some data unique for the installation (OS user name, email address, CPU/motherboard serial number - whatever you want to tie it to), ask the user to send it to you and generate a license key by encrypting it with your private key. Your software should collect the same pieces of data, decrypt the license with your public key and compare the two blobs.
If you need just pseudo code (what lang / platform ?) You can take the computer MAC address (which suppose to be unique) and build a function that combine it some other computer parameters - and make sure you validate it each time the apps run against your own DB, keeping the user's email in that row.
if anything changes - the software will not work, but the user can request a new key - with the same mail - then you can revoke the old key and give him a new one.
最简单的许可证生成器:带有种子校验和的 ini 文件,其中包含客户名称和有关启用哪些模块的信息。对于黑客来说,它很容易被破解,但对于非黑客来说,它是安全的。该名称必须在公开显示的应用程序的输出中可见,以便其他潜在客户无法使用该许可证文件。
Simplest license generator: An ini file with a seeded checksum, which contains customer name and info about which modules are enabled. It will be quite easy to break for a hacker, but for non-hacker, it's safe. The name must be visible in output from the app that is shown in public, so that other potential customers cannot use the license file.
发布评论
评论(7)
有操作系统限制吗?我认为以下方法将非常简单:
选择一种获取机器 ID 的方式。例如,这可以是
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
中的MachineGuid
注册表项。 (生成唯一的机器 ID)定义您计划许可的功能以及识别它们的方法。你只需说出它们的名字即可。如果您的产品很简单,它本身就可以是一个功能。
创建公钥/私钥对。
以某种方式检索客户的机器 ID。您可以要求他手动发送,也可以创建一个简单的实用程序,也可以是应用程序中的特殊命令。
以某种方式组合功能 ID 和机器 ID,并使用您的私钥对结果进行签名。例如,您可以通过串联来进行组合。在这种情况下,结果字符串可能如下所示:“YourApplicationName-12345678-9abc-def0-1234-56789abcdef0”
签名将是一个字节序列,因此如果您想以文本形式传递它,您应该进行一些转换它。例如,您可以将签名转换为 Base64 字符串。 功能 ID、机器 ID 及其组合签名的组合将成为许可证密钥!
在您的应用程序分发中包含公钥并添加许可证验证逻辑。如果许可证有效,那么您应该检查它是否在正确的机器和正确的应用程序中使用。
有关公钥/私钥操作的更多信息此处。
如果有不清楚的地方请告诉我,我会尽力提供详细的答案。
编辑:我确信所有这些的实施可以在 1 天内完成,但我同意其他人建议您使用现有解决方案的观点。有很多适用于不同平台和编程语言的工具。
Is there any operation system limitations? I think following approach will be quite simple:
Choose a way of getting machine id. For example this can be
MachineGuid
registry entry inHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
. (Generating a unique machine id)Define features which you are planning to licence and the way to identify them. You can just name them. If your product is simple it can be a feature itself.
Create public/private key pair.
Retrieve customer's machine id in some way. You can ask him to send it manually or you can create a simple utility or it can be a special command in your application.
Combine feature id and machine id in some way and sign result with your private key. For example you can make that combination by concatenation. In that case result string may look like this: "YourApplicationName-12345678-9abc-def0-1234-56789abcdef0"
Signature will be a sequence of bytes, so if you want to pass it in text form you should make some conversion to it. For example you can convert signature to Base64 string. The combination of feature id, machine id and signature of their combination will be a licence key!
Include public key in your application distribution and add logic for licence verification. If licence is valid then you should check that it's being used on correct machine and in correct application.
More on public/private key operations here.
Please tell if something is unclear and I will try to provide detailed answer.
EDIT: I'm sure that implementation of all of this can be done in 1 day, but I agree with others who suggest you to use existing solutions. There are plenty for different platforms and programming languages.
你为什么不从别人那里得到一份呢?如果你只愿意投入一天,你就不会得到好的产品。
Why don't you just get one from someone else. If you are only willing to put one day in, you aren't going to get a good product.
许可证密钥不会阻止客户多次安装您的软件,除非该密钥与服务器名称等的哈希值相关联。
A license key won't stop the customer from installing you software several times unless the key is tied to a hash of the server name etc.
将产品的功能(用户数量、主机 IP、到期日期等)放入纯文本文件中。使用公钥对文件进行签名,然后在运行时检查签名。
如果他们有动力,他们可以反编译代码,取出检查或其他任何东西,但这会阻止篡改,而且看起来一切都很好而且很正式。
Put the capabilities of the product (number of users, Host IP, date of expiration, whatever) in a plain text file. Sign the file with a public key, then check the signature at runtime.
If they're motivated they can decompile the code, yank out the checks or whatever, but it'll deter tampering, and it'll look all nice and official.
一天之内不可能把工作做好,而且整体效果很可能是负面的。它会惹恼您忠实和诚实的客户,并且不会阻止不诚实的客户。
相反,花一天的时间想出一种方法来衡量您的产品受到盗版的程度。一旦了解了这一点,您就可以估计您损失了多少钱以及您真正应该在保护或其他方法上投入多少努力。
如果您仍然想这样做,最简单的方法是收集一些安装独有的数据(操作系统用户名、电子邮件地址、CPU/主板序列号 - 无论您想要将其绑定到什么),要求用户发送它并通过使用您的私钥加密来生成许可证密钥。您的软件应该收集相同的数据,使用您的公钥解密许可证并比较两个 blob。
There's no way you can do a good job in a day and chances are the overall effect will be negative. It'll annoy your loyal and honest customers and it won't stop dishonest ones.
Instead, spend that day in coming up with a way to measure somehow how much piracy your product is getting. Once you know this, you can estimate how much money you are losing and how much effort you really should put into protection or other approaches.
If you still want to do it though, the easiest way is to collect some data unique for the installation (OS user name, email address, CPU/motherboard serial number - whatever you want to tie it to), ask the user to send it to you and generate a license key by encrypting it with your private key. Your software should collect the same pieces of data, decrypt the license with your public key and compare the two blobs.
如果您只需要伪代码(什么语言/平台?)
您可以获取计算机 MAC 地址(假设是唯一的)并构建一个将其与其他一些计算机参数相结合的函数 - 并确保每次应用程序针对您自己的数据库运行时都对其进行验证,并将用户的电子邮件保留在该行中。
如果有任何变化 - 软件将无法工作,但用户可以使用相同的邮件请求新密钥 - 那么您可以撤销旧密钥并给他一个新密钥。
If you need just pseudo code (what lang / platform ?)
You can take the computer MAC address (which suppose to be unique) and build a function that combine it some other computer parameters - and make sure you validate it each time the apps run against your own DB, keeping the user's email in that row.
if anything changes - the software will not work, but the user can request a new key - with the same mail - then you can revoke the old key and give him a new one.
最简单的许可证生成器:带有种子校验和的 ini 文件,其中包含客户名称和有关启用哪些模块的信息。对于黑客来说,它很容易被破解,但对于非黑客来说,它是安全的。该名称必须在公开显示的应用程序的输出中可见,以便其他潜在客户无法使用该许可证文件。
Simplest license generator: An ini file with a seeded checksum, which contains customer name and info about which modules are enabled. It will be quite easy to break for a hacker, but for non-hacker, it's safe. The name must be visible in output from the app that is shown in public, so that other potential customers cannot use the license file.