介绍:

过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建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. jQuery之筛选操作

    jQuery之筛选操作 筛选操作分三大类:过滤,查找,串联 eq(),first(),last(),hasClass(),filter(),is() html代码 jQuery代码 效果如下: map ...

  2. jQuery.validate表单校验+bootstrap

    谈谈表单校验 这大概是一种惯例,学习前台后台最开始接触的业务都是用户注册和登录.现在社会坚持以人为本的理念,在网站开发过程同样如此.User是我们面对较多的对象,也是较核心的对象.最开始的用户注册和登 ...

  3. JSON的使用小结

    JSON中存储的是key:value,其实在编程的时候我们会遇到很多都是key:value的形式.比如:map,java对象(一个对象的一个属性只会有一个值),数据库中key:value对应着里面存储 ...

  4. Ultimus BPM 房地产与建筑行业应用解决方案

    Ultimus BPM 房地产与建筑行业应用解决方案 行业应用需求 房地产与建筑行业客户业务特点是集团化管控,多区域.多项目.多业态管理,而行业业务往往项目周期长,涉及专业复杂,客户越来越重视管理和跟 ...

  5. 关于JS的页面跳转

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  6. 面试(4)-spring-Spring面试题和答案

    1:69道Spring面试题和答案 转自:http://ifeve.com/spring-interview-questions-and-answers/ 目录 Spring 概述 依赖注入 Spri ...

  7. iOS-swift-基础篇1

    一.swift是啥?答:百度. 二.swift基础知识. 1.输出函数:print print("Hello, world!") 2.简单数据类型 变量声明:var 常量声明:le ...

  8. Java集合类从属关系

    Java的集合分为了四类:List Set Queue Map,每类都有不同的实现,有基于数组实现的,有基于链表实现的,有基于xx树实现的,不同的实现虽在功能上可以相互替代但都有各自的应用场景,如基于 ...

  9. Fitting Bayesian Linear Mixed Models for continuous and binary data using Stan: A quick tutorial

    I want to give a quick tutorial on fitting Linear Mixed Models (hierarchical models) with a full var ...

  10. 543. Diameter of Binary Tree

    https://leetcode.com/problems/diameter-of-binary-tree/#/description Given a binary tree, you need to ...