License 校验器
简介
软件许可证书(License)可在软件产品交付时,授权其使用时间和范围。当用户申请或购买变更使用时间和范围时,授权方可为用户生成新许可,替换原有许可,避免修改源码、改动部署等繁琐操作。
continew-starter-license-verifier
是 ContiNew Starter 提供的基于 True License 实现的 License 校验模块,提供开箱即用的 License 校验解决方案。
配合 continew-starter-license-generator
校验模块组成完整的 License 生成及校验解决方案。
主要特性
- 生成秘钥对,使用 Keytool 生成公私钥证书库
- 授权者保留私钥,使用私钥对包含授权信息(如使用截止日期,MAC地址等)的 License 进行数字签名
- 公钥给使用者(放在验证的代码中使用),用于验证 License 是否符合使用条件。
使用步骤
引入依赖
xml
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-license-verify</artifactId>
</dependency>
全局配置
配置详情请查看:top.continew.license.autoconfigure.LicenseVerifyProperties
。
yaml
--- ### License 校验器配置
continew-starter.license:
verify:
# 证书存储路径(默认为 FileUtil.getTmpDirPath())
storePath: D:/license
项目启动后,会自动进行证书安装验证,验证失败则无法启动。
核心依赖
依赖 | 描述 |
---|---|
top.continew:continew-starter-core | 核心模块 |
top.continew:continew-starter-license-core | License 核心模块 |
de.schlichtherle.truelicense:truelicense-core | TrueLicense (一个开源的证书管理引擎) |
net.lingala.zip4j:zip4j | Zip4j (开源的 Java 处理 zip 压缩文件的开发包) |