KEYCTL_UPDATE(3)

πŸ“¦
version 1.6.3 Β· 2 versions
  • 1.6.3 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.6.1 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… KEYCTL_UPDATE β€” bestie, let's refresh a key's payload πŸ’–

okay so this is keyctl_update(3), straight out of the Linux Key Management Calls crew. she lives in the manual, she's iconic, and she's about to tell you how to swap out a key's payload like it's a new outfit. πŸŽ€


✨ NAME ✨

keyctl_update β€” update a key πŸ”„


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <keyutils.h>

long keyctl_update(key_serial_t key, const void *payload,
size_t plen);

🌸 DESCRIPTION 🌸

so keyctl_update() does exactly what it says on the tin, no cap: it updates the payload of a key β€” if the key type permits it. key types are picky like that, and honestly? respect. πŸ’…

the caller must have write permission on a key to be able to update it. no write perms, no glow-up. periodt.

payload and plen specify the data for the new payload. payload may be NULL and plen may be zero β€” but only if the key type permits that, so don't get cute. the key type may also just straight up reject the data if it's in the wrong format or invalid in some other way. not me getting rejected by a key type 😭


πŸ‘‘ RETURN VALUE πŸ‘‘

on success, keyctl_update() returns 0. slay. ✨

on error, the value -1 will be returned and errno will have been set to an appropriate error. so like, check errno, bestie, she's trying to tell you something.


πŸ’€ ERRORS πŸ’€

  • ENOKEY β€” the key specified is invalid. she doesn't exist. ghosted fr.
  • EKEYEXPIRED β€” the key specified has expired. she had her moment, it's over now πŸ₯€
  • EKEYREVOKED β€” the key specified had been revoked. taken away, no takebacks πŸ’”
  • EINVAL β€” the payload data was invalid. wrong vibe, rejected.
  • ENOMEM β€” insufficient memory to store the new payload. no room, the brain is full 🧠
  • EDQUOT β€” the key quota for this user would be exceeded by increasing the size of the key to accommodate the new payload. you hit the limit, bestie, the quota said no πŸ™ˆ
  • EACCES β€” the key exists, but is not writable by the calling process. she's there, she's just not letting you in πŸ”’
  • EOPNOTSUPP β€” the key type does not support the update operation on its keys. this key type simply does not do updates, and that's a her thing πŸ’…

πŸ”— LINKING πŸ”—

this is a library function that can be found in libkeyutils. when linking, -lkeyutils should be specified to the linker. don't forget it, or the linker will be like "who?" 😭


🌈 SEE ALSO 🌈

keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)

go read them, iykyk 🫢


Linux Β· 4 May 2006 Β· KEYCTL_UPDATE(3)

and that's the whole page, bestie β€” written by the Linux keyutils girlies back on 4 May 2006, still serving πŸ’– mwah, go update something responsibly βœ¨πŸŽ€

πŸ“¦ where this page comes from