介绍:

过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建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 !的更多相关文章

  1. net license tool, EasyLicense !

    net license tool, EasyLicense ! 开源 .net license tool, EasyLicense !   介绍: 过去我常常像是否有一个帮助授权的软件,它可以非常简单 ...

  2. tl;drLegal ——开源软件license的搜索引擎

    TLDRLegal - Open Source Licenses Explained in Plain English可以很方便查询各个开源license的总结(能做什么,不能做什么),还能比较不同的 ...

  3. 开源软件License汇总

    用到的open source code越多,遇到的开源License协议就越多.License是软件的授权许可,里面详尽表述了你获得代码后拥有的权利,可以对别人的作品进行何种操作,何种操作又是被禁止的 ...

  4. 开源 ≠ 免费,开源协议License详解

    凡是做过软件开发的,都会接触到开源软件或开源组件,它们都会基于某种协议来提供源码和授权,那么这些开源协议到底有哪些约束呢? 在介绍之前,必须告诉大家,针对开源协议,必须打消“开源 = 免费”这个念头, ...

  5. 高手速成android开源项目【tool篇】

    主要包括那些不错的开发库,包括依赖注入框架.图片缓存.网络相关.数据库ORM建模.Android公共库.Android 高版本向低版本兼容.多媒体相关及其他. 一.依赖注入DI 通过依赖注入减少Vie ...

  6. 各种开源许可 license 区别

    copy from http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html

  7. 开源代码License

    参考:https://mp.weixin.qq.com/s/Q29NGDIbyCwm6KiAKqI46A

  8. 一张图让你看懂各开源License[转]

    你是否遇到过开源License,精炼而又晦涩的文字通常要读半天才能理解,而且大多数License差别不大,容易混淆.下面这张图让你段时间迅速掌握各种开源的License. 图片来源:阮一峰的博客. f ...

  9. 用ChooseALicense帮自己选一个开源license,然后用AddALicense给自己的github自动加上license文件

    在我之前的一篇博客里面介绍过tl;drLegal ——开源软件license的搜索引擎,可以很方便的查询各种license,并且给出了很简洁的解释.今天又发现了另外一个帮助你选择你的开源软件licen ...

随机推荐

  1. C语言中,隐藏结构体的细节

    我们都知道,在C语言中,结构体中的字段都是可以访问的.或者说,在C++ 中,类和结构体的主要区别就是类中成员变量默认为private,而结构体中默认为public.结构体的这一个特性,导致结构体中封装 ...

  2. Spring Mvc 用Demo去学习

    1:首先大体知道 SpringMVC 框架的 运行原理(图片来自网络 ) 2:SpringMVC 是依照DispatcherServlet 展开的 这里可以约Structs2对比,structs2 是 ...

  3. 使用python遍历指定城市的一周气温

    处于兴趣,写了一个遍历指定城市五天内的天气预报,并转为华氏度显示.把城市名字写到一个列表里这样可以方便的添加城市.并附有详细注释 1 import requests import json#定义一个函 ...

  4. 每天一个Linux命令—— WC

    一.首先看一下帮助 Usage: wc [OPTION]... [FILE]...  or:  wc [OPTION]... --files0-from=F Print newline, word, ...

  5. elasticsearch系列(五)score

    概述 score在ES中有着很重要的作用,有了它才有了rank,是验证文档相关性的关键数据,score越大代表匹配到的文档相关性越大 官方解释 查询的时候可以用explain来展示score的计算过程 ...

  6. c++ const char *[] or char [][]

    ]={"hello","world"}; ]={"hello"};char (*ch3)[6]= ch1; std::cout<< ...

  7. Python 操作 Azure Blob Storage

    笔者在<Azure 基础:Blob Storage>一文中介绍了 Azure Blob Storage 的基本概念,并通过 C# 代码展示了如何进行基本的操作.最近笔者需要在 Linux ...

  8. 玩转nodeJS系列:使用cluster创建nodejs单机多核集群(多进程)

    前言: nodejs提供了cluster集群(支持端口共享的多进程),cluster基于child_process,process二次封装,方便我们使用该功能实现单机nodejs的web集群. 1.c ...

  9. 微信小程序开发 -- 02

    微信小程序开发 --02 微信小程序在开发中,难度系数不是很大,其中应用的技术也是web开发中常用的技术,虽然在微信开发者工具中的叫法与常见的web开发的叫法不太一样. 首先,在微信小程序开发中,代码 ...

  10. vue动画的用法

    vue动画 在vue.js中有两种写动画的方法,第一种就是像js里一样,用原生代码来实现,第二种则是使用animate.css的动画类文件,这个动画类和bootstrap.css文件类似,直接调用类就 ...