The BCryptDestroyKey function destroys a key.
NTSTATUS BCryptDestroyKey(
BCRYPT_KEY_HANDLE hKey
)
hKey
Type: BCRYPT_KEY_HANDLE
[in, out] The handle of the key to destroy.
Type: NTSTATUS
Returns a status code that indicates the success or failure of the function.
Possible return codes include, but are not limited to, the following.
| Return code | Description |
|---|---|
| STATUS_SUCCESS | The function was successful. |
| STATUS_INVALID_HANDLE | The key handle in the hKey parameter is not valid. |
Depending on what processor modes a provider supports, BCryptDestroyKey can be called either from user mode or kernel mode. Kernel mode callers can execute either at PASSIVE_LEVELIRQL or DISPATCH_LEVEL IRQL. If the current IRQL level is DISPATCH_LEVEL, the handle provided in the hKey parameter must be derived from an algorithm handle returned by a provider that was opened with the BCRYPT_PROV_DISPATCH flag.
Header: Declared in bcrypt.h.
Library: Use bcrypt.lib.