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