3 Star 32 Fork 26

appleyk / license

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.34 KB
一键复制 编辑 原始数据 按行查看 历史
Appleyk 提交于 2020-08-31 01:23 . Update README.md

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

Java
1
https://gitee.com/appleyk/license.git
git@gitee.com:appleyk/license.git
appleyk
license
license
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891