Defines the macros, enumerated values, data structures, and error codes used by OpenHarmony Universal KeyStore (HUKS) APIs.
\@syscap SystemCapability.Security.Huks
**Since:**
9
## Summary
### Files
| Name | Description |
| -------- | -------- |
| [native_huks_type.h](native__huks__type_8h.md) | Defines the enumerated variables, structures, and macros used in the HUKS APIs. <br>File to Include: <huks/native_huks/native_huks_type.h> |
### Structs
| Name | Description |
| -------- | -------- |
| [OH_Huks_Result](_o_h___huks___result.md) | Defines the return data, including the result code and message. |
| [OH_Huks_Blob](_o_h___huks___blob.md) | Defines the structure for storing data. |
| [OH_Huks_Param](_o_h___huks___param.md) | Defines the parameter structure in a parameter set. |
| [OH_Huks_ParamSet](_o_h___huks___param_set.md) | Defines the structure of the parameter set. |
| [OH_Huks_CertChain](_o_h___huks___cert_chain.md) | Defines the structure of the certificate chain. |
| [OH_Huks_KeyInfo](_o_h___huks___key_info.md) | Defines the key information structure. |
| [OH_Huks_PubKeyInfo](_o_h___huks___pub_key_info.md) | Defines the structure of a public key. |
| [OH_Huks_KeyMaterialRsa](_o_h___huks___key_material_rsa.md) | Defines the structure of an RSA key. |
| [OH_Huks_KeyMaterialEcc](_o_h___huks___key_material_ecc.md) | Defines the structure of an ECC key. |
| [OH_Huks_KeyMaterialDsa](_o_h___huks___key_material_dsa.md) | Defines the structure of a DSA key. |
| [OH_Huks_KeyMaterialDh](_o_h___huks___key_material_dh.md) | Defines the structure of a DH key. |
| [OH_Huks_KeyMaterial25519](_o_h___huks___key_material25519.md) | Defines the structure of a 25519 key. |
| [OH_Huks_ImportKeyType](#oh_huks_importkeytype) { OH_HUKS_KEY_TYPE_PUBLIC_KEY = 0, OH_HUKS_KEY_TYPE_PRIVATE_KEY = 1, OH_HUKS_KEY_TYPE_KEY_PAIR = 2 } | Enumerates the types of keys to import. By default, a public key is imported. This field is not required when a symmetric key is imported. |
| [OH_Huks_ChallengeType](#oh_huks_challengetype) { OH_HUKS_CHALLENGE_TYPE_NORMAL = 0, OH_HUKS_CHALLENGE_TYPE_CUSTOM = 1, OH_HUKS_CHALLENGE_TYPE_NONE = 2 } | Enumerates the types of the challenges generated when a key is used. |
| [OH_Huks_ChallengePosition](#oh_huks_challengeposition) { OH_HUKS_CHALLENGE_POS_0 = 0, OH_HUKS_CHALLENGE_POS_1, OH_HUKS_CHALLENGE_POS_2, OH_HUKS_CHALLENGE_POS_3 } | Enumerates the positions of the 8-byte valid value in a custom challenge generated. |
| [OH_Huks_SecureSignType](#oh_huks_securesigntype) { OH_HUKS_SECURE_SIGN_WITH_AUTHINFO = 1 } | Enumerates the signature types of the keys generated or imported. |
| OH_HUKS_CHALLENGE_TYPE_NORMAL | Normal challenge, which is of 32 bytes by default. |
| OH_HUKS_CHALLENGE_TYPE_CUSTOM | Custom challenge, which supports only one authentication for multiple keys. The valid value of a custom challenge is of 8 bytes. |
| OH_HUKS_CHALLENGE_TYPE_NONE | Challenge is not required. |
| OH_HUKS_ECC_KEY_SIZE_256 | ECC key of 256 bits. |
| OH_HUKS_ECC_KEY_SIZE_384 | ECC key of 384 bits. |
| OH_HUKS_ECC_KEY_SIZE_521 | ECC key of 521 bits. |
| OH_HUKS_AES_KEY_SIZE_128 | Advanced Encryption Standard (AES) key of 128 bits. |
| OH_HUKS_AES_KEY_SIZE_192 | AES key of 192 bits. |
| OH_HUKS_AES_KEY_SIZE_256 | AES key of 256 bits. |
| OH_HUKS_AES_KEY_SIZE_512 | AES key of 512 bits. |
| OH_HUKS_CURVE25519_KEY_SIZE_256 | Curve25519 key of 256 bits. |
| OH_HUKS_DH_KEY_SIZE_2048 | Diffie-Hellman (DH) key of 2048 bits. |
| OH_HUKS_DH_KEY_SIZE_3072 | DH key of 3072 bits. |
| OH_HUKS_DH_KEY_SIZE_4096 | DH key of 4096 bits. |
| OH_HUKS_SM2_KEY_SIZE_256 | ShangMi2 (SM2) key of 256 bits. |
| OH_HUKS_SM4_KEY_SIZE_128 | ShangMi4 (SM4) key of 128 bits. |
### OH_Huks_KeyStorageType
```
enum OH_Huks_KeyStorageType
```
**Description**<br>
Enumerates the key storage modes.
| Name | Description |
| -------- | -------- |
| OH_HUKS_STORAGE_TEMP | The key is managed locally. |
| OH_HUKS_STORAGE_PERSISTENT | The key is managed by the HUKS service. |
### OH_Huks_SecureSignType
```
enum OH_Huks_SecureSignType
```
**Description**<br>
Enumerates the signature types of the keys generated or imported.
| Name | Description |
| -------- | -------- |
| OH_HUKS_SECURE_SIGN_WITH_AUTHINFO | The signature carries authentication information. This field is specified when a key is generated or imported. When the key is used to sign data, the data will be added with the authentication information and then be signed. |
### OH_Huks_Tag
```
enum OH_Huks_Tag
```
**Description**<br>
Enumerates the tag values used in parameter sets.
| Name | Description |
| -------- | -------- |
| OH_HUKS_TAG_ALGORITHM | Tags for key parameters. The value range is 1 to 200. Algorithm. |
| OH_HUKS_TAG_NONCE | Field for key encryption and decryption. |
| OH_HUKS_TAG_IV | Initialized vector (IV). |
| OH_HUKS_TAG_INFO | Information generated during key derivation. |
| OH_HUKS_TAG_SALT | Salt value used for key derivation. |
| OH_HUKS_TAG_ITERATION | Number of iterations for key derivation. |
| OH_HUKS_TAG_KEY_GENERATE_TYPE | Type of the generated key. For details, see [OH_Huks_KeyGenerateType](#oh_huks_keygeneratetype). |
| OH_HUKS_TAG_AGREE_ALG | Algorithm used in key agreement. |
| OH_HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | Alias of the public key used for key agreement. |
| OH_HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | Alias of the private key used for key agreement. |
| OH_HUKS_TAG_AGREE_PUBLIC_KEY | Public key used for key agreement. |
| OH_HUKS_TAG_KEY_ALIAS | Alias of the key. |
| OH_HUKS_TAG_DERIVE_KEY_SIZE | Size of the derived key. |
| OH_HUKS_TAG_IMPORT_KEY_TYPE | Type of the key to import. For details, see [OH_Huks_ImportKeyType](#oh_huks_importkeytype). |
| OH_HUKS_TAG_UNWRAP_ALGORITHM_SUITE | Algorithm suite required for encrypted imports. |
| OH_HUKS_TAG_ALL_USERS | Tags for access control and user authentication. The value range is 301 to 500. All users in the multi-user scenario. |
| OH_HUKS_TAG_USER_ID | Multi-user ID. |
| OH_HUKS_TAG_NO_AUTH_REQUIRED | Specifies whether key access control is required. |
| OH_HUKS_TAG_USER_AUTH_TYPE | User authentication type in key access control. |
| OH_HUKS_TAG_AUTH_TIMEOUT | Timeout duration for key access. |
| OH_HUKS_TAG_AUTH_TOKEN | Authentication token for the key. |
| OH_HUKS_TAG_KEY_AUTH_ACCESS_TYPE | Access control type. For details, see [OH_Huks_AuthAccessType](#oh_huks_authaccesstype). This parameter must be set together with the user authentication type. |
| OH_HUKS_TAG_KEY_SECURE_SIGN_TYPE | Signature type for the key to be generated or imported. |
| OH_HUKS_TAG_CHALLENGE_TYPE | Challenge type. For details, see [OH_Huks_ChallengeType](#oh_huks_challengetype). |
| OH_HUKS_TAG_CHALLENGE_POS | Position of the 8-byte valid value in a custom challenge. For details, see [OH_Huks_ChallengePosition](#oh_huks_challengeposition). |
| OH_HUKS_TAG_ATTESTATION_CHALLENGE | Tags for key attestation. The value range is 501 to 600. Challenge value used in the attestation. |
| OH_HUKS_TAG_ATTESTATION_APPLICATION_ID | Application ID used in the attestation. |
| OH_HUKS_TAG_ATTESTATION_ID_ALIAS | Alias of the key. |
| OH_HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | Security level used in the attestation. |
| OH_HUKS_TAG_ATTESTATION_ID_VERSION_INFO | Version information used in the attestation. |
| OH_HUKS_TAG_IS_KEY_ALIAS | 601 to 1000 are reserved for other tags.<br/>Extended tags. The value range is 1001 to 9999. Specifies whether it is a key alias. |
| OH_HUKS_TAG_KEY_STORAGE_FLAG | Key storage mode. For details, see [OH_Huks_KeyStorageType](#oh_huks_keystoragetype). |
| OH_HUKS_TAG_IS_ALLOWED_WRAP | Specifies whether to allow the key to be wrapped. |
| OH_HUKS_TAG_KEY_WRAP_TYPE | Key wrap type. |
| OH_HUKS_TAG_KEY_AUTH_ID | Authentication ID. |
| OH_HUKS_TAG_KEY_ROLE | Role of the key. |
| OH_HUKS_TAG_KEY_FLAG | Key flag. For details, see [OH_Huks_KeyFlag](#oh_huks_keyflag). |
| OH_HUKS_TAG_IS_ASYNCHRONIZED | Specifies whether this API is asynchronous. |
| OH_HUKS_TAG_KEY_DOMAIN | Key domain. |
| OH_HUKS_TAG_SYMMETRIC_KEY_DATA | 11000 to 12000 are reserved.<br/>20001 to N are reserved for other tags. Symmetric key data. |
| OH_HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | Public key data of the asymmetric key pair. |
| OH_HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | Private key data of the asymmetric key pair. |