1# Deleting a Key (C/C++) 2 3 4To ensure data security, delete the key that is no longer required. 5 6## Add the dynamic library in the CMake script. 7```txt 8 target_link_libraries(entry PUBLIC libhuks_ndk.z.so) 9``` 10 11## How to Develop 12 13For example, delete a 256-bit HKDF key. 14 151. Set the key alias (**keyAlias**), which cannot exceed 128 bytes. **paramSet** is a reserved parameter. Leave it empty. 16 172. Use [OH_Huks_DeleteKeyItem](../../reference/apis-universal-keystore-kit/_huks_key_api.md#oh_huks_deletekeyitem) to delete the key. 18 19```c++ 20#include "napi/native_api.h" 21#include "huks/native_huks_api.h" 22#include "huks/native_huks_param.h" 23#include <string.h> 24static napi_value DeleteKey(napi_env env, napi_callback_info info) 25{ 26 /* 1. Obtain the key alias. */ 27 struct OH_Huks_Blob keyAlias = { 28 (uint32_t)strlen("test_key"), 29 (uint8_t *)"test_key" 30 }; 31 32 /* 2. Call OH_Huks_DeleteKeyItem to delete the key. */ 33 struct OH_Huks_Result ohResult = OH_Huks_DeleteKeyItem(&keyAlias, nullptr); 34 35 napi_value ret; 36 napi_create_int32(env, ohResult.errorCode, &ret); 37 return ret; 38} 39``` 40