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 ...
随机推荐
- web自动化--如何在不同页面间游刃有余
大家都知道,selenium中对页面元素的操作都是基于当前页面进行操作的,有时会有这种情况,在这个页面操作完一个步骤后,要去另一个页面查看,这就涉及到页面间的操作 # -*- coding:utf-8 ...
- 求助pycharm里import pandas遇到No module named pandas怎么办
目测是安转pandas库之后pycharm对库的检索没有更新.(能理解意思就行,我也是小白,不会专业术语,刚巧我也遇到了这样的问题所以来回答)我当时解决这个问题也算是瞎猫遇见死耗子. & ...
- P1056 排座椅
非原创 #include<bits/stdc++.h>using namespace std;int t1[2009];int t2[2009]; int findmax(int *a){ ...
- Django 使用mysql 数据库流程
创建一个mysql数据库 在settings中配置: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': ...
- UVA506-System Dependencies(拓扑序)
Problem UVA506-System Dependencies Accept:285 Submit:2824 Time Limit: 3000 mSec Problem Description ...
- metamask源码学习-controller-transaction
()metamask-extension/app/scripts/controllers/transactions Transaction Controller is an aggregate of ...
- 内存大厂威刚发布速度高达550MB/s的固态硬盘SU750
近日,内存大厂ADATA(威刚)宣布推出两款1款全新的固态硬盘——SU750. SU750是一款传统的2.5英寸SSD,采用了新一代TLC 3D NAND闪存,官方表示借助SLC缓存,其最高存取速度可 ...
- 深入浅出的webpack4构建工具--webpack4+react构建环境(二十)
下面我们来配置下webpack4+react的开发环境,之前都是针对webpack4+vue的.下面我们也是在之前项目结构的基础之上进行配置下. 首先看下如下是我为 webpack4+react 基本 ...
- PAT A1121 Damn Single (25 分)——set遍历
"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are suppo ...
- VS2017 安装visualSVN 6.1.1 for visual studio 2017
1.官网下载地址:https://www.visualsvn.com/visualsvn/download/ 2.安装