• Home
Name Date Size #Lines LOC

..--

autosign/12-May-2024-791601

dist/12-May-2024-225222

hapsigntool/12-May-2024-13,6797,706

tools/12-May-2024-1,1501,042

.gitignoreD12-May-202469 97

BUILD.gnD12-May-20241.1 KiB3229

LICENSED12-May-202411.1 KiB203169

NOTICED12-May-202422.8 KiB433362

OAT.xmlD12-May-20243.5 KiB6245

README.mdD12-May-202420.1 KiB275213

README_ZH.mdD12-May-202418 KiB281221

README.md

1# hapsigner
2
3
4
5#### Introduction
6
7To ensure the integrity and secure source of applications, the applications must be signed during the build process. Only signed applications can be installed, run, and debugged on real devices. This repository provides the source code of the HAP signing tool - hapsigner. This tool can be used to generate key pairs, certificate signing requests (CSRs), certificates, profile signatures, and HAP signatures.
8
9
10#### Directory Structure
11
12    developtools_hapsigner
13
14    ├── autosign                # One-click signature script.
15	├── dist                    # SDK preconfigured file.
16    ├── hapsigntool             # Master code.
17          ├──hap_sign_tool      # Application entry, used to verify input parameters.
18          ├──hap_sign_tool_lib  # Signing tool lib, used to parse command words and parameter lists to implement logic of modules.
19    ├── tools                   # Auto-test script.
20
21
22
23#### Constraints
24hapsigner is developed in Java and must run in JRE 8.0 or later.
25The scripts, such as the one-click signature script, are developed in Python, and must run on Python 3.x.
26#### Build
27
28 1. Check that Gradle 7.1 has been installed.
29
30        gradle -v
31
32 2. Download the code, open the file directory **developtools_hapsigner/hapsigntool**, and run the following command to build the code:
33
34        gradle build or gradle jar
35
36 3. Check that **hap-sign-tool.jar** (binary files) is generated in the **./hap_sign_tool/build/libs** directory.
37
38****
39#### Usage
40##### Note
41
42In the following, the JAR package used is the binary files generated during the build process.
43
441. Command line signatures
45   Command line signatures include profile signatures and HAP signatures.
46
47   (1) Sign a profile.
48
49
50```shell
51java -jar hap-sign-tool.jar  sign-profile -keyAlias "oh-profile1-key-v1" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "result\profile1.pem" -inFile "app1-profile-release.json" -keystoreFile "result\ohtest.jks" -outFile "result\app1-profile.p7b" -keyPwd "123456" -keystorePwd "123456"
52```
53The parameters in the command are described as follows:
54
55    sign-profile: Sign a provisioning profile.
56         ├── -mode              # Signing mode, which can be localSign or remoteSign. It is mandatory.
57         ├── -keyAlias          # Key alias. It is mandatory.
58         ├── -keyPwd            # Key password. It is optional.
59         ├── -profileCertFile   # Profile signing certificate (certificate chain, in the end-entity certificate, intermediate CA certificate, and root certificate order). It is mandatory.
60         ├── -inFile            # Raw provisioning profile. It is mandatory.
61         ├── -signAlg           # Signature algorithm, which can be SHA256withECDSA or SHA384withECDSA. It is mandatory.
62         ├── -keystoreFile      # KeyStore (KS) file, in JKS or P12 format. It is mandatory if the signing mode is localSign.
63         ├── -keystorePwd       # KS password. It is optional.
64         ├── -outFile           # Signed provisioning profile to generate, in p7b format. It is mandatory.
65
66
67
68(2) Sign a HAP.
69
70
71```shell
72java -jar hap-sign-tool.jar sign-app -keyAlias "oh-app1-key-v1" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "result\app1.pem" -profileFile "result\app1-profile.p7b" -inFile "app1-unsigned.zip" -keystoreFile "result\ohtest.jks" -outFile "result\app1-unsigned.hap" -keyPwd "123456" -keystorePwd "123456"
73```
74The parameters in the command are described as follows:
75
76    sign-app: HAP signature.
77         ├── -mode              # Signing mode, which can be localSign or remoteSign. It is mandatory.
78         ├── -keyAlias          # Key alias. It is mandatory.
79         ├── -keyPwd            # Key password. It is optional.
80         ├── -appCertFile       # Application signing certificate (certificate chain, in the end-entity certificate, intermediate CA certificate, and root certificate order). It is mandatory.
81         ├── -profileFile       # Singed provisioning profile, in p7b format. It is mandatory.
82         ├── -profileSigned     # Whether the profile is signed. The value 1 means signed, and value 0 means unsigned. The default value is 1. It is optional.
83         ├── -inForm            # Raw file, in .zip (default) or .bin format. It is optional.
84         ├── -inFile            # Raw application package, in .zip or .bin format. It is mandatory.
85         ├── -signAlg           # Signature algorithm, which can be SHA256withECDSA or SHA384withECDSA. It is mandatory.
86         ├── -keystoreFile      # KeyStore (KS) file, in JKS or P12 format. It is mandatory if the signing mode is localSign.
87         ├── -keystorePwd       # KS password. It is optional.
88         ├── -outFile           # Signed HAP file to generate. It is mandatory.
89
90
912. One-click signature
92
93
94To improve development efficiency, this project also provides one-click signature scripts based on the hapsigner tool. You can use these scripts to easily generate key pairs and end-entity certificates and sign profiles and HAPs, instead of entering complex commands.
95The scripts and configuration files are located in the **autosign** directory.
96
97 - create_root.sh/create_root.bat
98 - create_appcert_sign_profile.sh/create_appcert_sign_profile.bat
99 - sign_hap.sh/sign_hap.bat
100 - createAppCertAndProfile.config
101 - createRootAndSubCert.config
102 - signHap.config
103
104Procedure:
1051. Ensure that Python 3.5 or later has been installed.
1062. Prepare **hap-sign-tool.jar**. For details, see section **Build**.
1073. Prepare the HAP to be signed and the provisioning profile template file.
1084. Use the text editor to open the **createAppCertAndProfile.config** file and **signHap.config** file and change the values of **common.keyPwd** and **common.issuerKeyPwd** to match your case.
1095. Run **create_appcert_sign_profile.sh** in Linux or **create_appcert_sign_profile.bat** in Windows to generate files required for signature.
1106. Run **sign_hap.sh** in Linux or **sign_hap.bat** in Windows to sign the HAP.
111
112 > Note: To generate the KS file, root CA certificate, intermediate CA certificate, and profile signing certificate, perform the following steps:
113 1. Use the text editor to open the **createRootAndSubCert.config** file and change the values of **common.keyPwd** and **common.issuerKeyPwd** to match your case.
114 2. Run **create_root.sh** in Linux or run **create_root.bat** in Windows to generate the required KS file, root CA certificate, intermediate CA certificate, and profile signing certificate.
115
116
117****
118##### Common Operations
1191.Generate a key pair.
120
121     generate-keypair: Generate a key pair.
122         ├── -keyAlias          # Key alias. It is mandatory.
123         ├── -keyPwd            # Key password. It is optional.
124         ├── -keyAlg            # Key algorithm, which can be RSA or ECC. It is mandatory.
125         ├── -keySize           # Key length. It is mandatory. The key length is 2048, 3072, or 4096 bits if RSA is used and is NIST-P-256 or NIST-P-384 if ECC is used.
126         ├── -keystoreFile      # KS file, in JKS or P12 format. It is mandatory.
127         ├── -keystorePwd       # KS password. It is optional.
128
1292.Generate a CSR.
130
131    generate-csr: Generate a CSR.
132         ├── -keyAlias          # Key alias. It is mandatory.
133         ├── -keyPwd            # Key password. It is optional.
134         ├── -subject           # Certificate subject. It is mandatory.
135         ├── -signAlg           # Signature algorithm, which can be SHA256withRSA, SHA384withRSA, SHA256withECDSA, or SHA384withECDSA. It is mandatory.
136         ├── -keystoreFile      # KS file, in JKS or P12 format. It is mandatory.
137         ├── -keystorePwd       # KS password. It is optional.
138         ├── -outFile           # CSR to generate. It is optional. If you do not specify this parameter, the CSR is output to the console.
139
1403.Generate a root CA or intermediate CA certificate.
141
142    generate-ca: Generate a root CA or intermediate CA certificate. If the key does not exist, generate a key together with the certificate.
143         ├── -keyAlias                        # Key alias. It is mandatory.
144         ├── -keyPwd                          # Key password. It is optional.
145         ├── -keyAlg                          # Key algorithm, which can be RSA or ECC. It is mandatory.
146         ├── -keySize                         # Key length. It is mandatory. The key length is 2048, 3072, or 4096 bits if RSA is used and is NIST-P-256 or NIST-P-384 if ECC is used.
147         ├── -issuer                          # Issuer of the certificate. It is optional. It indicates a root CA certificate if not specified.
148         ├── -issuerKeyAlias                  # Key alias of the issuer. It is optional. It indicates a root CA certificate if not specified.
149         ├── -issuerKeyPwd                    # Key password of the issuer. It is optional.
150         ├── -subject                         # Certificate subject. It is mandatory.
151         ├── -validity                        # Validity period of the certificate. It is optional. The default value is 3650 days.
152         ├── -signAlg                         # Signature algorithm, which can be SHA256withRSA, SHA384withRSA,  SHA256withECDSA, or SHA384withECDSA. It is mandatory.
153         ├── -basicConstraintsPathLen         # Path length. It is optional. The default value is 0.
154         ├── -issuerKeystoreFile              # KS file of the issuer, in JKS or P12 format. It is optional.
155         ├── -issuerKeystorePwd               # KS password of the issuer. It is optional.
156         ├── -keystoreFile                    # KS file, in JKS or P12 format. It is mandatory.
157         ├── -keystorePwd                     # KS password. It is optional.
158         ├── -outFile                         # File to generate. It is optional. The file is output to the console if this parameter is not specified.
159
1604.Generate an application debug or release certificate.
161
162    generate-app-cert: Generate an application debug or release certificate.
163         ├── -keyAlias                        # Key alias. It is mandatory.
164         ├── -keyPwd                          # Key password. It is optional.
165         ├── -issuer                          # Issuer of the certificate. It is mandatory.
166         ├── -issuerKeyAlias                  # Key alias of the issuer. It is mandatory.
167         ├── -issuerKeyPwd                    # Key password of the issuer. It is optional.
168         ├── -subject                         # Certificate subject. It is mandatory.
169         ├── -validity                        # Validity period of the certificate. It is optional. The default value is 3650 days.
170         ├── -signAlg                         # Signature algoritym, which can be SHA256withECDSA or SHA384withECDSA.
171         ├── -keystoreFile                    # KS file, in JKS or P12 format. It is mandatory.
172         ├── -keystorePwd                     # KS password. It is optional.
173         ├── -issuerKeystoreFile              # KS file of the issuer, in JKS or P12 format. It is optional.
174         ├── -issuerKeystorePwd               # KS password of the issuer. It is optional.
175         ├── -outForm                         # Format of the certificate to generate. It is optional. The value can be cert or certChain. The default value is certChain.
176         ├── -rootCaCertFile                  # Root CA certificate, which is mandatory when outForm is certChain.
177         ├── -subCaCertFile                   # Intermediate CA certificate, which is mandatory when outForm is certChain.
178         ├── -outFile                         # Certificate file (certificate or certificate chain) to generate. It is optional. The file is output to the console if this parameter is not specified.
179
1805.Generate a profile debug or release certificate.
181
182    generate-profile-cert: Generate a profile debug or release certificate.
183         ├── -keyAlias                        # Key alias. It is mandatory.
184         ├── -keyPwd                          # Key password. It is optional.
185         ├── -issuer                          # Issuer of the certificate. It is mandatory.
186         ├── -issuerKeyAlias                  # Key alias of the issuer. It is mandatory.
187         ├── -issuerKeyPwd                    # Key password of the issuer. It is optional.
188         ├── -subject                         # Certificate subject. It is mandatory.
189         ├── -validity                        # Validity period of the certificate. It is optional. The default value is 3650 days.
190         ├── -signAlg                         # Signature algoritym, which can be SHA256withECDSA or SHA384withECDSA.
191         ├── -keystoreFile                    # KS file, in JKS or P12 format. It is mandatory.
192         ├── -keystorePwd                     # KS password. It is optional.
193         ├── -issuerKeystoreFile              # KS file of the issuer, in JKS or P12 format. It is optional.
194         ├── -issuerKeystorePwd               # KS password of the issuer. It is optional.
195         ├── -outForm                         # Format of the certificate to generate. It is optional. The value can be cert or certChain. The default value is certChain.
196         ├── -rootCaCertFile                  # Root CA certificate, which is mandatory when outForm is certChain.
197         ├── -subCaCertFile                   # Intermediate CA certificate, which is mandatory when outForm is certChain.
198         ├── -outFile                         # Certificate file (certificate or certificate chain) to generate. It is optional. The file is output to the console if this parameter is not specified.
199
2006.Generate a common certificate, which can be used to generate a custom certificate.
201
202    generate-cert: Generate a common certificate, which can be used to generate a custom certificate.
203          ├── -keyAlias                        # Key alias. It is mandatory.
204          ├── -keyPwd                          # Key password. It is optional.
205          ├── -issuer                          # Issuer of the certificate. It is mandatory.
206          ├── -issuerKeyAlias                  # Key alias of the issuer. It is mandatory.
207          ├── -issuerKeyPwd                    # Key password of the issuer. It is optional.
208          ├── -subject                         # Certificate subject. It is mandatory.
209          ├── -validity                        # Validity period of the certificate. It is optional. The default value is 1095 days.
210          ├── -keyUsage                        # Usages of the key. It is mandatory. The key usages include digitalSignature, nonRepudiation,
211          ├                                      keyEncipherment, dataEncipherment, keyAgreement, certificateSignature, crlSignature,
212          ├                                      encipherOnly, and decipherOnly. Use a comma (,) to separate multiple values.
213          ├── -keyUsageCritical                # Whether keyUsage is a critical option. It is optional. The default value is true.
214          ├── -extKeyUsage                     # Extended key usages. It is optional. The extended key usages include clientAuthentication,
215          ├                                      serverAuthentication, codeSignature, emailProtection, smartCardLogin, timestamp, and ocspSignature.
216          ├── -extKeyUsageCritical             # Whether extKeyUsage is a critical option. It is optional. The default value is false.
217          ├── -signAlg                         # Signature algorithm, which can be SHA256withRSA, SHA384withRSA,  SHA256withECDSA, or SHA384withECDSA. It is mandatory.
218          ├── -basicConstraints                # Whether basicConstraints is contained. It is optional. The default value is false.
219          ├── -basicConstraintsCritical        # Whether basicConstraints is a critical option. It is optional. The default value is false.
220          ├── -basicConstraintsCa              # Whether it is CA. It is optional. The default value is false.
221          ├── -basicConstraintsPathLen         # Path length. It is optional. The default value is 0.
222          ├── -issuerKeystoreFile              # KS file of the issuer, in JKS or P12 format. It is optional.
223          ├── -issuerKeystorePwd               # KS password of the issuer. It is optional.
224          ├── -keystoreFile                    # KS file, in JKS or P12 format. It is mandatory.
225          ├── -keystorePwd                     # KS password. It is optional.
226          ├── -outFile                         # Certificate file to generate. It is optional. The file is output to the console if this parameter is not specified.
227
2287.Sign a provisioning profile.
229
230    sign-profile: Generate a provisioning profile signature.
231          ├── -mode            # Signing mode, which can be localSign or remoteSign. It is mandatory.
232          ├── -keyAlias        # Key alias. It is mandatory.
233          ├── -keyPwd          # Key password. It is optional.
234          ├── -profileCertFile # Profile signing certificate (certificate chain, in the end-entity certificate, intermediate CA certificate, and root certificate order). It is mandatory.
235          ├── -inFile          # Raw provisioning profile. It is mandatory.
236          ├── -signAlg         # Signature algorithm, which can be SHA256withECDSA or SHA384withECDSA. It is mandatory.
237          ├── -keystoreFile    # KS file, in JKS or P12 format. It is mandatory if the signing mode is localSign.
238          ├── -keystorePwd     # KS password. It is optional.
239          ├── -outFile         # Signed provisioning profile to generate, in p7b format. It is mandatory.
240
2418.Verify the provisioning profile signature.
242
243     verify-profile: Verify the provisioning profile signature.
244           ├── -inFile       # Signed provisioning profile, in p7b format. It is mandatory.
245           ├── -outFile       # Verification result file (including the verification result and profile content), in json format. It is optional. The file is output to the console if this parameter is not specified.
246
2479.Sign a HAP.
248
249     sign-app: Sign a HAP
250          ├── -mode          # Signing mode, which can be localSign, remoteSign, or remoteResign. It is mandatory.
251          ├── -keyAlias      # Key alias. It is mandatory.
252          ├── -keyPwd         # Key password. It is optional.
253          ├── -appCertFile   # Application signing certificate (certificate chain, in the end-entity certificate, intermediate CA certificate, and root certificate order). It is mandatory.
254          ├── -profileFile   # Name of the signed provisioning profile. The profile is in p7b format if profileSigned is 1 and in json format if profileSigned is 0. It is mandatory.
255          ├── -profileSigned # Whether the profile is signed. The value 1 means signed, and value 0 means unsigned. The default value is 1. It is optional.
256          ├── -inForm        # Raw file, in .zip (default) or .bin format. It is optional.
257          ├── -inFile        # Raw application package, in .zip or .bin format. It is mandatory.
258          ├── -signAlg       # Signature algorithm, which can be SHA256withECDSA or SHA384withECDSA. It is mandatory.
259          ├── -keystoreFile  # KS file, in JKS or P12 format. It is mandatory if the signing mode is localSign.
260          ├── -keystorePwd   # KS password. It is optional.
261          ├── -outFile       # Signed HAP file to generate. It is mandatory.
262
26310.Verify the HAP Signature.
264
265      verify-app: Verify the HAP signature.
266         ├── -inFile          # Signed application file, in .zip or .bin format. It is mandatory.
267         ├── -outCertchain    # Signed certificate chain file. It is mandatory.
268         ├── -outProfile      # Profile of the application. It is mandatory.
269
270
271
272
273#### Repositories Involved
274   N/A
275

