net license tool, EasyLicense !
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<string, string>(); // 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
net license tool, EasyLicense !的更多相关文章
- 开源 .net license tool, EasyLicense !
介绍: 过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建license,并且非常容易的验证license. 这是一个非常普通和公共的功能,但是我没有找到合适的开源软件,大部分开源软件都比较复 ...
- 记一次【模拟点击】,WinForm小软件开发过程
前言 年初四月份的时候,有朋友找到我,说想开发一个模拟点击的软件.最终软件做完后,发现效果不理想.唯一开发的我是认为最好是放弃了,做运营的他,坚持说这个没问题,说是改变合作方式.最终也是不了了之了. ...
- 处理smartgit 过期脚本
@echo off @title SmartGit License Tool color 1f cls set "version=18.1" set "fpath=%AP ...
- OpenACC Hello World
▶ 在 windows 10 上搭建 OpenACC 环境,挺麻烦 ● 安装顺序:Visual Studio 2015(PGI 编译器不支持 Visual Studio 2017):CUDA Tool ...
- Falcon Genome Assembly Tool Kit Manual
Falcon Falcon: a set of tools for fast aligning long reads for consensus and assembly The Falcon too ...
- iPerf - The network bandwidth measurement tool
What is iPerf / iPerf3 ? iPerf3 is a tool for active measurements of the maximum achievable bandwidt ...
- 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 ...
- 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 ...
- Auzone AT60 TPMS Tool Update & Authorization Service: FREE
This is a tutorial with step-of-step explanation of Auzone AT60 TPMS Tool Update & Authorization ...
随机推荐
- bootstrap-datepicker default value
$('.selectDate').datepicker({ format : "yyyy/mm/dd", autoclose : true, startDate : new Dat ...
- Highcharts属性与Y轴数据值刻度显示Y轴最小最大值
Highcharts 官网:https://www.hcharts.cn/demo/highcharts Highcharts API文档:https://api.hcharts.cn/highcha ...
- Flex布局新写法兼容写法详解
很久之前用过flex,但是没有考虑过兼容性问题,为了兼容ios一定要加上-webkit前缀: ul{ display: flex; /* 新版本语法: Opera 12.1, Firefox 22+ ...
- Git解决冲突(本地共享仓库简单实践)
1:可以使用git init --bare初始化一个本地共享仓库. 2:假设有A,B两个人进行合作开发,此时A,B可以使用git clone 共享仓库路径进行克隆.此时A,B的室友仓库代码是一致的. ...
- sql server 压缩备份数据库
转自 https://www.cnblogs.com/527289276qq/p/6273291.html 今天需要把一个省外项目的数据库从服务器上备份.拷贝到本机(跨地域传输数据库备份文件). 连上 ...
- 对原型(prototype)理解?
Javascript是一种通过原型实现继承的语言,与别的高级语言是有区别的,像Java,C#是通过类型决定继承关系的,JavaScript是的动态的弱类型语言,总之可以认为JavaScript所有都是 ...
- day14 Python函数
函数def,严格来讲有个return返回值 过程就是没有return返回值的函数 #过程 def test01(): msg = 'liuhaoran' print(msg) #函数 def test ...
- ssh linux免密登录。。。。生产共钥到另一台主机
一.第一种方式: 1.ssh-keygen -t rsa -t : 加密方式 默认为rsa 可以省略不写 加密方式选 rsa|dsa 2.将 .pub 文件复制到目标机器的 .ssh 目录, 并 ca ...
- mysql对String类型的数字值排序
一.需求:根据月份分组,然后再根据月份排序 效果图 sql如下: SELECT ) number, date_format(created_at,'%c') date FROM ********* W ...
- 安装win10操作系统的设备将要突破10亿台
导读 该公司最初的目标是在发布后的三年内在 10 亿台设备上运行 Windows 10. 据微软高管梅赫迪 (Yusuf Mehdi) 周四在 Twitter 上透露,目前已经有 8 亿多台设备安装了 ...