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