diff --git a/OAT.xml b/OAT.xml index 17c700accc65a0f1a024472ac62923e3cb91602b..a492029386435e9e807e3cdcfd932d2e19d23abe 100644 --- a/OAT.xml +++ b/OAT.xml @@ -51,6 +51,7 @@ + diff --git a/doc/Instructions.md b/doc/Instructions.md index 9ad3abb55d706eadb2a002fedf67512eaa772f1e..2c067cf594620cdb51441f010dfd05998c8605e8 100644 --- a/doc/Instructions.md +++ b/doc/Instructions.md @@ -86,8 +86,28 @@ this.title = this.$r('app.string.hello_world'); ## 签名打包 ### 签名 #### 签名文件的获取 -1. 拷贝OpenHarmony标准版 工程的 prebuilts\signcenter 目录到操作目录 -2. 拷贝SystemUI 工程的 signature\systemui.p7b 到该目录下 +1. 方式一:拷贝OpenHarmony标准版工程的 **prebuilts/signcenter/key/OpenHarmony.p12** 文件到SystemUI 工程的 signature目录 +2. 方式二:拷贝OpenHarmony SDK目录下的 **Sdk/toolchains/lib/OpenHarmony.p12** 文件到SystemUI 工程的 signature目录 +3. OpenHarmony.p12 文件信息 + - OpenHarmony.p12 文件的Alias别名为:`Openharmony Application Release` + - OpenHarmony.p12 文件的Password密码为:`123456` + +#### 证书文件的生成 + +1. 添加keytool命令到系统环境变量 + - keytool(keytool.exe)命令在DevEco Studio安装目录的**jbr\bin**文件夹下。 + - 复制DevEco Studio安装目录的**jbr\bin**文件夹的绝对路径,添加到Path系统环境变量中; + +2. 执行 `pfile2cer.bat` 脚本生成证书文件 + - 在DevEco Studio的Terminal终端中执行pfile2cer.bat脚本 + - 提示输入密钥库口令时,输入 `123456` 即可 + + ![image-20211221094541594](../figures/signature_cer_1.png) + + - 在SystemUI工程的 signature 目录下,将会自动生成 `OpenHarmonyApplication.cer` 和 `OpenHarmonyApplication.csr` 两个证书文件。 + + ![image-20211221095153641](../figures/signature_cer_2.png) + #### 签名文件的配置 打开项目工程,选择 File → Project Structure diff --git a/figures/signature_cer_1.png b/figures/signature_cer_1.png new file mode 100644 index 0000000000000000000000000000000000000000..86f01d5de8eaa61d2d3ffc52473e9b774d79527e Binary files /dev/null and b/figures/signature_cer_1.png differ diff --git a/figures/signature_cer_2.png b/figures/signature_cer_2.png new file mode 100644 index 0000000000000000000000000000000000000000..3cf8a68389ef52d0e067e157c56adde1bd8e26f2 Binary files /dev/null and b/figures/signature_cer_2.png differ diff --git a/pfile2cer.bat b/pfile2cer.bat new file mode 100644 index 0000000000000000000000000000000000000000..8fccaa005040addd362602d048bfd1bc32945414 --- /dev/null +++ b/pfile2cer.bat @@ -0,0 +1,22 @@ +@rem +@rem Copyright (c) 2021 Talkweb Co., Ltd. +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@echo off +echo %~dp0 +set signature_path=%~dp0/signature/ + +keytool -certreq -alias "OpenHarmony Application Release" -keystore %signature_path%/OpenHarmony.p12 -storetype pkcs12 -file %signature_path%/OpenHarmonyApplication.csr + +keytool -gencert -alias "OpenHarmony Application CA" -infile %signature_path%/OpenHarmonyApplication.csr -outfile %signature_path%/OpenHarmonyApplication.cer -keystore %signature_path%/OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc