openharmony 鸿蒙 capi-native-huks-param-h

2026-08-25 浏览 (1)

native_huks_param.h

Overview

Provides APIs for constructing, using, and destroying a parameter set.

File to include: <huks/native_huks_param.h>

Library: libhuks_ndk.z.so

System capability: SystemCapability.Security.Huks.Core

The preceding system capability is available since API version 20. From API versions 9 to 19, the system capability is SystemCapability.Security.Huks.

Since: 9

Related module: HuksParamSetApi

Summary

Functions

NameDescription
struct OH_Huks_Result OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet)Initializes a parameter set. No parameter information is required, and the default available memory space is allocated to the parameter set. The initialized parameter set needs to be released by using OH_Huks_FreeParamSet. To add parameters to a parameter set, you need to use OH_Huks_AddParams to add parameters and use OH_Huks_BuildParamSet to construct the parameter set.
struct OH_Huks_Result OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Param *params, uint32_t paramCnt)Adds parameters to a parameter set.
struct OH_Huks_Result OH_Huks_BuildParamSet(struct OH_Huks_ParamSet **paramSet)Builds a parameter set. After the parameter set is initialized and parameters are added, the parameter set is serialized and the data of the BLOB type is copied to the adjacent memory area at the end of the paramSet struct.
void OH_Huks_FreeParamSet(struct OH_Huks_ParamSet **paramSet)Frees a parameter set.
struct OH_Huks_Result OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet **paramSet)Copies a parameter set (deep copy).
struct OH_Huks_Result OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, uint32_t tag, struct OH_Huks_Param **param)Obtains a parameter from a parameter set.
struct OH_Huks_Result OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, bool isCopy)Refreshes the OH_Huks_Blob data in the parameter set.
struct OH_Huks_Result OH_Huks_IsParamSetTagValid(const struct OH_Huks_ParamSet *paramSet)Checks whether the parameters in a parameter set are valid.
struct OH_Huks_Result OH_Huks_IsParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_t size)Checks whether a parameter set is of the valid size.
struct OH_Huks_Result OH_Huks_CheckParamMatch(const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param)Checks whether two parameters are the same.
void OH_Huks_FreeKeyAliasSet(struct OH_Huks_KeyAliasSet *keyAliasSet)Destroys the parameter set of a key alias.

Function Description

OH_Huks_InitParamSet()

struct OH_Huks_Result OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet)

Description

Initializes a parameter set. No parameter information is required, and the default available memory space is allocated to the parameter set. The initialized parameter set needs to be released by using OH_Huks_FreeParamSet. To add parameters to a parameter set, you need to use OH_Huks_AddParams to add parameters and use OH_Huks_BuildParamSet to construct the parameter set.

Since: 9

Parameters

NameDescription
struct OH_Huks_ParamSet **paramSetPointer to the parameter set to initialize.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Initialization successful.
OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014: Insufficient memory.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet is invalid.

OH_Huks_AddParams()

struct OH_Huks_Result OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Param *params, uint32_t paramCnt)

Description

Adds parameters to a parameter set.

Since: 9

Parameters

NameDescription
struct OH_Huks_ParamSet *paramSetPointer to the parameter set to which parameters are to be added.
const struct OH_Huks_Param *paramsPointer to an array of parameters to add.
uint32_t paramCntNumber of parameters to add.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Operation successful.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: params is a null pointer or paramSet is invalid.

OH_Huks_BuildParamSet()

struct OH_Huks_Result OH_Huks_BuildParamSet(struct OH_Huks_ParamSet **paramSet)

Description

Builds a parameter set. After the parameter set is initialized and parameters are added, the parameter set is serialized and the data of the BLOB type is copied to the adjacent memory area at the end of the paramSet struct.

Since: 9

Parameters

NameDescription
struct OH_Huks_ParamSet **paramSetDouble pointer to the parameter set to build.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Operation successful.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet is invalid.
OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014: Insufficient memory.

OH_Huks_FreeParamSet()

void OH_Huks_FreeParamSet(struct OH_Huks_ParamSet **paramSet)

Description

Frees a parameter set.

Since: 9

