---
name: "Tspi_Key_UnloadKey"
section: "3"
platform: "linux"
package: "libtspi-dev"
version: "0.3.15-0.4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tspi_Key_UnloadKey"
---

# Tspi\_Key\_UnloadKey(3)

unload a key from the TPM

TCG Software Stack Developer's Reference

## NAME

Tspi\_Key\_UnloadKey - unload a key from the TPM

## SYNOPSIS

```
#include <tss/platform.h>
#include <tss/tcpa_defines.h>
#include <tss/tcpa_typedef.h>
#include <tss/tcpa_struct.h>
#include <tss/tss_typedef.h>
#include <tss/tss_structs.h>
#include <tss/tspi.h>

TSS_RESULT Tspi_Key_UnloadKey(TSS_HKEY hKey);
```

## DESCRIPTION

**Tspi\_Key\_UnloadKey** unloads the key referenced by the given key object from the TPM. This call will result in a TPM\_EvictKey operation for the specified key.

## PARAMETERS

### hKey

The *hKey* parameter is the handle of the key object to unload.

## RETURN CODES

**Tspi\_Key\_UnloadKey** returns TSS\_SUCCESS on success, otherwise one of the following values is returned:

- TSS\_E\_INVALID\_HANDLE

  *hKey* is not a valid handle.

- TSS\_E\_INTERNAL\_ERROR

  An internal SW error has been detected.

- TSS\_E\_BAD\_PARAMETER

  One or more parameters is bad.

## CONFORMING TO

**Tspi\_Key\_UnloadKey** conforms to the Trusted Computing Group Software Specification version 1.1 Golden

## SEE ALSO

[**Tspi\_Key\_LoadKey**(3)](/Tspi_Key_LoadKey/3.md), [**Tspi\_Key\_GetPubKey**(3)](/Tspi_Key_GetPubKey/3.md).
