• Home
Name Date Size #Lines LOC

..--

config/build/12-May-2024-2925

figures/12-May-2024-

frameworks/12-May-2024-18,28614,849

interfaces/innerkits/12-May-2024-1,130528

test/12-May-2024-16,39011,903

BUILD.gnD12-May-20241.2 KiB3935

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-20244.6 KiB7427

README-en.mdD12-May-20243.6 KiB7149

README.mdD12-May-20243.4 KiB7353

bundle.jsonD12-May-20242.4 KiB7473

cf.gniD12-May-2024628 1513

README-en.md

1# Certificate Framework
2
3## Introduction
4The certificate framework shields the implementation differences of third-party certificate algorithm libraries. It provides the capabilities of parsing and verifying certificates, certificate extensions, and certificate revocation lists (CRLs), and verifying certificate chains. You can use the APIs provided by the certificate framework to easily complete your development.
5
6**Figure 1** Certificate framework architecture
7
8
9![](figures/certificate_framework_architecture.png)
10
11The certificate framework consists of the following:
12
13-   API layer: provides unified JavaScript interfaces to implement capabilities, including parsing certificates, certificate extensions, and CRLs and verifying certificate chains.
14    * Certificate operations include obtaining the version number, serial number (SN), issuer, subject, signature algorithm, and public key of the certificate based on the certificate data passed by the service.
15    * Certificate extension operations include obtaining the object identifier (OID) list of the certificate extensions based on the certificate extension fields passed by the service and obtaining specific data based on the OID.
16    * CRL operations include obtaining revoked certificates, SNs, issuers, and revocation time of the certificates based on the CRL.
17    * Certificate chain operations include verifying the validity of a certificate chain based on the certificate chain data passed by the service.
18-   Framework implementation layer: manages internal objects and flexibly loads the algorithm library adaptation layer to adapt to the algorithm and shield differences between the third-party algorithm libraries.
19-   Algorithm library adaptation layer: calls specific APIs of the OpenSSL or Mbed TLS algorithm library to provide capabilities, such as parsing certificates and obtaining certificate fields, for services.
20
21## Directory Structure
22```
23base/security/certificate_framwork
24├── bundle.json              # Component configuration file
25├── cf.gni                   # Compilation configuration file
26├── config                   # Configuration related to the build
27├── figures                  # Figures used in the README
28├── frameworks               # Framework implementation layer
29│   ├── ability              # Abilities of the framework layer
30│   ├── adapter              # Algorithm library adaptation layer
31│   ├── common               # Common methods relied on internally
32│   ├── core                 # Certificate framework implementation
33│   └── js
34│       └── napi             # JS interfaces encapsulated by NAPI
35├── interfaces               # APIs exposed externally
36└── test                     # Test cases
37```
38
39## Building the Certificate Framework
40
41In the root directory of the OpenHarmony source code, run the following command to separately build the certificate framework component:
42```shell
43./build.sh --product-name rk3568 --ccache --build-target certificate_framework
44```
45> **NOTE**
46>
47> --**product-name** indicates the product name, for example, **rk3568**.
48>
49> --**ccache** indicates the cache function used during the compilation.
50>
51> --**build-target** indicates the name of the component to build.
52
53
54## Usage
55
56### Available APIs
57
58
59
60### How to Use
61
62
63
64## Repositories Involved
65
66[Security subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/Security.md)
67
68[security\_crypto\_framework](https://gitee.com/openharmony/security_crypto_framework)
69
70[**security\_certificate\_framework**](https://gitee.com/openharmony-sig/security_certificate_framework)
71

README.md

1# 证书算法库框架
2
3## 简介
4证书算法库框架是一个屏蔽了第三方证书算法库实现差异的算法框架,提供证书、证书扩展域段、证书吊销列表的解析及校验能力,此外还提供了证书链的校验能力。开发者可以通过调用证书算法库框架接口,忽略底层不同三方算法库的差异,实现迅捷开发。
5
6**图 1**  证书算法库框架-架构图
7
8
9![](figures/zh-cn_certificate_framework_architecture.png)
10
11其中,
12
13-   API接口层:对外提供统一的JS接口,提供的能力包括:证书、证书扩展域段、证书吊销列表等解析能力,证书链的校验能力。
14    *   证书操作主要包含:根据业务传入的证书数据,获取证书的版本号、序列号、颁发者、主题、签名算法、公钥等。
15    *   证书扩展域段操作主要包含:根据业务传入的证书扩展域段数据,获取证书扩展域段的OID(对象标识符)列表,以及根据OID获取具体的数据。
16    *   证书吊销列表操作主要包含:根据证书吊销列表获取被吊销的证书,以及该证书的序列号、颁发者、被吊销时间等。
17    *   证书链操作主要包含:根据业务传入证书链数据,校验各级证书的签发关系有效。
18-   框架实现层:主要实现内部对象的管理,通过灵活加载算法库适配层,适配并屏蔽三方算法库的差异。
19-   算法库适配层:依赖OpenSSL或者Mbed TLS算法库调用其具体接口实现对上层业务提供的能力,例如实现证书的解析,获取证书的字段等能力。
20
21## 目录
22```
23base/security/certificate_framwork
24├── bundle.json              # 部件配置文件
25├── cf.gni                   # 编译配置文件
26├── config                   # 配置构建相关
27├── figures                  # README相关图片
28├── frameworks               # 框架实现层
29│   ├── ability              # 框架层能力注册
30│   ├── adapter              # 算法库适配层
31│   ├── common               # 内部依赖的公共方法
32│   ├── core                 # 证书算法库框架核心实现
33│   └── js
34│       └── napi             # 通过napi封装的JS接口代码实现
35├── interfaces               # 对外接口目录
36└── test                     # 测试用例
37```
38
39## 编译构建
40
41在OpenHarmony源码根目录下,调用以下指令,单独编译证书算法库框架部件。
42```shell
43./build.sh --product-name rk3568 --ccache --build-target certificate_framework
44```
45> **说明:**
46>
47> --product-name:产品名称,例如rk3568。
48>
49> --ccache:编译时使用缓存功能。
50>
51> --build-target: 编译的部件名称。
52
53## 约束
54
55[约束与限制](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/cert-overview.md)
56
57## 说明
58
59### 接口说明
60
61[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cert.md)
62
63### 使用说明
64
65[开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/cert-guidelines.md)
66
67## 相关仓
68
69[安全子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/安全子系统.md)
70
71[security\_crypto\_framework](https://gitee.com/openharmony/security_crypto_framework)
72
73[**security\_certificate\_framework**](https://gitee.com/openharmony-sig/security_certificate_framework)