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 ...
随机推荐
- Nginx SSL TLS部署最佳实践
本文介绍nginx在提供HTTPS时使用的一些其他配置选项. 虽然这些功能有助于优化nginx的SSL和TLS,但这不是一个完整对加固nginx的介绍. 确保您的服务器安全的最佳方法是不仅需要正确的配 ...
- P1056 排座椅
非原创 #include<bits/stdc++.h>using namespace std;int t1[2009];int t2[2009]; int findmax(int *a){ ...
- 如何使用openscad绘制一个简单的键帽.
1 新建空项目 2测数据 测量得出数据.这个长方体的长宽高分别是1.6.4.6.8 注意,这三个数据并不是测量得到的数据,而且加了一点公差值(为3D打印做准备) 3画图 写代码 导入模型 为了方便以后 ...
- secp256k1如何使用
https://npm.taobao.org/package/secp256k1 这个即椭圆曲线加密算法算法,随机生成一个私钥然后通过椭圆曲线加密算法算法(ECC)得到一个公钥,且无法反向 然后再使用 ...
- xpath 的使用
如需转发,请注明出处:小婷儿的python https://www.cnblogs.com/xxtalhr/p/10520271.html 有问题请在博客下留言或加作者微信:tinghai87605 ...
- AI 矩阵求导
矩阵求导 参考链接: https://en.wikipedia.org/wiki/Matrix_calculus#Scalar-by-vector_identities
- JavaScript设计模式 - 策略模式(表单验证)
表单提交的时候,总是要校验,不同的表单可能校验相同的功能. 为了避免代码重复的复制黏贴,使用策略模式,写出来的代码赏心悦目,且可扩展,还可以作为插件到处使用 <!DOCTYPE html> ...
- C#连接数据库插入数据
首先是安装JDBC操作数据库的包,,当然自己看着办哈,可以自己下载以后导入,或者直接让软件本身下载 第一种方式 第二种 咱自己下载个低版本的 点击这个链接 点击以后呢可以直接下载下来,然后导入(大家百 ...
- 从github checkout子文件夹
1.将远程项目加载到指定目录:$git init; $git remote add -f origin url2.使用SparseCheckout模式:$git config core.sparsec ...
- Luogu P3768 简单的数学题
非常恶心的一道数学题,推式子推到吐血. 光是\(\gcd\)求和我还是会的,但是多了个\(ij\)是什么鬼东西. \[\sum_{i=1}^n\sum_{j=1}^nij\gcd(i,j)=\sum_ ...