libnvmf\_read\_key(9) libnvme API manual libnvmf\_read\_key(9)

# [NAME](#NAME)

libnvmf\_read\_key - Read key raw data

# [SYNOPSIS](#SYNOPSIS)

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

# [ARGUMENTS](#ARGUMENTS)

[ctx](#ctx)

struct libnvme\_global\_ctx object

[keyring\_id](#keyring_id)

Id of the keyring holding *key\_id*

[key\_id](#key_id)

Key id

[len](#len)

Length of *key* to return

[key](#key)

Raw key data to return

# [DESCRIPTION](#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](#RETURN)

0 on success, negative error code otherwise.

libnvmf\_read\_key October 2026

---

Document: libnvmf_read_key-libnvme3(2) from nvme-cli 3.2-r0 (Chainguard OS)
Source: https://github.com/linux-nvme/nvme-cli
