1KEYCTL_DESCRIBE(3) Linux Key Management Calls KEYCTL_DESCRIBE(3)
2
3
4
6 keyctl_describe - describe a key
7
9 #include <keyutils.h>
10
11 long keyctl_describe(key_serial_t key, char *buffer,
12 size_tbuflen);
13
14 long keyctl_describe_alloc(key_serial_t key, char **_buffer);
15
17 keyctl_describe() describes the attributes of a key as a NUL-terminated
18 string.
19
20 The caller must have view permission on a key to be able to get a
21 description of it.
22
23 buffer and buflen specify the buffer into which the key description
24 will be placed. If the buffer is too small, the full size of the
25 description will be returned, and no copy will take place.
26
27 keyctl_describe_alloc() is similar to keyctl_describe() except that it
28 allocates a buffer big enough to hold the description and places the
29 description in it. If successful, A pointer to the buffer is placed in
30 *_buffer. The caller must free the buffer.
31
32 The description will be a string of format:
33
34 “%s;%d;%d;%08x;%s”
35
36 where the arguments are: key type name, key UID, key GID, key permis‐
37 sions mask and key description.
38
39 NOTE! The key description will not contain any semicolons, so that
40 should be separated out by working backwards from the end of the
41 string. This permits extra information to be inserted before it by
42 later versions of the kernel simply by inserting more semicolon-termi‐
43 nated substrings.
44
46 On success keyctl_describe() returns the amount of data placed into the
47 buffer. If the buffer was too small, then the size of buffer required
48 will be returned, but no data will be transferred. On error, the value
49 -1 will be returned and errno will have been set to an appropriate
50 error.
51
52 On success keyctl_describe_alloc() returns the amount of data in the
53 buffer, less the NUL terminator. On error, the value -1 will be
54 returned and errno will have been set to an appropriate error.
55
57 ENOKEY The key specified is invalid.
58
59 EKEYEXPIRED
60 The key specified has expired.
61
62 EKEYREVOKED
63 The key specified had been revoked.
64
65 EACCES The key exists, but is not viewable by the calling process.
66
68 This is a library function that can be found in libkeyutils. When
69 linking, -lkeyutils should be specified to the linker.
70
72 keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3),
73 keyrings(7), keyutils(7)
74
75
76
77Linux 4 May 2006 KEYCTL_DESCRIBE(3)