• Home
Name Date Size #Lines LOC

..--

etc/init/12-May-2024-4643

figures/12-May-2024-

frameworks/12-May-2024-2,4351,631

interfaces/12-May-2024-1,445777

sa_profile/12-May-2024-3330

services/12-May-2024-5,4333,850

test/unittest/12-May-2024-4,5593,086

.gitignoreD12-May-202437 54

BUILD.gnD12-May-20241.3 KiB4338

Cargo.tomlD12-May-2024934 2826

LICENSED12-May-202410.1 KiB177150

README.mdD12-May-20243.7 KiB7048

README_zh.mdD12-May-20243.9 KiB6948

asset.gniD12-May-2024616 1513

bundle.jsonD12-May-20242.4 KiB8483

hisysevent.yamlD12-May-20241.2 KiB3015

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│   ├── definition          # Definitions of common data types
29│   ├── ipc                 # IPC APIs
30│   ├── js                  # Code for interaction between JS and C/C++
31│   ├── os_dependency       # Adaptation of universal system capabilities
32│   └── utils               # Utility APIs
33├── interfaces              # APIs exposed externally
34│   ├── inner_api           # APIs for system abilities (SAs)
35│   └── kits                # APIs for user applications
36├── sa_profile              # SA profiles
37└── services                # Service layer code
38    ├── constants           # Constants of the service layer
39    ├── core_service        # Core service module
40    ├── crypto_manager      # Data encryption/decryption module
41    ├── db_operator         # Data management module
42    └── os_dependency       # System capability adaptation module
43```
44
45## Build
46
47The following uses rk3568 as an example.
48
49```bash
50# Build the source code of the module.
51./build.sh --product-name rk3568 --ccache --build-target asset
52
53# Build the test code of the module.
54./build.sh --product-name rk3568 --ccache --build-target asset_bin_test
55```
56
57## Usage
58### Available APIs
59
60[API reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-asset-store-kit/Readme-EN.md)
61
62### Development Guide
63
64[Development guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AssetStoreKit/Readme-EN.md)
65
66## Repositories Involved
67**[HUKS](https://gitee.com/openharmony/security_huks)**
68
69**[UserIAM](https://gitee.com/openharmony/useriam_user_auth_framework)**
70

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│   ├── definition          # 通用数据类型定义
29│   ├── ipc                 # IPC接口定义
30│   ├── js                  # JS-C/C++交互模块
31│   ├── os_dependency       # 通用系统能力适配模块
32│   └── utils               # 工具方法
33├── interfaces              # 对外提供的接口
34│   ├── inner_api           # 提供给系统服务调用的接口
35│   └── kits                # 提供给应用调用的接口
36├── sa_profile              # 系统服务配置文件
37└── services                # 服务层代码
38    ├── constants           # 服务层常量定义
39    ├── core_service        # 核心处理模块
40    ├── crypto_manager      # 数据加密模块
41    ├── db_operator         # 数据管理模块
42    └── os_dependency       # 系统能力适配模块
43```
44
45## 编译构建
46
47以rk3568为例,编译命令如下:
48
49```bash
50# 本模块源码编译命令
51./build.sh --product-name rk3568 --ccache --build-target asset
52
53# 本模块测试代码编译命令
54./build.sh --product-name rk3568 --ccache --build-target asset_bin_test
55```
56
57## 说明
58### 接口说明
59
60[接口文档](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-asset-store-kit/Readme-CN.md)
61
62### 使用说明
63
64[开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AssetStoreKit/Readme-CN.md)
65
66## 相关仓
67**[通用密钥库系统(HUKS)](https://gitee.com/openharmony/security_huks)**
68
69**[统一用户认证(UserIAM)](https://gitee.com/openharmony/useriam_user_auth_framework)**