README.md
1# signcenter\_tool<a name="EN-US_TOPIC_0000001086718894"></a>
2
3- [Introduction](#section11660541593)
4- [Directory Structure](#section161941989596)
5- [Constraints](#section119744591305)
6- [Usage](#section1312121216216)
7
8## Introduction<a name="section11660541593"></a>
9
10During system building, OpenHarmony signs system applications to ensure their integrity and source reliability. This module provides a binary tool \(**hapsigntoolv2.jar**\) for signing OpenHarmony system applications.
11
12## Directory Structure<a name="section161941989596"></a>
13
14```
15/prebuilts/signcenter
16├── NOTICE # Open-source NOTICE file
17├── hapsigntool # Signing tool
18│ └── hapsigntoolv2.jar # OpenHarmony signing tool
19```
20
21## Constraints<a name="section119744591305"></a>
22
23Running environment: JDK 8
24
25## Usage<a name="section1312121216216"></a>
26
27The following is an example command for signing applications:
28
29```
30java -jar hapsigntoolv2.jar sign -mode localjks -privatekey "OpenHarmony Software Signature" -inputFile camera.hap -outputFile signed_camera.hap -signAlg SHA256withECDSA -keystore OpenHarmony.jks -keystorepasswd 123456 -keyaliaspasswd 123456 -profile camera_release.p7b -certpath OpenHarmony.cer -profileSigned 1
31```
32
33Descriptions of the fields in the preceding command:
34
35```
36hapsigntoolv2.jar: OpenHarmony signing tool
37-mode: signing mode. The OpenHarmony signing key pair is stored in the local keystore file. The signing mode is localjks.
38-privatekey: alias of the signing key pair
39-inputFile: application to be signed
40-outputFile: signed application
41-signAlg: signing algorithm
42-keystore: path of the keystore file
43-keystorepasswd: password of the keystore file. The default password of OpenHarmony.jks is 123456.
44-keyaliaspasswd: password of the signing key pair. The password of OpenHarmony Software Signature is 123456.
45-profile: a file declaring the capabilities and permissions of the application
46-certpath: path of the signing certificate
47-profileSigned: whether the application profile is signed. Value 1 indicates that the profile is signed; value 0 indicates the opposite. The default value is 1.
48```
49
50
README_zh.md
1# 签名工具仓<a name="ZH-CN_TOPIC_0000001086718894"></a>
2
3- [简介](#section11660541593)
4- [目录](#section161941989596)
5- [约束](#section119744591305)
6- [说明](#section1312121216216)
7
8## 简介<a name="section11660541593"></a>
9
10在OpenHarmony构建中需要对应用进行签名,以此保证应用完整性和来源可靠。本仓提供二进制签名工具(hapsigntoolv2.jar),用于OpenHarmony应用签名。
11
12## 目录<a name="section161941989596"></a>
13
14```
15/prebuilts/signcenter
16├── NOTICE # 开源NOTICE
17├── hapsigntool # 签名工具存放目录
18│ └── hapsigntoolv2.jar # OpenHarmony应用签名工具
19```
20
21## 约束<a name="section119744591305"></a>
22
23运行环境约束:JDK8
24
25## 说明<a name="section1312121216216"></a>
26
27签名命令示例:
28
29```
30java -jar hapsigntoolv2.jar sign -mode localjks -privatekey "OpenHarmony Software Signature" -inputFile camera.hap -outputFile signed_camera.hap -signAlg SHA256withECDSA -keystore OpenHarmony.jks -keystorepasswd 123456 -keyaliaspasswd 123456 -profile camera_release.p7b -certpath OpenHarmony.cer -profileSigned 1
31```
32
33关键字段说明:
34
35```
36hapsigntoolv2.jar :OpenHarmony签名工具
37-mode :签名模式。OpenHarmony签名密钥存放于本地keystore文件,因此签名模式选择localjks
38-privatekey:密钥对别名
39-inputFile :待签名的应用
40-outputFile:签名后的应用
41-signAlg : 签名算法
42-keystore:keystore文件路径
43-keystorepasswd:keystore的密码,OpenHarmony.jks的默认密码为123456
44-keyaliaspasswd:签名密钥的密码,密钥(OpenHarmony Software Signature)的默认密码为123456
45-profile :应用能力授权文件
46-certpath:签名证书文件路径
47-profileSigned:指示profile文件是否带有签名,1表示有签名,0表示没有签名,缺省值为1。
48```
49
50