1e41f4b71Sopenharmony_ci# General Process of Using a Key
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe key generated or imported can be used to perform the following operations to ensure data confidentiality and integrity:
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci- [Encryption and decryption](huks-encryption-decryption-overview.md)
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci- [Signing and signature verification](huks-signing-signature-verification-overview.md)
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci- [Key agreement](huks-key-agreement-overview.md)
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci- [Key derivation](huks-key-derivation-overview.md)
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciThe common operations provided do not include the secondary identity authentication for key access control. For details, see [HUKS Key Access Control](huks-identity-authentication-overview.md).
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## General Development Process
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciHUKS operates data based on a key session. The general process is as follows:
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci1. (Mandatory) Initialize a key session using [huks.initSession()](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksinitsession9).
24e41f4b71Sopenharmony_ci   You need to pass in the key alias and key operation parameters. A session handle will be returned after the initialization. The key operation parameters must contain the parameters required by the cipher algorithm, including the cipher algorithm, key size, key purpose, working mode, padding mode, hash mode, IV, nonce, and AAD.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci2. (Optional) Process data by segment using [huks.updateSession()](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksupdatesession9).
27e41f4b71Sopenharmony_ci   Process data by segment as required by the cryptographic algorithm in use or if the data to be processed exceeds 100 KB in size. Otherwise, skip this step.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci3. (Mandatory) Finish the key session using [huks.finishSession()](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksfinishsession9).
30e41f4b71Sopenharmony_ci   If the data is processes by segment, [huks.finishSession()] processes the last data segment and finishes the key session.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ciYou can use [huks.abortSession()](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksabortsession9) to abort the session if an error occurs in any of the preceding steps or the current key operation data is not required.
33