Parameters

NameDescription
struct OH_Huks_ParamSet **paramSetPointer to the parameter set to free.

OH_Huks_CopyParamSet()

struct OH_Huks_Result OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet **paramSet)

Description

Copies a parameter set (deep copy).

Since: 9

Parameters

NameDescription
const struct OH_Huks_ParamSet *fromParamSetPointer to the parameter set to copy.
uint32_t fromParamSetSizeSize of the memory occupied by the copied parameter set.
struct OH_Huks_ParamSet **paramSetDouble pointer to the new parameter set generated.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Operation successful.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: fromParamSet, fromParamSetSize, or paramSet is invalid.
OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014: Insufficient memory.

OH_Huks_GetParam()

struct OH_Huks_Result OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, uint32_t tag, struct OH_Huks_Param **param)

Description

Obtains a parameter from a parameter set.

Since: 9

Parameters

NameDescription
const struct OH_Huks_ParamSet *paramSetPointer to the parameter set to check.
uint32_t tagName of the parameter to obtain.
struct OH_Huks_Param **paramDouble pointer to the obtained parameter.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Operation successful.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet or param is invalid, or param is not in paramSet.

OH_Huks_FreshParamSet()

struct OH_Huks_Result OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, bool isCopy)

Description

Refreshes the OH_Huks_Blob data in the parameter set.

Since: 9

Parameters

NameDescription
struct OH_Huks_ParamSet *paramSetPointer to the parameter set to check.
bool isCopyIf the value is true, the address of the OH_Huks_Blob data is refreshed and copied to the parameter set. If the value is false, only the address of the OH_Huks_Blob data is refreshed.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: Operation successful.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet is invalid.
OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014: Insufficient memory.

OH_Huks_IsParamSetTagValid()

struct OH_Huks_Result OH_Huks_IsParamSetTagValid(const struct OH_Huks_ParamSet *paramSet)

Description

Checks whether the parameters in a parameter set are valid.

Since: 9

Parameters

NameDescription
const struct OH_Huks_ParamSet *paramSetPointer to the parameter set to check.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: All parameters in paramSet are valid.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet is invalid, or the parameter set contains invalid, duplicate, or incorrect tags.

OH_Huks_IsParamSetValid()

struct OH_Huks_Result OH_Huks_IsParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_t size)

Description

Checks whether a parameter set is of the valid size.

Since: 9

Parameters

NameDescription
const struct OH_Huks_ParamSet *paramSetPointer to the parameter set to check.
uint32_t sizeMemory size occupied by the parameter set.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: The size of the parameter set is valid.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: paramSet is invalid.

OH_Huks_CheckParamMatch()

struct OH_Huks_Result OH_Huks_CheckParamMatch(const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param)

Description

Checks whether two parameters are the same.

Since: 9

Parameters

NameDescription
const struct OH_Huks_Param *baseParamPointer to the first parameter to compare.
const struct OH_Huks_Param *paramPointer to the second parameter to compare.

Returns

TypeDescription
struct OH_Huks_ResultPossible error codes (errorCode):
OH_HUKS_SUCCESS = 0: The two parameters to be compared are the same.
OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401: One of the parameter sets is invalid, the parameters do not match,
or there is an invalid tag internally.

OH_Huks_FreeKeyAliasSet()

void OH_Huks_FreeKeyAliasSet(struct OH_Huks_KeyAliasSet *keyAliasSet)

Description

Destroys the parameter set of a key alias.

Since: 20

Parameters

NameDescription
struct OH_Huks_KeyAliasSet *keyAliasSetPointer to the parameter set of the key alias to destroy.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-huksExternalCrypto-sys

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-keymaterialrsa

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-result

openharmony 鸿蒙 capi-native-huks-type-h

openharmony 鸿蒙 js-apis-CryptoExtensionAbility

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-pubkeyinfo

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-certchain

openharmony 鸿蒙 js-apis-huksExternalCrypto

openharmony 鸿蒙 capi-hukstypeapi-oh-huks-keymaterialdsa

openharmony 鸿蒙 capi-hukstypeapi

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/5RiZDfCL