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 ...
随机推荐
- 转://SQL PROFILE
我们经常会碰到一些线上的SQL问题,因为执行计划不对,可能需要添加HINT才能解决.但是添加HINT就意味着需要修改应用代码.一般一个应用代码的修改.测试及发布,可能需要两三个工作日才可完成.咱们数据 ...
- 深入理解Java中的final关键字(转)
文章转自http://www.importnew.com/7553.html Java中的final关键字非常重要,它可以应用于类.方法以及变量.这篇文章中我将带你看看什么是final关键字?将变量, ...
- 201904:Action recognition based on 2D skeletons extracted from RGB videos
论文标题:Action recognition based on 2D skeletons extracted from RGB videos 发表时间:02 April 2019 解决问题/主要思想 ...
- Java并发(三)线程池原理
Java中的线程池是运用场景最多的并发框架,几乎所有需要异步或并发执行任务的程序都可以使用线程池.在开发过程中,合理地使用线程池能够带来3个好处. 1. 降低资源消耗.通过重复利用已创建的线程降低线程 ...
- QT数据类型的转化总结
QT 中的数据类型有很多的,在写代码的过程中难免会遇到 数据类型的转换. 1.QString转QByteArray QByteArray byte;QString string;byte = stri ...
- Android学习之基础知识十六 — Android开发高级技巧的掌握
一.全局获取Context的技巧 前面我们很多地方都使用到了Context,弹出Toast的时候.启动活动的时候.发送广播的时候.操作数据库的时候.使用通知的时候等等.或许目前来说我们并没有为得不到C ...
- Skyline从5.1升级版本到6.5的常见接口变化问题
1.原来Route对象升级成Presentation对象后,激活方法的变化: 原来5.1版本示例代码: function flyto(thisa) { var thisid = thisa.id; v ...
- sql语句,查询昨天的数据
如果在程序中,有前台传来两个时间点:beginTime和endTime,在sql查询中的限制条件就是查询昨天的数据,那么可以这样写: 但是如果在这里要查询昨天的数据的话, 则不能简单地在开始时间的那里 ...
- SequenceFile文件
SequenceFile文件是Hadoop用来存储二进制形式的key-value对而设计的一种平面文件(Flat File).目前,也有不少人在该文件的基础之上提出了一些HDFS中小文件存储的解决方案 ...
- 4358: permu
4358: permu 链接 分析: 不删除的莫队+可撤销的并查集. 每次询问先固定左端点到一个块内,然后将这些右端点从小到大排序,然后询问的过程中,右端点不断往右走,左端点可能会撤销,但是移动区间不 ...