@@ -7,36 +7,35 @@ Describes the OpenHarmony Universal KeyStore (HUKS) capabilities, including key
\@syscap SystemCapability.Security.Huks
**Since:**
**Since**:
9
## Summary
### Files
| Name | Description |
| Name| Description|
| -------- | -------- |
| [native_huks_api.h](native__huks__api_8h.md) | Declares the APIs used to access the HUKS.<br>File to Include: <huks/native_huks/api.h> |
| [native_huks_api.h](native__huks__api_8h.md) | Declares the APIs used to access the HUKS.<br>**File to include**: <huks/native_huks/api.h><br>**Library**: libhuks_ndk.z.so |
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| [OH_Huks_GetSdkVersion](#oh_huks_getsdkversion)(struct[OH_Huks_Blob](_o_h___huks___blob.md) \*sdkVersion) | Obtains the current HUKS SDK version. |
| [OH_Huks_InitSession](#oh_huks_initsession)(const struct [OH_Huks_Blob](_o_h___huks___blob.md)\*keyAlias, const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, struct [OH_Huks_Blob](_o_h___huks___blob.md)\*handle, struct [OH_Huks_Blob](_o_h___huks___blob.md)\*challenge) | Initializes the key session interface and obtains a handle (mandatory) and challenge value (optional). |
| [OH_Huks_AttestKeyItem](#oh_huks_attestkeyitem)(const struct [OH_Huks_Blob](_o_h___huks___blob.md)\*keyAlias, const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, struct [OH_Huks_CertChain](_o_h___huks___cert_chain.md)\*certChain) | Obtains the certificate chain of a key. |
| [OH_Huks_InitSession](#oh_huks_initsession)(const struct [OH_Huks_Blob](_o_h___huks___blob.md)\*keyAlias, const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, struct [OH_Huks_Blob](_o_h___huks___blob.md)\*handle, struct [OH_Huks_Blob](_o_h___huks___blob.md)\*token) | Initializes a key session to obtain a handle (mandatory) and a token (optional). |
| [OH_Huks_UpdateSession](#oh_huks_updatesession)(const struct [OH_Huks_Blob](_o_h___huks___blob.md)\*handle, const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, const struct [OH_Huks_Blob](_o_h___huks___blob.md)\*inData, struct [OH_Huks_Blob](_o_h___huks___blob.md)\*outData) | Adds data by segment for the key operation, performs the related key operation, and outputs the processed data. |
| keyAlias | Indicates the pointer to the alias of the key to generate. The alias must be unique in the process of the service. Otherwise, the key will be overwritten. |
| paramSetIn | Indicates the pointer to the parameter set for generating the key. |
| keyAlias | Indicates the pointer to the alias of the key to generate. The alias must be unique in the process of the service. |
| paramSetIn | Indicates the pointer to the parameters for generating the key. |
| paramSetOut | Indicates the pointer to a temporary key generated. If the generated key is not of a temporary type, this parameter is a null pointer. |
**Returns**
...
...
@@ -196,16 +201,17 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is
| keyAlias | Indicates the pointer to the alias of the key to import. The alias must be unique in the process of the service. Otherwise, the key will be overwritten. |
| paramSet | Indicates the pointer to the parameters of the key to import. |
| key | Indicates the pointer to the key to import. The key must be in the format required by the HUKS. For details, see [HuksTypeApi](_huks_type_api.md). |
| keyAlias | Indicates the pointer to the alias of the key to import. The alias must be unique in the process of the service. |
| paramSet | Indicates the pointer to the properties of the key to import. |
| key | Indicates the pointer to the key to import. The key data must be in format defined in [HuksTypeApi](_huks_type_api.md). |
**Returns**
...
...
@@ -260,17 +268,18 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is
| keyAlias | Indicates the pointer to the alias of the key to import. The alias must be unique in the process of the service. Otherwise, the key will be overwritten. |
| keyAlias | Indicates the pointer to the alias of the key to import. The alias must be unique in the process of the service. |
| wrappingKeyAlias | Indicates the pointer to the alias of the wrapping key, which is obtained through key agreement and used to decrypt the key to import. |
| paramSet | Indicates the pointer to the parameters of the wrapped key to import. |
| wrappedKeyData | Indicates the pointer to the wrapped key to import. The key must be in the format required by the HUKS. For details, see [OH_Huks_AlgSuite](_huks_type_api.md#oh_huks_algsuite). |
| paramSet | Indicates the pointer to the parameters for importing the wrapped key. |
| wrappedKeyData | Indicates the pointer to the wrapped key to import. The data must be in the format defined in [OH_Huks_AlgSuite](_huks_type_api.md#oh_huks_algsuite).|
**Returns**
...
...
@@ -281,25 +290,26 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is
Initializes the key session interface and obtains a handle (mandatory) and challenge value (optional).
**Description**
**Parameters**
Initializes a key session to obtain a handle (mandatory) and a token (optional).
| Name | Description |
**Parameters**
| Name| Description|
| -------- | -------- |
| keyAlias | Indicates the pointer to the alias of the target key. |
| paramSet | Indicates the pointer to the parameters for the initialization operation. |
| handle | Indicates the pointer to the handle of the key session obtained. This handle is required for subsequent operations, including [OH_Huks_UpdateSession](#oh_huks_updatesession), [OH_Huks_FinishSession](#oh_huks_finishsession), and [OH_Huks_AbortSession](#oh_huks_abortsession). |
| challenge | Indicates the pointer to the challenge value obtained. |
| handle | Indicates the pointer to the handle of the key session. This handle is required for subsequent operations of the same key, including [OH_Huks_UpdateSession](#oh_huks_updatesession), [OH_Huks_FinishSession](#oh_huks_finishsession), and [OH_Huks_AbortSession](#oh_huks_abortsession). |
| token | Indicates the pointer to the token used for key access control. |
**Returns**
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
**See**
**See**
[OH_Huks_UpdateSession](#oh_huks_updatesession)
...
...
@@ -314,23 +324,20 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is
| keyAlias | Indicates the pointer to the alias of the target key. |
| paramSet | Indicates the pointer to the attribute tag required for checking the key. By default, this parameter is a null pointer. |
| keyAlias | Indicates the pointer to the alias of the key to check. |
| paramSet | Indicates the pointer to the parameters required for checking the key. By default, this parameter is a null pointer. |
**Returns**
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the key exists.
Returns [OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST](_huks_type_api.md) if the key does not exist.
Returns any other error code for other cases.
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the key exists.<br>Returns [OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST](_huks_type_api.md) if the key does not exist.<br>Returns any other error code for other cases.
### OH_Huks_UpdateSession()
...
...
@@ -339,23 +346,24 @@ Returns any other error code for other cases.
Defines the capabilities of OpenHarmony Universal KeyStore (HUKS) parameter sets. The HUKS APIs can be used to perform parameter set lifecycle management, including initializing a parameter set, adding parameters to a parameter set, constructing a parameter set, and destroying a parameter set. They can also be used to obtain parameters, copy parameter sets, and check parameter validity.
Defines HUKS parameter set management capabilities, including HUKS parameter set lifecycle management such as initializing a parameter set, adding parameters, building a parameter set, and freeing a parameter set, as well as functions such as obtaining parameters, copying a parameter set, querying a parameter set, and checking the validity of a parameter set.
\@syscap SystemCapability.Security.Huks
**Since:**
**Since**:
9
...
...
@@ -16,22 +16,22 @@ Defines the capabilities of OpenHarmony Universal KeyStore (HUKS) parameter sets
### Files
| Name | Description |
| Name| Description|
| -------- | -------- |
| [native_huks_param.h](native__huks__param_8h.md) | Provides APIs for constructing, using, and destroying parameter sets.<br>File to Include: <huks/native_huks/native_huks_param.h> |
| [native_huks_param.h](native__huks__param_8h.md) | Provides APIs for constructing, using, and destroying parameter sets.<br>**File to include**: <huks/native_huks/native_huks_param.h><br>**Library**: libhuks_ndk.z.so|
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| [OH_Huks_InitParamSet](#oh_huks_initparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Initializes a parameter set. |
| [OH_Huks_AddParams](#oh_huks_addparams)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, const struct [OH_Huks_Param](_o_h___huks___param.md)\*params, uint32_t paramCnt) | Adds parameters to a parameter set. |
| [OH_Huks_BuildParamSet](#oh_huks_buildparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Constructs a parameter set. |
| [OH_Huks_FreeParamSet](#oh_huks_freeparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Destroys a parameter set. |
| [OH_Huks_BuildParamSet](#oh_huks_buildparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Builds a parameter set. |
| [OH_Huks_FreeParamSet](#oh_huks_freeparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*\*paramSet) | Frees a parameter set. |
| [OH_Huks_CopyParamSet](#oh_huks_copyparamset)(const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*fromParamSet, uint32_t fromParamSetSize, struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*\*paramSet) | Copies a parameter set (deep copy). |
| [OH_Huks_GetParam](#oh_huks_getparam)(const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, uint32_t tag, struct [OH_Huks_Param](_o_h___huks___param.md)\*\*param) | Obtains parameters from a parameter set. |
| [OH_Huks_FreshParamSet](#oh_huks_freshparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, bool isCopy) | Refreshes data of the **Blob** type in a parameter set. |
| [OH_Huks_GetParam](#oh_huks_getparam)(const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, uint32_t tag, struct [OH_Huks_Param](_o_h___huks___param.md)\*\*param) | Obtains a parameter from a parameter set. |
| [OH_Huks_FreshParamSet](#oh_huks_freshparamset)(struct[OH_Huks_ParamSet](_o_h___huks___param_set.md) \*paramSet, bool isCopy) | Refreshes data of the Blob type in a parameter set. |
| [OH_Huks_isParamSetTagValid](#oh_huks_isparamsettagvalid)(const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet) | Checks whether the parameters in a parameter set are valid. |
| [OH_Huks_isParamSetValid](#oh_huks_isparamsetvalid)(const struct [OH_Huks_ParamSet](_o_h___huks___param_set.md)\*paramSet, uint32_t size) | Checks whether a parameter set is of the valid size. |
| [OH_Huks_CheckParamMatch](#oh_huks_checkparammatch)(const struct [OH_Huks_Param](_o_h___huks___param.md)\*baseParam, const struct [OH_Huks_Param](_o_h___huks___param.md)\*param) | Checks whether two parameters are the same. |
...
...
@@ -46,15 +46,16 @@ Defines the capabilities of OpenHarmony Universal KeyStore (HUKS) parameter sets
Refreshes data of the **Blob** type in a parameter set.
**Description**
Refreshes data of the Blob type in a parameter set.
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| paramSet | Indicates the pointer to the target parameter set. |
| isCopy | Specifies whether to copy the data of the **Blob** type to the parameter set. If yes, the data of the **Blob** type will be copied to the parameter set. Otherwise, only the address of the **Blob** data will be refreshed. |
| isCopy | Specifies whether to copy the data of the HksBlob type to the parameter set. |
**Returns**
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if operation is successful; returns an error code otherwise.
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the operation is successful; returns an error code otherwise.
### OH_Huks_GetParam()
...
...
@@ -168,20 +174,21 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if operation is suc
Checks whether the parameters in a parameter set are valid.
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| paramSet | Indicates the pointer to the parameter set to check. |
**Returns**
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the parameters in the parameter set are valid; returns other values if the parameter set has invalid, duplicate, or incorrect parameters.
Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the parameters in the parameter set are valid; returns an error code otherwise.
### OH_Huks_isParamSetValid()
...
...
@@ -230,16 +239,17 @@ Returns [OH_Huks_ErrCode#OH_HUKS_SUCCESS](_huks_type_api.md) if the parameters i