代码拉取完成,页面将自动刷新
代码签名部件用于支持OpenHarmony的代码签名机制。OpenHarmony使用代码签名提供运行时应用程序的完整性保护,校验应用来源的合法性。
代码签名部件架构图
代码签名部件主要提供如下模块功能:
/base/security/code_signature
├── interfaces # 接口层
│ └── innerkits #
│ ├── code_sign_attr_utils # 属性设置接口
│ ├── code_sign_utils # 使能接口
│ ├── common # 公共基础能力
│ ├── jit_code_sign # JIT代码签名
│ └── local_code_sign # 本地签名
├── services # 服务层
│ ├── key_enable # 证书初始化
│ └── local_code_sign # 本地签名服务
├── test # 测试用例
│ ├── fuzztest # fuzz测试用例
│ └── unittest # 单元测试用例
└── utils # 公共基础能力
接口声明 | 接口描述 |
---|---|
int32_t EnforceCodeSignForApp(const EntryMap &entryPath, const std::string &signatureFile); | 对hap使能代码签名 |
int32_t EnforceCodeSignForApp(const std::string &path, const EntryMap &entryPathMap, FileType type); | 对hap使能代码签名 |
int32_t EnforceCodeSignForFile(const std::string &path, const ByteBuffer &signature); | 对文件使能代码签名 |
int32_t EnforceCodeSignForAppWithOwnerId(std::string ownerId, const std::string &path, const EntryMap &entryPathMap, FileType type); | 对hap使能代码签名和OwnerId校验 |
int ParseOwnerIdFromSignature(const ByteBuffer &sigbuffer, std::string &ownerID); | 从签名中解析OwnerId |
int32_t EnableKeyInProfile(const std::string &bundleName, const ByteBuffer &profileBuffer); | 信任开发者证书 |
int32_t RemoveKeyInProfile(const std::string &bundleName); | 撤销已信任的开发者证书 |
int32_t InitLocalCertificate(ByteBuffer &cert); | 初始化本地签名证书 |
int32_t SignLocalCode(const std::string &filePath, ByteBuffer &signature); | 本地代码签名 |
int32_t SignLocalCode(const std::string &ownerID, const std::string &filePath, ByteBuffer &signature); | 带OwnerId的本地代码签名 |
int InitXpmRegion(void); | 初始化XPM地址 |
int SetXpmOwnerId(uint32_t idType, const char *ownerId); | 设置OwnerId |
int32_t RegisterTmpBuffer(JitCodeSignerBase *signer, void *tmpBuffer); | 注册临时Buffer起始地址 |
int32_t AppendInstruction(JitCodeSignerBase *signer, Instr instr); | 对添加到临时Buffer的指令签名 |
int32_t AppendData(JitCodeSignerBase *signer, const void *const data, uint32_t size); | 对添加到临时Buffer的数据签名 |
int32_t WillFixUp(JitCodeSignerBase *signer, uint32_t n = 1); | 声明下n条指令待更新 |
int32_t PatchInstruction(JitCodeSignerBase *signer, int offset, Instr instr); | 更新缓冲区的偏移处指令签名 |
int32_t PatchInstruction(JitCodeSignerBase *signer, void *address, Instr insn); | 更新对应地址指令签名 |
int32_t PatchData(JitCodeSignerBase *signer, int offset, const void *const data, uint32_t size); | 更新缓冲区偏移处数据签名 |
int32_t PatchData(JitCodeSignerBase *signer, void *address, const void *const data, uint32_t size); | 更新对应地址数据签名 |
int32_t ResetJitCode(void *jitMemory, int size); | 重置JIT内存 |
int32_t CopyToJitCode(JitCodeSignerBase *signer, void *jitMemory, void *tmpBuffer, int size); | 将JIT代码复制到JIT内存 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。