开源 .net license tool, EasyLicense !
介绍:
过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建license,并且非常容易的验证license。
这是一个非常普通和公共的功能,但是我没有找到合适的开源软件,大部分开源软件都比较复杂,并且有太多我不需要的功能。
所以我创建了这个项目,希望可以让授权的流程变的简单。
使用代码:
Easy License 非常容易使用,为了验证一个软件,你需要下面3个步骤。
1: Create a public/private Key.
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
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
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 !
net license tool, EasyLicense ! 开源 .net license tool, EasyLicense ! 介绍: 过去我常常像是否有一个帮助授权的软件,它可以非常简单 ...
- tl;drLegal ——开源软件license的搜索引擎
TLDRLegal - Open Source Licenses Explained in Plain English可以很方便查询各个开源license的总结(能做什么,不能做什么),还能比较不同的 ...
- 开源软件License汇总
用到的open source code越多,遇到的开源License协议就越多.License是软件的授权许可,里面详尽表述了你获得代码后拥有的权利,可以对别人的作品进行何种操作,何种操作又是被禁止的 ...
- 开源 ≠ 免费,开源协议License详解
凡是做过软件开发的,都会接触到开源软件或开源组件,它们都会基于某种协议来提供源码和授权,那么这些开源协议到底有哪些约束呢? 在介绍之前,必须告诉大家,针对开源协议,必须打消“开源 = 免费”这个念头, ...
- 高手速成android开源项目【tool篇】
主要包括那些不错的开发库,包括依赖注入框架.图片缓存.网络相关.数据库ORM建模.Android公共库.Android 高版本向低版本兼容.多媒体相关及其他. 一.依赖注入DI 通过依赖注入减少Vie ...
- 各种开源许可 license 区别
copy from http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html
- 开源代码License
参考:https://mp.weixin.qq.com/s/Q29NGDIbyCwm6KiAKqI46A
- 一张图让你看懂各开源License[转]
你是否遇到过开源License,精炼而又晦涩的文字通常要读半天才能理解,而且大多数License差别不大,容易混淆.下面这张图让你段时间迅速掌握各种开源的License. 图片来源:阮一峰的博客. f ...
- 用ChooseALicense帮自己选一个开源license,然后用AddALicense给自己的github自动加上license文件
在我之前的一篇博客里面介绍过tl;drLegal ——开源软件license的搜索引擎,可以很方便的查询各种license,并且给出了很简洁的解释.今天又发现了另外一个帮助你选择你的开源软件licen ...
随机推荐
- Promise简介
Promise是ES6中的函数,规范了如何处理异步任务的回调函数,功能类似于jQuery的defferred.简单说就是通过promise对象的不同状态调用不同的回调函数.目前IE8及以下不支持,其他 ...
- [编织消息框架][netty源码分析]2 eventLoop
eventLoop从命名上看是专门处理事件 事件系统主要由线程池同队列技术组成,有以下几个优点 1.任务出队有序执行,不会出现错乱,当然前提执行线程池只有一个 2.解偶系统复杂度,这是个经典的生产者/ ...
- MPP 一、Greenplum 集群安装
Installating and Initializing a Greenplum Database System... 1 安装说明 1.1 环境说明 名称 版本 下载地址 虚拟机 Oracle V ...
- Centos7 最小系统安装Redis
最近想写一个调度系统,一顿查资料之后决定用Django+Celery+Redis实现,前面两个都已经有了,就缺一个Redis,所以准备安装一个Redis 获取Centos7并配置网络 获取Centos ...
- python爬虫从入门到放弃(七)之 PyQuery库的使用
PyQuery库也是一个非常强大又灵活的网页解析库,如果你有前端开发经验的,都应该接触过jQuery,那么PyQuery就是你非常绝佳的选择,PyQuery 是 Python 仿照 jQuery 的严 ...
- 拥抱Node.js 8.0,N-API入门极简例子
本文摘录自<Nodejs学习笔记>,更多章节及更新,请访问 github主页地址.欢迎加群交流,群号 197339705. N-API简介 Node.js 8.0 在2017年6月份发布, ...
- 2.Node.js access_token的获取、存储及更新
文章目录: 1.Node.js 接入微信公众平台开发 2.Node.js access_token的获取.存储及更新 一.写在前面的话 上一篇文章中,我们使用 No ...
- jquery each 遍历
在jquery中,遍历对象和数组,经常会用到$().each和$.each(),两个方法. $().each 在dom处理上面用的较多.如果页面有多个input标签类型为checkbox,对于这时用$ ...
- python-广度优先搜索
广度优先搜索 下面我们来来BFS算法策略: 比如:我们要从双子峰---->金门大桥,最短路径如何? 我们利用广度优先搜索来一步步求解,注意广度优先搜索在于的关键在于"广",也 ...
- NLTK学习笔记(一):语言处理和Python
目录 [TOC] nltk资料下载 import nltk nltk.download() 其中,download() 参数默认是all,可以在脚本里面加上nltk.download(需要的资料库) ...