1# 代码签名 2 3## 简介 4 5代码签名部件用于支持OpenHarmony的代码签名机制。OpenHarmony使用代码签名提供运行时应用程序的完整性保护,校验应用来源的合法性。 6代码签名部件主要提供如下功能: 7 8- 提供可信代码签名证书写入内核能力 9- 提供代码签名使能能力 10- 提供本地代码签名能力 11 12## 目录 13 14``` 15/base/security/code_signature 16├── interfaces # 接口层 17│ └── innerkits # 18│ ├── code_sign_utils # 使能接口 19│ ├── common # 公共基础能力 20│ └── local_code_sign # 本地签名接口 21├── services # 服务层 22│ ├── key_enable # 证书初始化 23│ └── local_code_sign # 本地签名服务 24├── test # 测试用例 25│ ├── fuzztest # fuzz测试用例 26│ └── unittest # 单元测试用例 27└── utils # 公共基础能力 28``` 29 30## 使用 31### 接口说明 32 33| **接口声明** | **接口描述** | 34| --- | --- | 35| int32_t EnforceCodeSignForApp(const EntryMap &entryPath, const std::string &signatureFile); | 对hap使能代码签名 | 36| int32_t EnforceCodeSignForFile(const std::string &path, const ByteBuffer &signature); | 对文件使能代码签名 | 37| int32_t SignLocalCode(const std::string &filePath, ByteBuffer &signature); | 本地代码签名 | 38 39### 签名工具使用指南 40 41**[使用指南](https://gitee.com/openharmony/developtools_hapsigner/blob/master/codesigntool/README_zh.md)** 42 43## 相关仓 44 45**[developtools\_hapsigner](https://gitee.com/openharmony/developtools_hapsigner/blob/master/codesigntool/README_zh.md)** 46 47**[third\_party\_fsverity-utils](https://gitee.com/openharmony/third_party_fsverity-utils/blob/master/README_zh.md)** 48