3 Star 31 Fork 25

appleyk / license

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

license

软件许可证书生成+验证

作者:appleyk

博客地址:https://blog.csdn.net/appleyk

本篇博客地址:https://blog.csdn.net/Appleyk/article/details/101530203

license.app

软件许可应用(WebApp,主要用于引入license模块,便于测试)

1、首先要用KeyTool工具来生成密钥库:(-alias别名 –validity 3650表示10年有效) keytool -genkey -alias privatekeys -keysize 1024 -keystore privateKeys.store -validity 3650

2、然后将密钥库中名称为‘privatekeys’的证书条目导出到证书文件certfile.cer中: keytool -export -alias privatekeys -file certfile.cer -keystore privateKeys.store

3、然后再把这个证书文件的信息导入到公钥库中别名为publiccert的证书条目中: keytool -import -alias publiccert -file certfile.cer -keystore publicCerts.store

最后生成的文件privateKeys.store和publicCerts.store拷贝出来备用。

application.properties文件中添加如下配置:

##License相关配置 证书名称

  • springboot.license.verify.subject=landi

公钥别名

  • springboot.license.verify.publicAlias=publiccert

公钥库所在的位置

  • springboot.license.verify.publicKeysStorePath=/publicCerts.store

公钥库访问密码

  • springboot.license.verify.storePass=123456a

证书生成的临时位置(如果参数不指定,则由程序自动进行处理)

  • springboot.license.generate.temp.dir=D:/app/licenses/

证书所在系统中的的位置(默认放在classes下面)

  • springboot.license.verify.licensePath =classpath:license.lic

============License相关配置=============

生成证书的请求参数(json):

{
    "subject": "landi",
    "privateAlias": "privateKeys",
    "keyPass": "123456a",
    "storePass": "123456a",
    "privateKeysStorePath": "/privateKeys.store",
    "issuedTime": "2020-05-01 08:30:00",
    "expiryTime": "2021-05-01 08:30:00",
    "description": "系统软件许可证书",
    "licenseCheck": {
        "ipAddress": [
            "192.168.1.2",
            "2408:8221:1d:bbd0:ad77:446e:4904:a776",
            "2408:8221:1d:bbd0:71b6:d1b0:39c6:3c4e",
            "192.168.145.1",
            "192.168.239.1"
        ],
        "macAddress": [
            "64-FB-81-6F-0E-C2",
            "00-50-56-C0-00-08",
            "00-50-56-C0-00-01"
        ],
        "cpuSerial": "BFEBFBFF000206D7",
        "mainBoardSerial": "MB-201706282017",
        "registerAmount": 1000,
        "macCheck": false,
        "boardCheck": false,
        "cpuCheck": false,
        "ipCheck": false,
        "registerCheck": true
    }
}

============License相关配置=============

license.api

证书接口文档

license.app

证书应用App

:可打包成war(默认war)或jar,进行部署

license.core

证书核心模块

license.creator

证书生成模块

:也包括lic文件下载接口

license.verify

证书验证模块

:内置lic文件变动定时检测功能,如业务系统需要用到,只需要在SpringBoot启动类上,添加@EnableScheduling注解即可

:如需在接口上开启License验证功能,只需要在对应的API方法上添加@VLicense注解即可

效果图

图1

图2

图3

图4

MIT License Copyright (c) 2023 appleyk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于开源truelicense二次开发的,软件许可证书生成+验证组件 展开 收起
Java 等 4 种语言
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/appleyk/license.git
git@gitee.com:appleyk/license.git
appleyk
license
license
master

搜索帮助