1dfe32fa1Soh_ci# ASSET 2dfe32fa1Soh_ci 3dfe32fa1Soh_ci## Introduction 4dfe32fa1Soh_ci 5dfe32fa1Soh_ciThe 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). 6dfe32fa1Soh_ci 7dfe32fa1Soh_ciThe following figure shows the ASSET architecture. 8dfe32fa1Soh_ci 9dfe32fa1Soh_ci 10dfe32fa1Soh_ci 11dfe32fa1Soh_ciAn application can perform the following operations using ASSET: 12dfe32fa1Soh_ci 13dfe32fa1Soh_ci- 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. 14dfe32fa1Soh_ci- Updating an asset: ASSET encrypts the new asset using the unique key of the application and updates the data in the database. 15dfe32fa1Soh_ci- 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. 16dfe32fa1Soh_ci- Removing an asset: ASSET removes the asset that matches the specified conditions. 17dfe32fa1Soh_ci 18dfe32fa1Soh_ciThe 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. 19dfe32fa1Soh_ci 20dfe32fa1Soh_ciFor 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. 21dfe32fa1Soh_ci 22dfe32fa1Soh_ciWith the APIs provided by ASSET, you can quickly integrate system-wide encrypted storage and access control mechanisms for short sensitive data. 23dfe32fa1Soh_ci 24dfe32fa1Soh_ci## Directory Structure 25dfe32fa1Soh_ci 26dfe32fa1Soh_ci```bash 27dfe32fa1Soh_ci├── frameworks # Framework code 28dfe32fa1Soh_ci│ ├── c # Code for interaction between C and Rust 29dfe32fa1Soh_ci│ ├── definition # Definitions of common data types 30dfe32fa1Soh_ci│ ├── ipc # IPC APIs 31dfe32fa1Soh_ci│ ├── js # Code for interaction between JS and C/C++ 32dfe32fa1Soh_ci│ ├── os_dependency # Adaptation of universal system capabilities 33dfe32fa1Soh_ci│ └── utils # Utility APIs 34dfe32fa1Soh_ci├── interfaces # APIs exposed externally 35dfe32fa1Soh_ci│ ├── inner_kits # APIs for system abilities (SAs) 36dfe32fa1Soh_ci│ └── kits # APIs for user applications 37dfe32fa1Soh_ci├── sa_profile # SA profiles 38dfe32fa1Soh_ci└── services # Service layer code 39dfe32fa1Soh_ci ├── constants # Constants of the service layer 40dfe32fa1Soh_ci ├── core_service # Core service module 41dfe32fa1Soh_ci ├── crypto_manager # Data encryption/decryption module 42dfe32fa1Soh_ci ├── db_key_operator # Database key management module 43dfe32fa1Soh_ci ├── db_operator # Data management module 44dfe32fa1Soh_ci └── os_dependency # System capability adaptation module 45dfe32fa1Soh_ci``` 46dfe32fa1Soh_ci 47dfe32fa1Soh_ci## Build 48dfe32fa1Soh_ci 49dfe32fa1Soh_ciThe following uses rk3568 as an example. 50dfe32fa1Soh_ci 51dfe32fa1Soh_ci```bash 52dfe32fa1Soh_ci# Build the source code of the module. 53dfe32fa1Soh_ci./build.sh --product-name rk3568 --ccache --build-target asset 54dfe32fa1Soh_ci 55dfe32fa1Soh_ci# Build the test code of the module. 56dfe32fa1Soh_ci./build.sh --product-name rk3568 --ccache --build-target asset_bin_test 57dfe32fa1Soh_ci``` 58dfe32fa1Soh_ci 59dfe32fa1Soh_ci## Usage 60dfe32fa1Soh_ci### Available APIs 61dfe32fa1Soh_ci 62dfe32fa1Soh_ci[API reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-asset-store-kit/Readme-EN.md) 63dfe32fa1Soh_ci 64dfe32fa1Soh_ci### Development Guide 65dfe32fa1Soh_ci 66dfe32fa1Soh_ci[Development guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AssetStoreKit/Readme-EN.md) 67dfe32fa1Soh_ci 68dfe32fa1Soh_ci## Repositories Involved 69dfe32fa1Soh_ci**[HUKS](https://gitee.com/openharmony/security_huks)** 70dfe32fa1Soh_ci 71dfe32fa1Soh_ci**[UserIAM](https://gitee.com/openharmony/useriam_user_auth_framework)** 72