如何许可我的C#应用​​程序 [英] How to license my c# application

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

问题描述

可能重复:结果
许可证C#桌面应用程序

我要我的程序锁之后试用了一些天,如果用户购买了许可证,可以用好几个月的节目。

I want to make my program lock after some days of trial use and if a user purchase a license, can use the program for some months.

我不知道的方式做到这一点。一个想法是让本地临时密钥安装程序时,并通过了天后锁定(这里的问题是,用户可以改变他的计算机的日期和时间。该计划的理念是在网上使用,离线,所以我不能从我的服务器到计算机)比较日期。

I dont know a way to do this. An idea is to make a local temp key when the program is installed, and lock it after the days passed(the problem here is that user can change date and time of his computer.. the philosophy of the program is to be used online and offline, so i cant compare dates from my server to the computer).

和其他的事情是,如何使许可证服务。我可以生成大量的串行键,然后当用户付费,我可以给他一个串口,每次节目开始,我可以检查串口是在我的web服务。

And the other thing is, how to make a license service. I can generate lots of serial keys and then when a user pays i can give him a serial, and every time the program starts i can check if the serial is in my web service.

我在一个良好的道路?有什么建议?

Am i in a good road?? Any suggestions?

推荐答案

如果该应用程序是用C#和你想要写您自己的授权功能,您首先需要混淆可执行它部署之前。这是为了阻止人们用反汇编器读你的CIL代码(存储在.EXE)。

If this application is written in C# and you want to write your own licencing functionality, you will first need to obfuscate the executable before it is deployed. This is to stop people reading your CIL code (stored in the .exe) with a disassembler.

许可您将要选择的加密方法的软件。对于这样的加密的对称方法基本上等同于一个不对称方法(如你必须提供在任何情况下的键)。加密方法可以用

To licence the software you will want to choose an encryption method. For such encryption a symmetric method is essentially equivalent to an asymmetric method (as you have to provide the key in any case). The encryption method can be chosen using

public enum EncryptionAlgorithm { Des = 1, Rc2, Rijndael, TripleDes }; 

有关每种方法及其详细信息,请参见维基百科。的Rijndael加密算法已被设计来替换老化DES算法。 DES一样,它是一种分组密码。它采用128位,192位和256位密钥,是一个不错的选择。下面我会假设你将不会被存储在代码(硬编码)的加密密钥,但在一个单独的文件(产品密钥),它供给;所以你将提供两个许可证文件的产品密钥,使解密和加密的许可文件。

for each of the methods and their details, see Wikipedia. The Rijndael encryption algorithm has been designed to replace the aging DES algorithm. Like DES, it is a block cipher. It uses 128-bit, 192-bit or 256-bit keys and is a good choice. In the following I will assume that you will not be storing the encryption key in the code (hard coded) but supply it in a separate file (a ‘product key’); so you will supply two licence files the product key to enable decryption and the encrypted licence file.

一旦你选择了一种加密方法,它是常见的,地方要拿出一个散列算法,或对产品密钥/初始向量工作(IV);你把(例如)128位密钥,并使用一些方法/变换争夺它。键(即随机/伪随机地为每个用户生成部署软件)随后用于生成四。

Once you have chosen an encryption method, it is common-place to come up with a hash or algorithm to work on the product key/initialisation vector (IV); you take a 128-bit key (for example) and scramble it using some method/transform. The key (that is randomly/pseudo-randomly generated for each user you deploy the software to) is then used to generate the IV.

您再使用随机键,IV和所选择的加密方法来加密一些许可证文本(包括许可日期)。

You then use the 'random' key, the IV and the selected encryption method to encrypt some licence text (that includes licence dates).

internal ICryptoTransform GetCryptoServiceProvider(byte[] bK, byte[] iVec){ ... }

要使用你的方法,你基本上是执行相反过程,解密文件。有一点要注意的授权,是你不应该花太多时间担心人们破解软件。使它很难使用类似上述的方法,但不要投入太多的时间来了一个不断日益复杂的方法,因为如果一些(诚然非常有才华)黑客想要破解你的代码,很可能他会的。此外,你必须假定用户将不会违反法律和共享许可文件!对使用外部公司来经营你的代码的授权,我不能从经验中评(我总是写我自己),但它很可能是一个昂贵的选择。

To decrypt the file using your method you essentially perform the reverse process. One thing to note about licencing, is that you should not spend too much time worrying about people cracking the software. Make it very hard using a method like the above, but don't invest too much time coming up with an ever increasingly complex methodology because if some (admittedly very talented) hacker wants to crack your code it is likely he will. Moreover, you have to assume the user will not break the law and share licence files! I cannot comment from experience on using an external company to run the licencing of your code (I have always written my own), however it is likely to be an expensive option.

我希望这是有一定的帮助。

I hope this is of some help.

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

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