集成Truelicense

授权文件生成(demo) http://192.168.2.18:18105/licenseGen.html
truelicense GitHub https://github.com/christian-schlichtherle/truelicense
truelicense official website https://truelicense.namespace.global/guide/getting-started.html
demo base GitHub https://github.com/JCXTB/TrueLicense

私钥生成步骤

一、生成密钥库私钥

keytool -genkeypair -keysize 1024 -validity 10950 -alias "chyaitPri" -keystore "chyaitPri.keystore" -storepass "chyait@License:pub:mYd1b3DiF" -keypass "chyait@License:pri:LYx143CiS" -dname "CN=CHYA, OU=CHYA, O=DEV, L=FZ, ST=FJ, C=CN"

keytool -genkeypair -keysize 1024 -validity 10950 -alias "chyaitPri" -keystore "chyaitPri.keystore" -storepass "chyait@License:pub:mYd1b3DiF" -keypass "chyait@License:pri:LYx143CiS"

然后按提示输入私钥信息

字段解释

选项 释义
keysize 密钥长度(统一使用1024位)
validity 有效日期(天)
alias 密钥库别名
keystore 密钥库名称
storepass 密钥库密码
keypass 私钥密码
dname 域信息

二、生成证书

keytool -exportcert -alias "chyaitPri" -keystore "chyaitPri.keystore" -storepass "chyait@License:pub:mYd1b3DiF" -file "certfile.cer"

三、从证书中提取公钥

keytool -import -alias "chyaitPub" -file "certfile.cer" -keystore "chyaitPub.keystore" -storepass "chyait@License:pub:mYd1b3DiF"

授权业务流程图

授权逻辑流程图

代码实现

授权方生成授权文件

待完善

被授权方解析授权文件

待完善

被授权方校验授权文件

待完善