---
name: "Tspi_Data_Unbind"
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_Data_Unbind"
---

# Tspi\_Data\_Unbind(3)

Decrypts data that has been bound to a key

TCG Software Stack Developer's Reference

## NAME

Tspi\_Data\_Unbind - Decrypts data that has been bound to a key

## 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_Data_Unbind(TSS_HENCDATA hEncData,             TSS_HKEY hEncKey,
                            UINT32*      pulUnboundDataLength, BYTE**   prgbUnboundData);
```

## DESCRIPTION

**Tspi\_Data\_Unbind** decrypts the encrypted data blob exportedfrom the data object used in **Tspi\_Data\_Bind**. The encrypted data blob must be imported to the object addressed by **Tspi\_SetAttribData** before calling this method.

## PARAMETERS

### hEncData

The handle of the data object which contains the encrypted data.

### hEncKey

Handle to the key object addressing the private key which is used to decrypt the data.

### pulDataLength

Receives the length of the data at the parameter *prgbUnboundData*.

### prgbUnboundData

Receives a pointer to a buffer containing the plaintext data.

## RETURN CODES

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

- TSS\_E\_INVALID\_HANDLE

  *hEncData* or *hEncKey* 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.

- TSS\_E\_INVALID\_ENCSCHEME

  Invalid encryption scheme.

- TSS\_E\_ENC\_INVALID\_LENGTH

  Invalid length of data to be encypted.

- TSS\_E\_ENC\_NO\_DATA

  No data to encrypt.

- TSS\_E\_ENC\_INVALID\_TYPE

  Invalid encryption type.

## CONFORMING TO

**Tspi\_Data\_Unbind** conforms to the Trusted Computing Group Software Specification version 1.1 Golden

## SEE ALSO

[**Tspi\_Data\_Bind**(3)](/Tspi_Data_Bind/3.md), [**Tspi\_Data\_Unseal**(3)](/Tspi_Data_Unseal/3.md), [**Tspi\_Data\_Seal**(3)](/Tspi_Data_Seal/3.md).
