如何为C#Windows应用程序设置许可证密钥? [英] How to set license keys for C# Windows application?

查看:464
本文介绍了如何为C#Windows应用程序设置许可证密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS 2010中用C#.NET开发了一个Windows应用程序,其中以Share point作为后端。我也为我的产品创建了设置,现在我想为我的应用程序设置许可证密钥,如何实现这一点,请帮助我。



究竟是什么想要的是,例如,在安装MS Word时,它要求许可证密钥吗?像那样。

I have developed a windows application in C# .NET in VS 2010 with Share point as its back end. I have also created setup for my product, now i would like to set license keys for my application, how can i achieve this, please help me.

what exactly i want is, for instance, when installing MS Word, it asks for license key right? like that.

推荐答案

StackOverFlow:frankodwyer说
StackOverFlow: frankodwyer says

你可以做类似创建的事情包含要对应用程序进行身份验证的数据的记录。这可能包括你想要的任何东西 - 例如程序功能启用,到期日期,用户名称(如果要将其绑定到用户)。然后使用一些加密算法用固定密钥加密或加密它。然后你只需在你的程序中验证它。分发许可文件(在Windows上)的一种方法是将其作为更新注册表的文件提供(保存用户必须键入它)。



小心虽然错误的安全感 - 迟早有人会简单地修改你的程序以跳过该检查,并分发修补版本。或者,他们会计算出一张钥匙,通过所有检查并分发,或者回溯时钟等。无论你制定计划有多复杂,你为此做的任何事情最终都会通过默默无闻来保证安全,而且他们总会能够做到这一点。即使他们不能有人会,并将分发黑客版本。即使您提供加密狗也是如此 - 如果有人愿意,他们也可以修补支票。数字签名代码无济于事,他们可以删除该签名,或者辞职。



您可以通过使用技术来防止程序运行,从而使问题复杂化调试器等,但即使这不是防弹。因此,您应该让一个诚实的用户不会忘记付费。另外要非常小心,你的计划不会对付费用户产生任何影响 - 最好是为你的付费用户提供一些剽窃副本,而不是使用他们支付的费用。



另一种选择是进行在线检查 - 只需向用户提供唯一ID,并在线检查ID应具备的功能,并将其缓存一段时间。所有相同的警告都适用 - 人们可以绕过这样的事情。



还要考虑必须与忘记钥匙的用户打交道的支持费用等。



编辑:我只是想补充一下,不要在这方面投入太多时间,或者认为你的复杂方案会有所不同和不可摧毁。它不会,也不会只要人们控制程序运行的硬件和操作系统。开发人员一直试图为此提出更复杂的方案,认为如果他们为它开发自己的系统,那么它将只为他们所知,因此更安全。但它确实是编程等同于尝试构建永动机。 : - )

You can do something like create a record which contains the data you want to authenticate to the application. This could include anything you want - e.g. program features to enable, expiry date, name of the user (if you want to bind it to a user). Then encrypt that using some crypto algorithm with a fixed key or hash it. Then you just verify it within your program. One way to distribute the license file (on windows) is to provide it as a file which updates the registry (saves the user having to type it).

Beware of false sense of security though - sooner or later someone will simply patch your program to skip that check, and distribute the patched version. Or, they will work out a key that passes all checks and distribute that, or backdate the clock, etc. It doesn't matter how convoluted you make your scheme, anything you do for this will ultimately be security through obscurity and they will always be able to this. Even if they can't someone will, and will distribute the hacked version. Same applies even if you supply a dongle - if someone wants to, they can patch out the check for that too. Digitally signing your code won't help, they can remove that signature, or resign it.

You can complicate matters a bit by using techniques to prevent the program running in a debugger etc, but even this is not bullet proof. So you should just make it difficult enough that an honest user will not forget to pay. Also be very careful that your scheme does not become obtrusive to paying users - it's better to have some ripped off copies than for your paying customers not to be able to use what they have paid for.

Another option is to have an online check - just provide the user with a unique ID, and check online as to what capabilities that ID should have, and cache it for some period. All the same caveats apply though - people can get round anything like this.

Consider also the support costs of having to deal with users who have forgotten their key, etc.

edit: I just want to add, don't invest too much time in this or think that somehow your convoluted scheme will be different and uncrackable. It won't, and cannot be as long as people control the hardware and OS your program runs on. Developers have been trying to come up with ever more complex schemes for this, thinking that if they develop their own system for it then it will be known only to them and therefore 'more secure'. But it really is the programming equivalent of trying to build a perpetual motion machine. :-)





stackoverflow [ ^ ]



许可密钥生成 [ ^ ]



http://stackoverflow.com/a/599853 [ ^ ]



stackoverflow[^]

License Key Generation[^]

http://stackoverflow.com/a/599853[^]


阅读此链接的最后评论

HTTP: //social.msdn.microsoft.com/Forums/vstudio/en-US/5e1d14bc-a268-4296-9b45-8fe5f62988d5/how-do-i-change-license-key-for-visual-st udio-2010-it-comes-prepidded [ ^ ]
Read the last comment of this link
http://social.msdn.microsoft.com/Forums/vstudio/en-US/5e1d14bc-a268-4296-9b45-8fe5f62988d5/how-do-i-change-license-key-for-visual-studio-2010-it-comes-prepidded[^]

这篇关于如何为C#Windows应用程序设置许可证密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