# genlicense **Repository Path**: yong_Arvin/genlicense ## Basic Information - **Project Name**: genlicense - **Description**: 用于生成项目的lincese服务,用于验证处理 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 1 - **Created**: 2020-07-01 - **Last Updated**: 2022-05-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # genlicense #### 两个子项目说明: #### - `genlicense`:用于**开发者**给客户生成`License证书`的示例代码 #### genlicense项目: #### 对外发布了两个RESTful接口: (1)获取服务器硬件信息 : 请求地址:`http://127.0.0.1:7000/license/getServerInfos` ![获取服务器硬件信息] (2)生成证书 : 请求地址:`http://127.0.0.1:7000/license/generateLicense` 请求时需要在Header中添加一个 **Content-Type** ,其值为:**application/json;charset=UTF-8**。请求参数如下: ```json { "subject": "yuxy_admin", "privateAlias": "privateKey", "keyPass": "private_password1234", "storePass": "public_password1234", "licensePath": "D:/key/license.lic", "privateKeysStorePath": "D:/key/privateKeys.keystore", "issuedTime": "2020-07-01 00:00:00", "expiryTime": "2020-07-01 18:18:00", "consumerType": "User", "consumerAmount": 1, "description": "仅适用于本系统,不对外开放", "licenseCheckModel": { "ipAddress": [ "192.168.152.1", "192.168.0.154", "192.168.117.1" ], "macAddress": [ "00-50-56-C0-00-01", "88-D7-F6-7E-25-C4", "00-50-56-C0-00-08" ], "cpuSerial": "BFEBFBFF000306C3", "mainBoardSerial": "170499789302487" } } ``` ![生成证书] #生成命令 keytool -genkeypair -keysize 1024 -validity 3650 -alias "privateKey" -keystore "d:\key\privateKeys.keystore" -storepass "public_password1234" -keypass "private_password1234" -dname "CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN" #导出命令 keytool -exportcert -alias "privateKey" -keystore "d:\key\privateKeys.keystore" -storepass "public_password1234" -file "d:\key\certfile.cer" #导入命令 keytool -import -alias "publicCert" -file "d:\key\certfile.cer" -keystore "d:\key\publicCerts.keystore" -storepass "public_password1234" ![命令生成] #### 特别说明: #### 详细开发思路可以参考这篇文章:[https://www.zifangsky.cn/1277.html]