开源 .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 ...
随机推荐
- 高效工作的秘诀——Doit.im使用总结报告
从上次购买doit.im pro账户到现在已经快一年了,从摸索到现在的熟悉,目前这款软件已经成为我工作生活中最为重要的效率工具,在此之前也用过很多软件进行时间管理,综合起来评价,doit应该算是最棒的 ...
- Word Ladder II 2015年6月4日
Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from ...
- 关于RFID2.4G 标签卡最新方案
它是一款针对RFID有源卡行业设计的,是一款单向的2.4G频段RF射频芯片,目前主要针对低功耗的校讯通, 2.4G停车场,电动车防盗, 闪光灯设备(引闪器) ,智能家居等领域.SI24R2E 同样与S ...
- MPP 一、Greenplum 集群安装
Installating and Initializing a Greenplum Database System... 1 安装说明 1.1 环境说明 名称 版本 下载地址 虚拟机 Oracle V ...
- 10分钟学会JAVA注解(annotation)
(原) 先认识注解(Annotation) 定义类用class,定义接口用interface,定义注解用@interface 如public @interface AnnotationTest{} 所 ...
- iphone手机中对于html和css的一些特殊处理
1.iphone safari iso系统不兼容:hover的解决办法: 方法一: a:hover设置的样式在IOS系统的浏览器内显示不出来,看来是IOS系统的移动设备中,需要在按钮元素或者是body ...
- VR全景智慧城市—你的掌上步行街
"春风十里,不如有你",不知不觉间,身边的人已对VR不再陌生,VR眼镜的热销,VR体验店的火爆,VR游戏的向往等等.可见VR就是为生活而诞生! 2015年被称作VR行业的产业元年, ...
- mailto调用本地默认客户端发邮件
下面介绍如何利用 Mailto功能: 实现 Mailto的基本html代码: <a href="mailto:123@qq.com">点击这里发邮件!</a> ...
- JavaBean自动生成get和set方法
用Myeclipse开发java web程序,写javabean的时候,如果字段很多的话,写get和set方法是一件很无语和浪费时间的事情,所以Myeclipse提供了一个自动生成这些方法的功能. ...
- 关于QT5使用QtScript解析QJsonArray数组的问题
首先得在pro文件中加入QT+=script 然后导入相应的头文件 include <QStringList> #include <QtScript/QScriptEngine> ...