1KEYCTL_GET_KEYRING_ID(3) Linux Key Management Calls KEYCTL_GET_KEYRING_ID(3)
2
3
4
6 keyctl_get_keyring_ID - Get the ID of a special keyring
7
9 #include <keyutils.h>
10
11 key_serial_t keyctl_get_keyring_ID(key_serial_t key,
12 int create);
13
15 keyctl_get_keyring_ID() maps a special key or keyring ID to the serial
16 number of the key actually representing that feature. The serial num‐
17 ber will be returned if that key exists.
18
19 If the key or keyring does not yet exist, then if create is non-zero,
20 the key or keyring will be created if it is appropriate to do so.
21
22 The following special key IDs may be specified as key:
23
24 KEY_SPEC_THREAD_KEYRING
25 This specifies the caller's thread-specific keyring.
26
27 KEY_SPEC_PROCESS_KEYRING
28 This specifies the caller's process-specific keyring.
29
30 KEY_SPEC_SESSION_KEYRING
31 This specifies the caller's session-specific keyring.
32
33 KEY_SPEC_USER_KEYRING
34 This specifies the caller's UID-specific keyring.
35
36 KEY_SPEC_USER_SESSION_KEYRING
37 This specifies the caller's UID-session keyring.
38
39 KEY_SPEC_REQKEY_AUTH_KEY
40 This specifies the authorisation key created by request_key()
41 and passed to the process it spawns to generate a key.
42
43 If a valid keyring ID is passed in, then this will simply be returned
44 if the key exists; an error will be issued if it doesn't exist.
45
47 On success keyctl_get_keyring_ID() returns the serial number of the key
48 it found. On error, the value -1 will be returned and errno will have
49 been set to an appropriate error.
50
52 ENOKEY No matching key was found.
53
54 ENOMEM Insufficient memory to create a key.
55
56 EDQUOT The key quota for this user would be exceeded by creating this
57 key or linking it to the keyring.
58
60 This is a library function that can be found in libkeyutils. When
61 linking, -lkeyutils should be specified to the linker.
62
64 keyctl(1),
65 add_key(2),
66 keyctl(2),
67 request_key(2),
68 keyctl(3),
69 request-key(8)
70
71
72
73Linux 4 May 2006 KEYCTL_GET_KEYRING_ID(3)