1KEYCTL_MOVE(3) Linux Key Management Calls KEYCTL_MOVE(3)
2
3
4
6 keyctl_move - Move a key between keyrings
7
9 #include <keyutils.h>
10
11 long keyctl_move(key_serial_t key, key_serial_t from_keyring,
12 key_serial_t to_keyring, unsigned int flags);
13
15 keyctl_move() atomically unlinks key from from_keyring and links it
16 into to_keyring in a single operation. Depending on the flags set, a
17 link to any matching key in to_keyring may get displaced.
18
19 flags is a bitwise-OR of zero or more of the following flags:
20
21 KEYCTL_MOVE_EXCL
22 If there's a matching key in to_keyring, don't displace it but
23 rather return an error.
24
25 The caller must have write permission on both keyring to be able create
26 or remove links in them.
27
28 The caller must have link permission on a key to be able to create a
29 new link to it.
30
32 On success keyctl_move() return 0. On error, the value -1 will be
33 returned and errno will have been set to an appropriate error.
34
36 ENOKEY The key or one of the keyrings specified are invalid.
37
38 ENOKEY A key with the same type and description is present in
39 to_keyring and KEYCTL_MOVE_EXCL is set.
40
41 EKEYEXPIRED
42 The key or one of the keyrings specified have expired.
43
44 EKEYREVOKED
45 The key or one of the keyrings specified have been revoked.
46
47 EACCES The key exists, but is not linkable by the calling process.
48
49 EACCES The keyrings exist, but are not writable by the calling process.
50
51 ENOMEM Insufficient memory to effect the changes.
52
53 EDQUOT Expanding to_keyring would exceed the keyring owner's quota.
54
56 This is a library function that can be found in libkeyutils. When
57 linking, -lkeyutils should be specified to the linker.
58
60 keyctl(1), add_key(2), keyctl(2), request_key(2), keyctl(3),
61 keyrings(7), keyutils(7)
62
63
64
65
66Linux 29 May 2019 KEYCTL_MOVE(3)