---
name: "libnvmf_read_key-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvmf_read_key-libnvme3"
---

# libnvmf\_read\_key-libnvme3(2)

Read key raw data

## NAME

libnvmf\_read\_key - Read key raw data

## SYNOPSIS

**int libnvmf\_read\_key** **(struct libnvme\_global\_ctx \*ctx** *,* **long keyring\_id** *,* **long key\_id** *,* **int \*len** *,* **unsigned char \*\*key** *);*

## ARGUMENTS

- ctx

  struct libnvme\_global\_ctx object

- keyring\_id

  Id of the keyring holding *key\_id*

- key\_id

  Key id

- len

  Length of *key* to return

- key

  Raw key data to return

## DESCRIPTION

Links the keyring specified by *keyring\_id* into the session keyring and reads the payload of the key specified by *key\_id*. *len* holds the size of the returned buffer. If *keyring\_id* is 0 the default keyring '.nvme' is used.

## RETURN

0 on success, negative error code otherwise.
