---
name: "TPMLIB_DecodeBlob"
section: "3"
platform: "linux"
package: "libtpms"
version: "0.10.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/TPMLIB_DecodeBlob"
---

# TPMLIB\_DecodeBlob(3)

Decode a base64-encode TPM blob

## NAME

TPMLIB\_DecodeBlob    - Decode a base64-encode TPM blob

## SYNOPSIS

**#include \<libtpms/tpm\_types.h**\>

**#include \<libtpms/tpm\_library.h**\>

**TPM\_RESULT TPMLIB\_DecodeBlob(const char** \**buffer***,**\
                              **enum TPMLIB\_BlobType** *type***,**\
                              **unsigned char** \*\**result*\
                              **size\_t** \**result\_len***);**

## DESCRIPTION

The **TPMLIB\_DecodeBlob()** function is used to decode a base64-encoded TPM state blob. The caller must pass what type of blob is expected to be decoded and following that the function will look for the start and end markers of the data.

The following types of blobs are supported along with their start and  end markers:

- **BLOB\_TYPE\_INITSTATE**

  '-----BEGIN INITSTATE-----' marks the beginning of the base64-encoded blob.

  '-----END INITSTATE-----' marks the end of the base64-encoded blob.

This function is useful when passing state to the TPM inside the callback that is invoked to get the TPM's state blob. See [*TPMLIB\_RegisterCallbacks*(3)](/TPMLIB_RegisterCallbacks/3.md).

## ERRORS

- **TPM\_SUCCESS**

  The function completed successfully.

- **TPM\_SIZE**

  The size of a requested buffer exceeds the limit or the system is out of memory.

- **TPM\_FAIL**

  An error occurred while attempting to decode the blob.

For a complete list of TPM error codes please consult the include file **libtpms/tpm\_error.h**

## SEE ALSO

[**TPMLIB\_MainInit**(3)](/TPMLIB_MainInit/3.md), [**TPMLIB\_RegisterCallbacks**(3)](/TPMLIB_RegisterCallbacks/3.md)
