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<stringstring>();
  
            // 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

 
 
作者:LoveJenny

net license tool, EasyLicense !的更多相关文章

  1. 开源 .net license tool, EasyLicense !

    介绍: 过去我常常像是否有一个帮助授权的软件,它可以非常简单的创建license,并且非常容易的验证license. 这是一个非常普通和公共的功能,但是我没有找到合适的开源软件,大部分开源软件都比较复 ...

  2. 记一次【模拟点击】,WinForm小软件开发过程

    前言 年初四月份的时候,有朋友找到我,说想开发一个模拟点击的软件.最终软件做完后,发现效果不理想.唯一开发的我是认为最好是放弃了,做运营的他,坚持说这个没问题,说是改变合作方式.最终也是不了了之了. ...

  3. 处理smartgit 过期脚本

    @echo off @title SmartGit License Tool color 1f cls set "version=18.1" set "fpath=%AP ...

  4. OpenACC Hello World

    ▶ 在 windows 10 上搭建 OpenACC 环境,挺麻烦 ● 安装顺序:Visual Studio 2015(PGI 编译器不支持 Visual Studio 2017):CUDA Tool ...

  5. Falcon Genome Assembly Tool Kit Manual

    Falcon Falcon: a set of tools for fast aligning long reads for consensus and assembly The Falcon too ...

  6. iPerf - The network bandwidth measurement tool

    What is iPerf / iPerf3 ? iPerf3 is a tool for active measurements of the maximum achievable bandwidt ...

  7. 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 ...

  8. 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 ...

  9. Auzone AT60 TPMS Tool Update & Authorization Service: FREE

    This is a tutorial with step-of-step explanation of Auzone AT60 TPMS Tool Update & Authorization ...

随机推荐

  1. web笔试

    类型判断用到哪些方法? typeof和instanceof 值类型和引用类型的区别? 根据 JavaScript中的变量类型传递方式,又分为值类型和引用类型,在参数传递方式上,值类型是按值传递,引用类 ...

  2. centos7下安装docker(9.3容器对资源的使用限制-Block IO))

    Block IO:指的是磁盘的读写,docker 可以通过设置权重,限制bps和iops的方式控制容器读写磁盘的带宽 注:目前block IO限额只对direct IO(不使用文件缓存)有效. 1.B ...

  3. MongoDB基础教程系列--目录结构

    最近对 MongoDB 产生兴趣,在网上找的大部分都是 2.X 版本,由于 2.X 与 3.X 差别还是很大的,所以自己参考官网,写了本系列.MongoDB 的知识还是很多的,本系列会持续更新,本文作 ...

  4. [SDOI2010]捉迷藏

    嘟嘟嘟 k-d tree板儿题. 建完树后对每一个点求一遍最小和最大曼哈顿距离,是曼哈顿,不是欧几里得. #include<cstdio> #include<iostream> ...

  5. ThinkPHP框架整合极光推送DEMO

    极光推送(JPush)是独立的第三方云推送平台,致力于为全球移动应用开发者提供专业.高效的移动消息推送服务. 本篇博文讲述如何在将极光推送DEMO整合到ThinkPHP框架中,我使用的是极光推送PHP ...

  6. linux计划任务(转)

    文章转自https://blog.csdn.net/jixieyang3701/article/details/79410725 linux 系统则是由 cron (crond) 这个系统服务来控制的 ...

  7. Opencv——相机标定

    相机标定的目的:获取摄像机的内参和外参矩阵(同时也会得到每一幅标定图像的选择和平移矩阵),内参和外参系数可以对之后相机拍摄的图像就进行矫正,得到畸变相对很小的图像. 相机标定的输入:标定图像上所有内角 ...

  8. Python虚拟环境和包管理工具Pipenv的使用详解--看完这一篇就够了

    前言 Python虚拟环境是一个虚拟化,从电脑独立开辟出来的环境.在这个虚拟环境中,我们可以pip安装各个项目不同的依赖包,从全局中隔离出来,利于管理. 传统的Python虚拟环境有virtualen ...

  9. 源码篇:Python 实战案例----银行系统

    import time import random import pickle import os class Card(object): def __init__(self, cardId, car ...

  10. Luogu1344 追查坏牛奶 最小割

    题目传送门 题意:给出$N$个节点$M$条边的有向图,边权为$w$,求其最小割与达到最小割的情况下割掉边数的最小值.$N \leq 32,M \leq 1000,w\leq 2 \times 10^6 ...