diff --git a/OAT.xml b/OAT.xml index 0f0759c0b04898d87e988005fa8f6942a44a2ebd..094d8dc73e574ef7df4168bbc5af573682a8c861 100644 --- a/OAT.xml +++ b/OAT.xml @@ -25,6 +25,7 @@ + @@ -34,6 +35,7 @@ + @@ -43,6 +45,7 @@ + diff --git a/README.md b/README.md index 0cea090fbac8c0594f3dc807da2dbf0f78bc1a1b..0b977a413fdffc38ac0d683d28a243a2e30c970b 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,15 @@ Code signing is enabled by default for hapsigner. If you do not need the mandato ## Build - 1. Check that Gradle 7.1 has been installed. + 1. Check that Maven 3 has been installed. - gradle -v + mvn -version 2. Download the code, open the directory **developtools_hapsigner/hapsigntool**, and run the following command to build the code: - gradle build or gradle jar + mvn package - 3. Check that **hap-sign-tool.jar** (binary files) is generated in the **./hap_sign_tool/build/libs** directory. + 3. Check that **hap-sign-tool.jar** (binary files) is generated in the **./hap_sign_tool/target** directory. ## Usage diff --git a/README_ZH.md b/README_ZH.md index f6f1cbb51138ca70f50ab34750a283c1dd8f90c2..84194d86b30605a0c4c3da04de74f399f3ddb45a 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -35,15 +35,15 @@ - 一键签名等脚本文件基于Python语言开发,使用需配置环境python3.5及以上。 #### 编译构建 - 1. 该工具基于Gradle 7.1编译构建,请确认环境已安装配置Gradle环境,并且版本正确 + 1. 该工具基于Maven3编译构建,请确认环境已安装配置Maven3环境,并且版本正确 - gradle -v + mvn -version 2. 下载代码,命令行打开文件目录至developtools_hapsigner/hapsigntool,执行命令进行编译打包 - gradle build 或者 gradle jar + mvn package - 3. 编译后得到二进制文件,目录为: ./hap_sign_tool/build/libs/hap-sign-tool.jar + 3. 编译后得到二进制文件,目录为: ./hap_sign_tool/target **** #### 说明 diff --git a/hapsigntool/hap_sign_tool/build.gradle b/hapsigntool/hap_sign_tool/build.gradle deleted file mode 100644 index 4f7b67b6ca60c51d60c2080ed5801e1e7f0a1a83..0000000000000000000000000000000000000000 --- a/hapsigntool/hap_sign_tool/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'java' - id 'application' -} - -group 'com.ohos' - - -repositories { - maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } -} - -dependencies { - implementation 'org.bouncycastle:bcpkix-jdk18on:1.76' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.18.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.18.0' - implementation 'com.google.code.gson:gson:2.9.0' - implementation project(':hap_sign_tool_lib') -} - -test { - useJUnitPlatform() -} - -jar { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - from sourceSets.main.output - - dependsOn configurations.runtimeClasspath - from { - configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) } - } - exclude 'META-INF/*.DF' - exclude 'META-INF/*.DSA' - - manifest { - attributes 'Main-Class': 'com.ohos.hapsigntool.HapSignTool' - } - - archiveBaseName = "hap-sign-tool" - -} \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool/pom.xml b/hapsigntool/hap_sign_tool/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..394098a9607904bfdf2bed1c8e61011d69408df8 --- /dev/null +++ b/hapsigntool/hap_sign_tool/pom.xml @@ -0,0 +1,122 @@ + + + + + com.ohos + hapsigntool + ${version} + + 4.0.0 + hap_sign_tool + + + + com.ohos + hap_sign_tool_lib + ${version} + + + com.google.code.gson + gson + + + org.bouncycastle + bcpkix-jdk18on + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-api + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + UTF-8 + true + + -Xlint:all + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + UTF-8 + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + hap-sign-tool + ../hap_sign_tool/build/libs + + + com.ohos.hapsigntool.HapSignTool + + + + + *:* + + + + + *:* + + **/module-info.class + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/DEPENDENCIES + META-INF/LICENSE + META-INF/NOTICE + META-INF/LICENSE.txt + META-INF/NOTICE.txt + META-INF/MANIFEST.MF + + + + + + + + \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/build.gradle b/hapsigntool/hap_sign_tool_lib/build.gradle deleted file mode 100644 index cbe1ca8338fe3920824c6496ae78609ca15890ec..0000000000000000000000000000000000000000 --- a/hapsigntool/hap_sign_tool_lib/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'java' -} - -group 'com.ohos' -version '1.0-SNAPSHOT' - - -repositories { - maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.18.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.18.0' - implementation 'org.bouncycastle:bcpkix-jdk18on:1.76' - implementation 'com.google.code.gson:gson:2.9.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/pom.xml b/hapsigntool/hap_sign_tool_lib/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..45e45e0a8275081fdfad493fdca9cd9ee8b37b64 --- /dev/null +++ b/hapsigntool/hap_sign_tool_lib/pom.xml @@ -0,0 +1,63 @@ + + + + + com.ohos + hapsigntool + ${version} + + 4.0.0 + hap_sign_tool_lib + + + + com.google.code.gson + gson + + + org.bouncycastle + bcpkix-jdk18on + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-api + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + UTF-8 + true + + -Xlint:all + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + + \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java index 65ce94357084dd2d947b5ce4f3614608fa3421c1..e8594f1db723992f0a1eca4ac73563909efcfab5 100644 --- a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java +++ b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java @@ -225,10 +225,10 @@ public class KeyStoreHelper { X509Certificate cert = (X509Certificate) certificate; try { cert.checkValidity(); - certificates.add(cert); } catch (CertificateExpiredException | CertificateNotYetValidException exception) { - logger.debug(exception.getMessage(), exception); + logger.info("p12's certificates is not valid"); } + certificates.add(cert); } /** diff --git a/hapsigntool/pom.xml b/hapsigntool/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b4df20c9c18c6ebe59f492ec81b3b0aae93e4ab1 --- /dev/null +++ b/hapsigntool/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + com.ohos + hapsigntool + ${version} + pom + + + 8 + 8 + UTF-8 + 4.0 + + + + hap_sign_tool + hap_sign_tool_lib + + + + + + com.google.code.gson + gson + 2.9.0 + + + org.bouncycastle + bcpkix-jdk18on + 1.76 + + + org.apache.logging.log4j + log4j-core + 2.18.0 + + + org.apache.logging.log4j + log4j-api + 2.18.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.2 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.2 + test + + + + \ No newline at end of file diff --git a/hapsigntool/settings.gradle b/hapsigntool/settings.gradle deleted file mode 100644 index 26ea2ad277faddd3ef7d5df984e3bbd6aed1c0e0..0000000000000000000000000000000000000000 --- a/hapsigntool/settings.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -rootProject.name = 'hapsigntool' -include 'hap_sign_tool_lib' -include 'hap_sign_tool' - diff --git a/hapsigntool/settings.xml b/hapsigntool/settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ffa83ab62d2f047aff4fc24a0b3d856e76d3423 --- /dev/null +++ b/hapsigntool/settings.xml @@ -0,0 +1,13 @@ + + + + + huawei cloud + * + Huawei Cloud Maven + https://mirrors.huaweicloud.com/repository/maven/ + + + \ No newline at end of file