net license tool, EasyLicense !

开源 .net license tool, EasyLicense !

 

介绍:

过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建license,并且非常容易的验证license。

这是一个非常普通和公共的功能,但是我没有找到合适的开源软件,大部分开源软件都比较复杂,并且有太多我不需要的功能。

所以我创建了这个项目,希望可以让授权的流程变的简单。

使用代码:

Easy License 非常容易使用,为了验证一个软件,你需要下面3个步骤。

1: Create a public/private Key.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if (File.Exists("privateKey.xml") || File.Exists("publicKey.xml"))
            {
                var result = MessageBox.Show("The key is existed, override it?""Warning", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }
 
            var privateKey = "";
            var publicKey = "";
            LicenseGenerator.GenerateLicenseKey(out privateKey, out publicKey);
 
            File.WriteAllText("privateKey.xml", privateKey);
            File.WriteAllText("publicKey.xml", publicKey);
 
            MessageBox.Show("The Key is created, please backup it.");

  

2:  Use private key to create a license

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if (!File.Exists("privateKey.xml"))
            {
                MessageBox.Show("Please create a license key first");
                return;
            }
  
            var privateKey = File.ReadAllText(@"privateKey.xml");
            var generator = new LicenseGenerator(privateKey);
  
            var dictionary = new Dictionary<stringstring>();
  
            // generate the license
            var license = generator.Generate("EasyLicense", Guid.NewGuid(), DateTime.UtcNow.AddYears(1), dictionary,
                LicenseType.Standard);
             
            txtLicense.Text = license;
            File.WriteAllText("license.lic", license);

  

3:  Use public key to validate the license

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
private static void ValidateLicense()
        {
            if (!File.Exists("publicKey.xml"))
            {
                MessageBox.Show("Please create a license key first");
                return;
            }
             
            var publicKey = File.ReadAllText(@"publicKey.xml");
  
            var validator = new LicenseValidator(publicKey, @"license.lic");
  
            try
            {
                validator.AssertValidLicense();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        

  

EasyLicense 内部有一个叫 LicenseTool 的工具,你可以下载源代码,运行,来看看它是怎样的创建Key,创建Licens 和验证License 的。

并且系统还有一个Demo 的项目,可以帮助你。

Git, 请帮忙加个star 吧。

https://github.com/EasyHelper/EasyLicense

http://git.oschina.net/EasyHelper/EasyLicense

 
 
作者:LoveJenny

net license tool, EasyLicense !的更多相关文章

  1. 开源 .net license tool, EasyLicense !

    介绍: 过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建license,并且非常容易的验证license. 这是一个非常普通和公共的功能,但是我没有找到合适的开源软件,大部分开源软件都比较复 ...

  2. 记一次【模拟点击】,WinForm小软件开发过程

    前言 年初四月份的时候,有朋友找到我,说想开发一个模拟点击的软件.最终软件做完后,发现效果不理想.唯一开发的我是认为最好是放弃了,做运营的他,坚持说这个没问题,说是改变合作方式.最终也是不了了之了. ...

  3. 处理smartgit 过期脚本

    @echo off @title SmartGit License Tool color 1f cls set "version=18.1" set "fpath=%AP ...

  4. OpenACC Hello World

    ▶ 在 windows 10 上搭建 OpenACC 环境,挺麻烦 ● 安装顺序:Visual Studio 2015(PGI 编译器不支持 Visual Studio 2017):CUDA Tool ...

  5. Falcon Genome Assembly Tool Kit Manual

    Falcon Falcon: a set of tools for fast aligning long reads for consensus and assembly The Falcon too ...

  6. iPerf - The network bandwidth measurement tool

    What is iPerf / iPerf3 ? iPerf3 is a tool for active measurements of the maximum achievable bandwidt ...

  7. Go as continuous delivery tool for .NET

    http://simon-says-architecture.com/2014/02/28/go-as-continuous-delivery-tool-for-net/ Following my p ...

  8. Airbnb/Apache Superset – the open source dashboards and visualization tool – first impressions and link to a demo

    https://assemblinganalytics.com/post/airbnbapache-superset-first-impressions-and-link-to-a-demo/ Tod ...

  9. Auzone AT60 TPMS Tool Update & Authorization Service: FREE

    This is a tutorial with step-of-step explanation of Auzone AT60 TPMS Tool Update & Authorization ...

随机推荐

  1. mac下更改Jupyter notebook工作目录

    Jupyter notebook运行之后,默认的工作目录在mac下是个人文件夹,在windows下貌似也是如此.显然不太合理,需要修改它. 具体办法是: 进入终端命令行模式,输入下面的代码: jupy ...

  2. Java没有头文件的原因

    http://bbs.csdn.net/topics/100134244 C/C++ 之所以需要头文件(.h),有两个用处,一个是在开发编译的时候,在各个编译单元(Compile Unit)之间共享同 ...

  3. java mysql的latin1转UTF-8

    public String convertCharset(String s) { if (s != null) { try { int length = s.length(); byte[] buff ...

  4. 【Codeforces Round 1120】Technocup 2019 Final Round (Div. 1)

    Codeforces Round 1120 这场比赛做了\(A\).\(C\)两题,排名\(73\). \(A\)题其实过的有点莫名其妙...就是我感觉好像能找到一个反例(现在发现我的算法是对的... ...

  5. oa tomcat 代码处理跨域问题

    meta标签处理http.https跨域 <!-- 将http请求转成https请求 --> <meta http-equiv="Content-Security-Poli ...

  6. curl NSS error -8179 (SEC_ERROR_UNKNOWN_ISSUER)

    尝试分析 首先根据提示,我判断是CA证书过期.于是对证书进行了更新 update-ca-trust 但是依然没有解决问题.之后,尝试了很多方法后,重新回来想想,为什么不适用curl -v来获取更多信息 ...

  7. SkylineGlobe 6.5 如何实现简单多边形的动态绘制 C#示例代码

    在Skyline的TEPro软件中,我们可以很容易地绘制出多边形. 那么,在二次开发过程中,该如何绘制一个简单的多边形呢? 通过下面的示例代码,我们可以很容易完成这一项工作. 其中,重点需要了解Geo ...

  8. 随机指定范围内N个不重复的数

    此为工具类,支持抽奖业务需求,具体实现见下方代码: package com.org.test; import java.util.ArrayList; import java.util.List; p ...

  9. NowCoder110E Pocky游戏 状压DP

    传送门 题意:给出$N$个数和一个长为$M$.所有数在$[1,N]$范围之内的正整数序列$a_i$,求出这$N$个数的一种排列$p_1...p_N$使得$\sum\limits_{i=2}^M |p_ ...

  10. PV和并发、以及计算web服务器的数量的方法

    几个概念 网站流量是指网站的访问量,用来描述访问网站的用户数量以及用户所浏览的网页数量等指标,常用的统计指标包括网站的独立用户数量.总用户数量(含重复访问者).网页浏览数量.每个用户的页面浏览数量.用 ...