README_ZH.md

1# Hap包签名工具
2
3* 简介
4* 目录
5* 约束
6* 编译构建
7* 说明
8  * 使用说明
9  * 接口说明
10* 相关仓
11
12#### 简介
13
14为了保证OpenHarmony应用的完整性和来源可靠,在应用构建时需要对应用进行签名。经过签名的应用才能在真机设备上安装、运行、和调试。本仓提供了签名工具的源码,包含密钥对生成、CSR文件生成、证书生成、Profile文件签名、Hap包签名等功能。
15
16
17#### 目录
18
19    developtools_hapsigner
20
21    ├── autosign                # 一键签名脚本
22	├── dist                    # SDK预置文件
23    ├── hapsigntool             # 主代码
24          ├──hap_sign_tool      # 主程序入口,完成输入参数的基础校验
25          ├──hap_sign_tool_lib  # 签名工具库,解析命令字和参数列表,实现各模块逻辑功能
26    ├── tools                   # 自动化测试脚本
27
28
29
30#### 约束
31Hap包签名工具基于Java语言开发,需要在Java8以上Java环境运行
32(附:一键签名等脚本文件基于Python语言开发,使用需配置环境python3.x33#### 编译构建
34
35 1. 该工具基于Gradle 7.1编译构建,请确认环境已安装配置Gradle环境,并且版本正确
36
37        gradle -v
38
39 2. 下载代码,命令行打开文件目录至developtools_hapsigner/hapsigntool,执行命令进行编译打包
40
41        gradle build 或者 gradle jar
42
43 3. 编译后得到二进制文件,目录为: ./hap_sign_tool/build/libs/hap-sign-tool.jar
44
45****
46#### 说明
47##### 使用说明
48
49以下说明中使用jar包为编译构建中生成的二进制文件
50
511.命令行签名
52   命令行签名分为profile文件签名和hap包签名。
53
54   (1)签名profile文件的命令实例如下:
55
56
57```shell
58java -jar hap-sign-tool.jar  sign-profile -keyAlias "oh-profile1-key-v1" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "result\profile1.pem" -inFile "app1-profile-release.json" -keystoreFile "result\ohtest.jks" -outFile "result\app1-profile.p7b" -keyPwd "123456" -keystorePwd "123456"
59```
60该命令的参数说明如下:
61
62    sign-profile : ProvisionProfile文件签名
63         ├── -mode              #签名模式,必填项,包括localSign,remoteSign
64         ├── -keyAlias          #密钥别名,必填项
65         ├── -keyPwd            #密钥口令,可选项
66         ├── -profileCertFile   #Profile签名证书(证书链,顺序为最终实体证书-中间CA证书-根证书),必填项
67         ├── -inFile            #输入的原始Provision Profile文件,必填项
68         ├── -signAlg           #签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA
69         ├── -keystoreFile      #密钥库文件,localSign模式时为必填项,JKS或P12格式
70         ├── -keystorePwd       #密钥库口令,可选项
71         ├── -outFile           #输出签名后的Provision Profile文件,p7b格式,必填项
72
73
74
75(2)签名Hap包的命令实例如下:
76
77
78```shell
79java -jar hap-sign-tool.jar sign-app -keyAlias "oh-app1-key-v1" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "result\app1.pem" -profileFile "result\app1-profile.p7b" -inFile "app1-unsigned.zip" -keystoreFile "result\ohtest.jks" -outFile "result\app1-unsigned.hap" -keyPwd "123456" -keystorePwd "123456"
80```
81该命令的参数说明如下:
82
83    sign-app : hap应用包签名
84         ├── -mode              #签名模式,必填项,包括localSign,remoteSign
85         ├── -keyAlias          #密钥别名,必填项
86         ├── -keyPwd            #密钥口令,可选项
87         ├── -appCertFile       #应用签名证书文件(证书链,顺序为最终实体证书-中间CA证书-根证书),必填项
88         ├── -profileFile       #签名后的Provision Profile文件名,p7b格式,必填项
89         ├── -profileSigned     #指示profile文件是否带有签名,1表示有签名,0表示没有签名,默认为1。可选项
90         ├── -inForm            #输入的原始文件的格式,zip格式或bin格式,默认zip格式;可选项
91         ├── -inFile            #输入的原始APP包文件,zip格式或bin格式,必填项
92         ├── -signAlg           #签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA
93         ├── -keystoreFile      #密钥库文件,localSign模式时为必填项,JKS或P12格式
94         ├── -keystorePwd       #密钥库口令,可选项
95         ├── -outFile           #输出签名后的包文件,必填项
96
97
982.一键签名
99
100
101为降低学习成本,提高开发效率,本项目还将基于应用签名工具提供一键签名脚本,免于输入繁杂的参数命令,脚本内容包括生成密钥对、最终实体证书、签名profile包、签名hap包的命令。
102脚本以及配置文件位于目录autosign下:
103
104 - create_root.sh/create_root.bat
105 - create_appcert_sign_profile.sh/create_appcert_sign_profile.bat
106 - sign_hap.sh/sign_hap.bat
107 - createAppCertAndProfile.config
108 - createRootAndSubCert.config
109 - signHap.config
110
111使用指导:
1121. 准备依赖环境python3.5以上
1132. 准备签名工具jar包:hap-sign-tool.jar(参照上文编译生成的产物)
1143. 准备待签名的应用hap包和Provision profile模板文件
1154. 使用文本编辑器编辑createAppCertAndProfile.config,signHap.config修改配置文件中的配置信息:common.keyPwdcommon.issuerKeyPwd 参数值改成自己定义的口令信息
1165. Linux运行create_appcert_sign_profile.sh、Windows运行create_appcert_sign_profile.bat生成签名所需文件
1176. Linux运行sign_hap.sh、Windows运行sign_hap.bat对hap包进行签名
118
119 > 说明:如需自定义生成密钥库文件,根CA,中间CA证书,profile签名证书,可执行以下步骤
120 1.使用文本编辑器编辑createRootAndSubCert.config修改配置文件中的配置信息:common.keyPwdcommon.issuerKeyPwd 参数值改成自己定义的口令信息
121 2.Linux运行 create_root.sh、Windows运行create_root.bat生成所需密钥库文件,根CA,中间CA证书,profile签名证书
122
123
124****
125##### 接口说明
1261.生成密钥对
127
128     generate-keypair : 生成密钥对
129         ├── -keyAlias          # 密钥别名,必填项
130         ├── -keyPwd            # 密钥口令,可选项
131         ├── -keyAlg            # 密钥算法,必填项,包括RSA/ECC
132         ├── -keySize           # 密钥长度,必填项,RSA算法的长度为2048/3072/4096,ECC算法的长度NIST-P-256/NIST-P-384
133         ├── -keystoreFile      # 密钥库文件,必填项,JKS或P12格式
134         ├── -keystorePwd       # 密钥库口令,可选项
135
1362.生成证书签名请求
137
138    generate-csr : 生成证书签名请求
139         ├── -keyAlias          # 密钥别名,必填项
140         ├── -keyPwd            # 密钥口令,可选项
141         ├── -subject           # 证书主题,必填项
142         ├── -signAlg           # 签名算法,必填项,包括SHA256withRSA / SHA384withRSA / SHA256withECDSA / SHA384withECDSA
143         ├── -keystoreFile      # 密钥库文件,必填项,JKS或P12格式
144         ├── -keystorePwd       # 密钥库口令,可选项
145         ├── -outFile           # 输出文件,可选项,如果不填,则直接输出到控制台
146
1473.生成根CA/中间CA证书
148
149    generate-ca : 生成根CA/中间CA证书,如果密钥不存在,一起生成密钥
150         ├── -keyAlias                        # 密钥别名,必填项
151         ├── -keyPwd                          # 密钥口令,可选项
152         ├── -keyAlg                          # 密钥算法,必填项,包括RSA/ECC
153         ├── -keySize                         # 密钥长度,必填项,RSA算法的长度为2048/3072/4096,ECC算法的长度NIST-P-256/NIST-P-384
154         ├── -issuer                          # 颁发者的主题,可选项,如果不填,表示根CA
155         ├── -issuerKeyAlias                  # 颁发者的密钥别名,可选项,如果不填,表示根CA
156         ├── -issuerKeyPwd                    # 颁发者的密钥口令,可选项
157         ├── -subject                         # 证书主题,必填项
158         ├── -validity                        # 证书有效期,可选项,默认为3650天
159         ├── -signAlg                         # 签名算法,必填项,包括SHA256withRSA / SHA384withRSA / SHA256withECDSA / SHA384withECDSA
160         ├── -basicConstraintsPathLen         # 路径长度,可选项,默认为0
161         ├── -issuerKeystoreFile              # 签发者密钥库文件,可选项,JKS或P12格式
162         ├── -issuerKeystorePwd               # 签发者密钥库口令,可选项
163         ├── -keystoreFile                    # 密钥库文件,必填项,JKS或P12格式
164         ├── -keystorePwd                     # 密钥库口令,可选项
165         ├── -outFile                         # 输出文件,可选项,如果不填,则直接输出到控制台
166
1674.生成应用调试/发布证书
168
169    generate-app-cert : 生成应用调试/发布证书
170         ├── -keyAlias                        # 密钥别名,必填项
171         ├── -keyPwd                          # 密钥口令,可选项
172         ├── -issuer                          # 颁发者的主题,必填项
173         ├── -issuerKeyAlias                  # 颁发者的密钥别名,必填项
174         ├── -issuerKeyPwd                    # 颁发者的密钥口令,可选项
175         ├── -subject                         # 证书主题,必填项
176         ├── -validity                        # 证书有效期,可选项,默认为3650天
177         ├── -signAlg                         # 签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA;
178         ├── -keystoreFile                    # 密钥库文件,必填项,JKS或P12格式
179         ├── -keystorePwd                     # 密钥库口令,可选项
180         ├── -issuerKeystoreFile              # 签发者密钥库文件,可选项,JKS或P12格式
181         ├── -issuerKeystorePwd               # 签发者密钥库口令,可选项
182         ├── -outForm                         # 输出证书文件的格式,包括 cert / certChain,可选项,默认为certChain
183         ├── -rootCaCertFile                  #  outForm为certChain时必填,根CA证书文件
184         ├── -subCaCertFile                   #  outForm为certChain时必填,中间CA证书文件
185         ├── -outFile                         #  输出证书文件(证书或证书链),可选项,如果不填,则直接输出到控制台
186
1875.生成profile调试/发布证书
188
189    generate-profile-cert : 生成profile调试/发布证书
190         ├── -keyAlias                        # 密钥别名,必填项
191         ├── -keyPwd                          # 密钥口令,可选项
192         ├── -issuer                          # 颁发者的主题,必填项
193         ├── -issuerKeyAlias                  # 颁发者的密钥别名,必填项
194         ├── -issuerKeyPwd                    # 颁发者的密钥口令,可选项
195         ├── -subject                         # 证书主题,必填项
196         ├── -validity                        # 证书有效期,可选项,默认为3650天
197         ├── -signAlg                         # 签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA;
198         ├── -keystoreFile                    # 密钥库文件,必填项,JKS或P12格式
199         ├── -keystorePwd                     # 密钥库口令,可选项
200         ├── -issuerKeystoreFile              # 签发者密钥库文件,可选项,JKS或P12格式
201         ├── -issuerKeystorePwd               # 签发者密钥库口令,可选项
202         ├── -outForm                         # 输出证书文件的格式,包括 cert / certChain,可选项,默认为certChain
203         ├── -rootCaCertFile                  #  outForm为certChain时必填,根CA证书文件
204         ├── -subCaCertFile                   #  outForm为certChain时必填,中间CA证书文件
205         ├── -outFile                         #  输出证书文件(证书或证书链),可选项,如果不填,则直接输出到控制台
206
2076.通用证书生成,可以生成自定义证书
208
209    generate-cert : 通用证书生成,可以生成自定义证书
210          ├── -keyAlias                          # 密钥别名,必填项
211          ├── -keyPwd                            # 密钥口令,可选项
212          ├── -issuer                            # 颁发者的主题,必填项
213          ├── -issuerKeyAlias                    # 颁发者的密钥别名,必填项
214          ├── -issuerKeyPwd                      # 颁发者的密钥口令,可选项
215          ├── -subject                           # 证书主题,必填项
216          ├── -validity                          # 证书有效期,可选项,默认为1095天
217          ├── -keyUsage                          # 密钥用法,必选项,包括digitalSignature, nonRepudiation, keyEncipherment,
218          ├                                        dataEncipherment, keyAgreement, certificateSignature, crlSignature,
219          ├                                        encipherOnly和decipherOnly,如果证书包括多个密钥用法,用逗号分隔
220          ├── -keyUsageCritical                  # keyUsage是否为关键项,可选项,默认为是
221          ├── -extKeyUsage                       # 扩展密钥用法,可选项,包括clientAuthentication,serverAuthentication,
222          ├                                        codeSignature,emailProtection,smartCardLogin,timestamp,ocspSignature
223          ├── -extKeyUsageCritical               # extKeyUsage是否为关键项,可选项,默认为否
224          ├── -signAlg                           # 签名算法,必填项,包括SHA256withRSA/SHA384withRSA/SHA256withECDSA/SHA384withECDSA
225          ├── -basicConstraints                  # 是否包含basicConstraints,可选项,默认为否
226          ├── -basicConstraintsCritical          # basicConstraints是否包含为关键项,可选项,默认为否
227          ├── -basicConstraintsCa                # 是否为CA,可选项,默认为否
228          ├── -basicConstraintsPathLen           # 路径长度,可选项,默认为0
229          ├── -issuerKeystoreFile                # 签发者密钥库文件,可选项,JKS或P12格式
230          ├── -issuerKeystorePwd                 # 签发者密钥库口令,可选项
231          ├── -keystoreFile                      # 密钥库文件,必填项,JKS或P12格式
232          ├── -keystorePwd                       # 密钥库口令,可选项
233          ├── -outFile                           # 输出证书文件,可选项,如果不填,则直接输出到控制台
234
2357.ProvisionProfile文件签名
236
237    sign-profile : ProvisionProfile文件签名
238          ├── -mode            # 签名模式,必填项,包括localSign,remoteSign
239          ├── -keyAlias        # 密钥别名,必填项
240          ├── -keyPwd          # 密钥口令,可选项
241          ├── -profileCertFile # Profile签名证书(证书链,顺序为最终实体证书-中间CA证书-根证书),必填项
242          ├── -inFile          # 输入的原始Provision Profile文件,必填项
243          ├── -signAlg         # 签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA
244          ├── -keystoreFile    # 密钥库文件,localSign模式时为必填项,JKS或P12格式
245          ├── -keystorePwd     # 密钥库口令,可选项
246          ├── -outFile         # 输出签名后的Provision Profile文件,p7b格式,必填项
247
2488.ProvisionProfile文件验签
249
250     verify-profile : ProvisionProfile文件验签
251           ├── -inFile       # 已签名的Provision Profile文件,p7b格式,必填项
252           ├── -outFil       # 验证结果文件(包含验证结果和profile内容),json格式,可选项;如果不填,则直接输出到控制台
253
2549.hap应用包签名
255
256     sign-app : hap应用包签名
257          ├── -mode          # 签名模式,必填项,包括localSign,remoteSign,remoteResign
258          ├── -keyAlias      # 密钥别名,必填项
259          ├──-keyPwd         # 密钥口令,可选项
260          ├── -appCertFile   # 应用签名证书文件(证书链,顺序为最终实体证书-中间CA证书-根证书),必填项
261          ├── -profileFile   # 签名后的Provision Profile文件名,profileSigned为1时为p7b格式,profileSigned为0时为json格式,必填项
262          ├── -profileSigned # 指示profile文件是否带有签名,1表示有签名,0表示没有签名,默认为1。可选项
263          ├── -inForm        # 输入的原始文件的格式,zip格式或bin格式,默认zip格式,可选项
264          ├── -inFile        # 输入的原始APP包文件,zip格式或bin格式,必填项
265          ├── -signAlg       # 签名算法,必填项,包括SHA256withECDSA / SHA384withECDSA
266          ├── -keystoreFile  # 密钥库文件,localSign模式时为必填项,JKS或P12格式
267          ├── -keystorePwd   # 密钥库口令,可选项
268          ├── -outFile       # 输出签名后的包文件,必填项
269
27010.hap应用包文件验签
271
272      verify-app : hap应用包文件验签
273         ├── -inFile          # 已签名的应用包文件,zip格式或bin格式,必填项
274         ├── -outCertchain    # 签名的证书链文件,必填项
275         ├── -outProfile      # 应用包中的profile文件,必填项
276
277
278
279
280#### 相关仓
281   不涉及