KEYCTL_DESCRIBE(3)
π KEYCTL_DESCRIBE π
okay bestie, welcome to keyctl_describe from the Linux Key Management Calls lineup β¨ this is the one that spills the tea on a key β like, tells you everything about it. no cap.
πΈ NAME πΈ
keyctl_describe β describe a key π«Ά
β¨ SYNOPSIS β¨
#include <keyutils.h>
long keyctl_describe(key_serial_t key, char *buffer, size_tbuflen);
long keyctl_describe_alloc(key_serial_t key, char **_buffer);
π DESCRIPTION π
keyctl_describe() hands you the attributes of a key, all wrapped up as a NUL-terminated string. it's giving "here's everything you wanted to know" π
lowkey important tho: the caller must have view permission on a key before it'll let you get a description of it. no view permission, no tea. periodt.
buffer and buflen are the two of you pointing at the buffer where the key description is gonna land, and how big it is. and if that buffer is too small? π the full size of the description gets returned anyway, and no copy will take place β so nothing gets written, you just get told how much room you'd need.
keyctl_describe_alloc() is the same vibe as keyctl_describe() except it's the main character who handles the logistics: it allocates a buffer big enough to hold the description and drops the description in there for you. if it works out, a pointer to that buffer gets placed in *_buffer. and bestie, the caller must free the buffer β it's yours now, take care of it π«Ά
the description comes out as a string of format:
"%s;%d;%d;%08x;%s"
and the arguments are, in order: key type name, key UID, key GID, key permissions mask, and key description. iconic little five-part combo meal π
NOTE! π¨ the key description itself will not contain any semicolons. so you should separate it out by working backwards from the end of the string. why? because that's what lets later versions of the kernel sneak extra information in before it, just by inserting more semicolon-terminated substrings. foresight? we love to see it π
π RETURN VALUE π
on success, keyctl_describe() returns the amount of data placed into the buffer. π
if the buffer was too small, then the size of buffer required gets returned instead β but no data will be transferred. sad but informative.
on error, the value -1 comes back and errno will have been set to an appropriate error. π
on success, keyctl_describe_alloc() returns the amount of data in the buffer, less the NUL terminator. on error, the value -1 comes back and errno will have been set to an appropriate error.
π ERRORS π
ENOKEYβ the key specified is invalid. doesn't exist, bestie, can't help you πEKEYEXPIREDβ the key specified has expired. it's giving expired milk energy π₯EKEYREVOKEDβ the key specified had been revoked. it got cancelled fr frEACCESβ the key exists, but is not viewable by the calling process. the key is right there and still won't talk to you π
π LINKING π
this is a library function that can be found in libkeyutils. when you're linking, -lkeyutils should be specified to the linker. don't skip this step, it's the whole plot π
π SEE ALSO π
keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyrings(7), keyutils(7)
and that's the whole page, bestie!! this one's from Linux, dated 4 May 2006 β yeah she's an elder but she still slays π β¨ mwah, go describe some keys responsibly π¦π
π¦ where this page comes from
- alpine 3.22: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- arch rolling: keyutils 1.6.3-4 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: keyutils-libs-devel 1.6.3-5.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- centos-stream 9: keyutils-libs-devel 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- debian bookworm: libkeyutils-dev 1.6.3-2 Β· GPL-2.0-or-later
- debian trixie: libkeyutils-dev 1.6.3-6 Β· GPL-2.0-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 43: keyutils-libs-devel 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils-libs-devel 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixpkgs unstable: keyutils 1.6.3
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: libkeyutils-dev 1.6.1-2ubuntu3 Β· GPL-2.0-or-later
- ubuntu noble: libkeyutils-dev 1.6.3-3build1 Β· GPL-2.0-or-later
- ubuntu questing: libkeyutils-dev 1.6.3-6ubuntu2
- ubuntu resolute: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- ubuntu stonking: libkeyutils-dev 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- Copyright (C) 2006 Red Hat, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms