get xpm mode status

Signed-off-by: yeyuning <yeyuning2@huawei.com>
Change-Id: Ibcd7e3cade882062494edebdd9102ae6e2faef83
This commit is contained in:
yeyuning 2023-12-13 15:50:24 +08:00
parent 3a65f69755
commit e6b64ceb4e
3 changed files with 24 additions and 2 deletions

View File

@ -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";
}
}
}

View File

@ -14,7 +14,8 @@
*/
#include "code_sign_utils.h"
#include <fstream>
#include <string>
#include <asm/unistd.h>
#include <cstdlib>
#include <cstdint>
@ -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

View File

@ -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
}
]
}