• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..17-Mar-2025-

etc/init/H17-Mar-2025-5450

figures/H17-Mar-2025-

frameworks/H17-Mar-2025-4,3132,900

interfaces/H17-Mar-2025-2,140864

sa_profile/H17-Mar-2025-5350

services/H17-Mar-2025-8,5076,272

test/unittest/H17-Mar-2025-5,3673,708

.gitignoreH A D17-Mar-202537 54

BUILD.gnH A D17-Mar-20251.5 KiB4540

Cargo.tomlH A D17-Mar-2025970 2927

LICENSEH A D17-Mar-202510.1 KiB177150

OAT.xmlH A D17-Mar-20254.7 KiB7528

README.mdH A D17-Mar-20253.8 KiB7250

README_zh.mdH A D17-Mar-20254 KiB7150

bundle.jsonH A D17-Mar-20252.5 KiB8483

config.gniH A D17-Mar-2025676 1816

hisysevent.yamlH A D17-Mar-20251.2 KiB3027

rustfmt.tomlH A D17-Mar-2025731 2018

README.md

1# ASSET
2
3## Introduction
4
5The asset store service (ASSET) provides secure storage and management of sensitive data less than 1024 bytes in size, including passwords, app tokens, and other critical data (such as bank card numbers).
6
7The following figure shows the ASSET architecture.
8
9![ASSET Architecture](figures/asset-architecture-en.png)
10
11An application can perform the following operations using ASSET:
12
13- Adding an asset: ASSET generates a unique key for the application, uses the key to encrypt the asset, and stores the encrypted asset in the database.
14- Updating an asset: ASSET encrypts the new asset using the unique key of the application and updates the data in the database.
15- Querying an asset: ASSET obtains the asset ciphertext from the database based on the query conditions specified, verifies the access permission of the application, uses the unique key of the application to decrypt the asset ciphertext, and returns the plaintext to the application.
16- Removing an asset: ASSET removes the asset that matches the specified conditions.
17
18The secure storage of assets depends on the underlying HUKS. Specifically, HUKS implements the asset encryption, decryption, and access control in a secure environment (such as a TEE). The sensitive user data will never be disclosed even if the system is attacked.
19
20For the scenarios demanding higher security, ASSET allows access to assets only after a successful user identity authentication. Before accessing assets that require identity access control, an application needs to launch a user prompt for user identity authentication (PIN, fingerprint, or facial authentication). After the application sends the user authentication result to ASSET, ASSET invokes HUKS to verify the authentication result. If the verification is successful, HUKS decrypts the asset in a secure environment and returns the plaintext.
21
22With the APIs provided by ASSET, you can quickly integrate system-wide encrypted storage and access control mechanisms for short sensitive data.
23
24## Directory Structure
25
26```bash
27├── frameworks              # Framework code
28│   ├── c                   # Code for interaction between C and Rust
29│   ├── definition          # Definitions of common data types
30│   ├── ipc                 # IPC APIs
31│   ├── js                  # Code for interaction between JS and C/C++
32│   ├── os_dependency       # Adaptation of universal system capabilities
33│   └── utils               # Utility APIs
34├── interfaces              # APIs exposed externally
35│   ├── inner_kits          # APIs for system abilities (SAs)
36│   └── kits                # APIs for user applications
37├── sa_profile              # SA profiles
38└── services                # Service layer code
39    ├── constants           # Constants of the service layer
40    ├── core_service        # Core service module
41    ├── crypto_manager      # Data encryption/decryption module
42    ├── db_key_operator     # Database key management module
43    ├── db_operator         # Data management module
44    └── os_dependency       # System capability adaptation module
45```
46
47## Build
48
49The following uses rk3568 as an example.
50
51```bash
52# Build the source code of the module.
53./build.sh --product-name rk3568 --ccache --build-target asset
54
55# Build the test code of the module.
56./build.sh --product-name rk3568 --ccache --build-target asset_bin_test
57```
58
59## Usage
60### Available APIs
61
62[API reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-asset-store-kit/Readme-EN.md)
63
64### Development Guide
65
66[Development guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AssetStoreKit/Readme-EN.md)
67
68## Repositories Involved
69**[HUKS](https://gitee.com/openharmony/security_huks)**
70
71**[UserIAM](https://gitee.com/openharmony/useriam_user_auth_framework)**
72

README_zh.md

1# 关键资产存储服务(ASSET)
2
3## 简介
4
5关键资产存储服务(ASSET),提供了用户短敏感数据的安全存储及管理能力。其中,短敏感数据可以是密码类(账号/密码)、Token类(应用凭据)、其他关键明文(如银行卡号)等长度较短的用户敏感数据。
6
7关键资产存储服务的架构如下图所示。
8
9![ASSET架构图](figures/asset-architecture.png)
10
11应用接入关键资产存储服务后,可以进行如下操作:
12
13- 新增关键资产,ASSET 首先为应用生成独属于它的密钥,然后使用该密钥对关键资产进行加密,最后将关键资产密文存储到数据库。
14- 更新关键资产,ASSET 使用独属于该应用的密钥,对新的关键资产进行加密,并覆盖数据库中的相应记录。
15- 查询关键资产,ASSET 首先根据应用指定的查询条件,从数据库中读取关键资产密文,然后校验应用的访问控制权限,验证通过后,使用独属于该应用的密钥,对关键资产密文进行解密,最后将明文数据返回给应用。
16- 删除关键资产,ASSET 根据应用指定的删除条件,从数据库中查找并删除符合条件的关键资产记录。
17
18关键资产的安全存储,依赖底层的通用密钥库系统。具体来说,关键资产的加/解密操作以及访问控制校验,都由通用密钥库系统在安全环境(如可信执行环境)中完成,即使系统被攻破,也能保证用户敏感数据不发生泄露。
19
20针对安全性要求更高的场景,ASSET 支持应用存储需要用户身份认证通过才允许访问的关键资产。具体来说,应用在读取此类关键资产时,需要先拉起统一用户认证服务,提示用户通过锁屏密码、指纹、人脸等方式进行身份认证;应用将用户身份认证结果传递给 ASSET 后,ASSET 会请求通用密钥库系统,在安全环境校验认证结果,验证通过后才继续在安全环境解密关键资产。
21
22使用关键资产存储服务提供的接口,开发者可以快速集成平台级别、面向短敏感数据的加密存储和访问控制机制,帮助用户方便、安全地管理密码等数据。
23
24## 目录
25
26```bash
27├── frameworks              # 框架层代码
28│   ├── c                   # C-Rust交互模块
29│   ├── definition          # 通用数据类型定义
30│   ├── ipc                 # IPC接口定义
31│   ├── js                  # JS-C/C++交互模块
32│   ├── os_dependency       # 通用系统能力适配模块
33│   └── utils               # 工具方法
34├── interfaces              # 对外提供的接口
35│   ├── inner_kits          # 提供给系统服务调用的接口
36│   └── kits                # 提供给应用调用的接口
37├── sa_profile              # 系统服务配置文件
38└── services                # 服务层代码
39    ├── constants           # 服务层常量定义
40    ├── core_service        # 核心处理模块
41    ├── crypto_manager      # 数据加密模块
42    ├── db_key_operator     # 数据库密钥管理模块
43    ├── db_operator         # 数据管理模块
44    └── os_dependency       # 系统能力适配模块
45```
46
47## 编译构建
48
49以rk3568为例,编译命令如下:
50
51```bash
52# 本模块源码编译命令
53./build.sh --product-name rk3568 --ccache --build-target asset
54
55# 本模块测试代码编译命令
56./build.sh --product-name rk3568 --ccache --build-target asset_bin_test
57```
58
59## 说明
60### 接口说明
61
62[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-asset-store-kit/Readme-CN.md)
63
64### 使用说明
65
66[开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AssetStoreKit/Readme-CN.md)
67
68## 相关仓
69**[通用密钥库系统(HUKS)](https://gitee.com/openharmony/security_huks)**
70
71**[统一用户认证(UserIAM)](https://gitee.com/openharmony/useriam_user_auth_framework)**