diff --git a/interfaces/innerkits/code_sign_utils/include/constants.h b/interfaces/innerkits/code_sign_utils/include/constants.h index 0ffedfef03019cb933d8943ddb7da1bde51f2790..acbbf6986085668d3ce9a7d12df1cacdc0e52831 100644 --- a/interfaces/innerkits/code_sign_utils/include/constants.h +++ b/interfaces/innerkits/code_sign_utils/include/constants.h @@ -25,6 +25,8 @@ namespace Constants { const std::string FSV_SIG_SUFFIX = ".fsv-sig"; const std::string ENABLE_SIGNATURE_FILE_BASE_PATH = "/data/service/el1/public/bms/bundle_manager_service"; const std::string ENABLE_APP_BASE_PATH = "/data/app/el1/bundle/public"; +const std::string XPM_DEBUG_FS_MODE_PATH = "/proc/sys/kernel/xpm/xpm_mode"; +const std::string SUPPORT_OH_SDK_CODE_SIGN = "1"; } } } diff --git a/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp b/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp index 762526473d86e93c47ac414ff77902249660947a..7e7bfb29e94a422c695fdea48abcce1c5cb0a849 100644 --- a/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp +++ b/interfaces/innerkits/code_sign_utils/src/code_sign_utils.cpp @@ -14,7 +14,8 @@ */ #include "code_sign_utils.h" - +#include +#include #include #include #include @@ -321,7 +322,19 @@ int32_t CodeSignUtils::RemoveKeyInProfile(const std::string &bundleName) bool CodeSignUtils::isSupportOHCodeSign() { #ifdef SUPPORT_OH_CODE_SIGN - return true; + std::ifstream file(Constants::XPM_DEBUG_FS_MODE_PATH); + if (!file.is_open()) { + return false; + } + + std::string content; + file >> content; + file.close(); + + if (content == Constants::SUPPORT_OH_SDK_CODE_SIGN) { + return true; + } + return false; #else return false; #endif diff --git a/services/key_enable/config/trusted_cert_path_test.json b/services/key_enable/config/trusted_cert_path_test.json index 9ae3e27d1bf0c0179a4b11341429b3e4c68128f8..0802282ce32a8a9e8bf4354dc71a00dc492dcb97 100644 --- a/services/key_enable/config/trusted_cert_path_test.json +++ b/services/key_enable/config/trusted_cert_path_test.json @@ -71,6 +71,13 @@ "subject":"", "issuer":"", "max-certs-path":3 + }, + { + "mode":"Dev", + "type":"Authed", + "subject":"C=CN, O=Organization, OU=Unit, CN=ide_demo_app", + "issuer":"C=CN, O=OpenHarmony, OU=OpenHarmony Team, CN=OpenHarmony Application CA", + "max-certs-path":3 } ] } \ No newline at end of file