需要sdk目录:
shell
sdk\10\toolchains\lib
需要修改UnsgnedDebugProfile文件的应用包名、权限、应用类型。
vbnet
sdk\10\toolchains\lib\UnsgnedDebugProfileTemplate和UnsgnedReleasedProfileTemplate
操作指南:

1.生成p12
shell
java -jar hap-sign-tool.jar generate-keypair -keyAlias "ohos-app" -keyAlg "ECC" -keySize "NIST-P-256" -keystoreFile "app.p12" -keyPwd "ohos123456" -keystorePwd "ohos123456"
2.生成csr
shell
java -jar hap-sign-tool.jar generate-csr -keyAlias "ohos-app" -keyPwd "ohos123456" -subject "C=CN,O=OpenHarmony,OU=OpenHarmony Team,CN=OpenHarmony Application Release" -signAlg "SHA256withRSA" -keystoreFile "app.p12" -keystorePwd "ohos123456" -outFile "app.csr"
3. 生成cer
shell
keytool -gencert -alias "OpenHarmony Application CA" -infile app.csr -outfile app-release.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 36500 -rfc
4.生成p7b
shell
java -jar hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "app-release-profile.p7b" -keyPwd "123456" -keystorePwd "123456"
5. 根据上面生成的证书和密码在DevEco Studio 配置。
如果根据上面的配置,生成的信息:
-
Store file(*.p12):app.12
-
keyAlias:ohos-app
-
Store Password:ohos123456
-
key Password:ohos123456
-
Profile file(*.p7b):app-release-profile.p7b
-
Certpath file(*.cer):app-release.cer