---
name: "Tspi_Key_GetPubKey"
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_GetPubKey"
---

# Tspi\_Key\_GetPubKey(3)

get the public key of an object

TCG Software Stack Developer's Reference

## NAME

Tspi\_Key\_GetPubKey - get the public key of an object

## 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_GetPubKey(TSS_HKEY hKey, UINT32* pulPubKeyLength, BYTE** prgbPubKey);
```

## DESCRIPTION

**Tspi\_Key\_GetPubKey** gets the public portion of a given key object.

## PARAMETERS

### hKey

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

### pulPubKeyLength

The *pulPubKeyLength* parameter receives the length in bytes of the *prgbPubKey* parameter.

### prgbPubKey

The *prgbPubKey* parameter receives a pointer to the memory block containing the public key blob retrieved for the key object referenced by *hKey*.

## RETURN CODES

**Tspi\_Key\_GetPubKey** 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\_GetPubKey** 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\_UnloadKey**(3)](/Tspi_Key_UnloadKey/3.md), [**Tspi\_Key\_CertifyKey**(3)](/Tspi_Key_CertifyKey/3.md).
