1 .\" Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" and Copyright (C) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
3 .\" A very few fragments remain from an earlier version of this page
4 .\" written by David Howells (dhowells@redhat.com)
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .TH KEYCTL 2 2022-09-17 "Linux man-pages (unreleased)"
10 keyctl \- manipulate the kernel's key management facility
13 .RI ( libc ", " \-lc )
15 Alternatively, Linux Key Management Utilities
16 .RI ( libkeyutils ", " \-lkeyutils );
20 .BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */"
21 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
22 .B #include <unistd.h>
24 .BI "long syscall(SYS_keyctl, int " operation ", unsigned long " arg2 ,
25 .BI " unsigned long " arg3 ", unsigned long " arg4 ,
26 .BI " unsigned long " arg5 );
30 glibc provides no wrapper for
32 necessitating the use of
36 allows user-space programs to perform key manipulation.
38 The operation performed by
40 is determined by the value of the
43 Each of these operations is wrapped by the
45 library (provided by the
47 package) into individual functions (noted below)
48 to permit the compiler to check types.
50 The permitted values for
54 .BR KEYCTL_GET_KEYRING_ID " (since Linux 2.6.10)"
55 Map a special key ID to a real key ID for this process.
57 This operation looks up the special key whose ID is provided in
61 If the special key is found,
62 the ID of the corresponding real key is returned as the function result.
63 The following values may be specified in
67 .B KEY_SPEC_THREAD_KEYRING
68 This specifies the calling thread's thread-specific keyring.
70 .BR thread\-keyring (7).
72 .B KEY_SPEC_PROCESS_KEYRING
73 This specifies the caller's process-specific keyring.
75 .BR process\-keyring (7).
77 .B KEY_SPEC_SESSION_KEYRING
78 This specifies the caller's session-specific keyring.
80 .BR session\-keyring (7).
82 .B KEY_SPEC_USER_KEYRING
83 This specifies the caller's UID-specific keyring.
85 .BR user\-keyring (7).
87 .B KEY_SPEC_USER_SESSION_KEYRING
88 This specifies the caller's UID-session keyring.
90 .BR user\-session\-keyring (7).
92 .BR KEY_SPEC_REQKEY_AUTH_KEY " (since Linux 2.6.16)"
93 .\" commit b5f545c880a2a47947ba2118b2509644ab7a2969
94 This specifies the authorization key created by
96 and passed to the process it spawns to generate a key.
97 This key is available only in a
98 .BR request\-key (8)-style
99 program that was passed an authorization key by the kernel and
100 ceases to be available once the requested key has been instantiated; see
103 .BR KEY_SPEC_REQUESTOR_KEYRING " (since Linux 2.6.29)"
104 .\" commit 8bbf4976b59fc9fc2861e79cab7beb3f6d647640
105 This specifies the key ID for the
108 This keyring is available only in a
109 .BR request\-key (8)-style
110 program that was passed an authorization key by the kernel and
111 ceases to be available once the requested key has been instantiated; see
115 The behavior if the key specified in
117 does not exist depends on the value of
123 contains a nonzero value, then\(emif it is appropriate to do so
124 (e.g., when looking up the user, user-session, or session key)\(ema new key
125 is created and its real key ID returned as the function result.
126 .\" The keyctl_get_keyring_ID.3 page says that a new key
127 .\" "will be created *if it is appropriate to do so**. What is the
128 .\" determiner for appropriate?
129 .\" David Howells: Some special keys such as KEY_SPEC_REQKEY_AUTH_KEY
130 .\" wouldn't get created but user/user-session/session keyring would
132 Otherwise, the operation fails with the error
135 If a valid key ID is specified in
137 and the key exists, then this operation simply returns the key ID.
138 If the key does not exist, the call fails with error
143 permission on a keyring in order for it to be found.
151 This operation is exposed by
154 .BR keyctl_get_keyring_ID (3).
156 .BR KEYCTL_JOIN_SESSION_KEYRING " (since Linux 2.6.10)"
157 Replace the session keyring this process subscribes to with
158 a new session keyring.
159 .\" This may be useful in conjunction with some sort of
160 .\" session management framework that is employed by the application.
165 an anonymous keyring with the description "_ses" is created
166 and the process is subscribed to that keyring as its session keyring,
167 displacing the previous session keyring.
173 is treated as the description (name) of a keyring,
174 and the behavior is as follows:
177 If a keyring with a matching description exists,
178 the process will attempt to subscribe to that keyring
179 as its session keyring if possible;
180 if that is not possible, an error is returned.
181 In order to subscribe to the keyring,
184 permission on the keyring.
186 If a keyring with a matching description does not exist,
187 then a new keyring with the specified description is created,
188 and the process is subscribed to that keyring as its session keyring.
198 This operation is exposed by
201 .BR keyctl_join_session_keyring (3).
203 .BR KEYCTL_UPDATE " (since Linux 2.6.10)"
204 Update a key's data payload.
210 specifies the ID of the key to be updated.
215 points to the new payload and
219 contains the new payload size in bytes.
223 permission on the key specified and the key type must support updating.
225 A negatively instantiated key (see the description of
227 can be positively instantiated with this operation.
233 This operation is exposed by
236 .BR keyctl_update (3).
238 .BR KEYCTL_REVOKE " (since Linux 2.6.10)"
239 Revoke the key with the ID provided in
243 The key is scheduled for garbage collection;
244 it will no longer be findable,
245 and will be unavailable for further operations.
246 Further attempts to use the key will fail with the error
253 permission on the key.
254 .\" Keys with the KEY_FLAG_KEEP bit set cause an EPERM
255 .\" error for KEYCTL_REVOKE. Does this need to be documented?
256 .\" David Howells: No significance for user space.
265 This operation is exposed by
268 .BR keyctl_revoke (3).
270 .BR KEYCTL_CHOWN " (since Linux 2.6.10)"
271 Change the ownership (user and group ID) of a key.
282 contains the new user ID (or \-1 in case the user ID shouldn't be changed).
287 contains the new group ID (or \-1 in case the group ID shouldn't be changed).
289 The key must grant the caller
293 For the UID to be changed, or for the GID to be changed to a group
294 the caller is not a member of, the caller must have the
297 .BR capabilities (7)).
299 If the UID is to be changed, the new user must have sufficient
300 quota to accept the key.
301 The quota deduction will be removed from the old user
302 to the new user should the UID be changed.
308 This operation is exposed by
311 .BR keyctl_chown (3).
313 .BR KEYCTL_SETPERM " (since Linux 2.6.10)"
314 Change the permissions of the key with the ID provided in the
318 to the permissions provided in the
323 If the caller doesn't have the
325 capability, it can change permissions only for the keys it owns.
326 (More precisely: the caller's filesystem UID must match the UID of the key.)
330 permission to the caller
332 of the caller's capabilities.
333 .\" FIXME Above, is it really intended that a privileged process can't
334 .\" override the lack of the 'setattr' permission?
338 specify masks of available operations
339 for each of the following user categories:
342 .IR possessor " (since Linux 2.6.14)"
343 .\" commit 664cceb0093b755739e56572b836a99104ee8a75
344 This is the permission granted to a process that possesses the key
345 (has it attached searchably to one of the process's keyrings);
350 This is the permission granted to a process
351 whose filesystem UID matches the UID of the key.
354 This is the permission granted to a process
355 whose filesystem GID or any of its supplementary GIDs
356 matches the GID of the key.
359 This is the permission granted to other processes
360 that do not match the
372 categories are exclusive: if a process matches the
374 category, it will not receive permissions granted in the
376 category; if a process matches the
380 category, then it will not receive permissions granted in the
386 category grants permissions that are cumulative with the grants from the
393 Each permission mask is eight bits in size,
394 with only six bits currently used.
395 The available permissions are:
399 This permission allows reading attributes of a key.
401 This permission is required for the
405 The permission bits for each category are
413 This permission allows reading a key's payload.
415 This permission is required for the
419 The permission bits for each category are
427 This permission allows update or instantiation of a key's payload.
428 For a keyring, it allows keys to be linked and unlinked from the keyring,
430 This permission is required for the
439 The permission bits for each category are
447 This permission allows keyrings to be searched and keys to be found.
448 Searches can recurse only into nested keyrings that have
452 This permission is required for the
453 .BR KEYCTL_GET_KEYRING_ID ,
454 .BR KEYCTL_JOIN_SESSION_KEYRING ,
460 The permission bits for each category are
468 This permission allows a key or keyring to be linked to.
470 This permission is required for the
473 .B KEYCTL_SESSION_TO_PARENT
476 The permission bits for each category are
483 .IR setattr " (since Linux 2.6.15)."
484 This permission allows a key's UID, GID, and permissions mask to be changed.
486 This permission is required for the
493 The permission bits for each category are
494 .BR KEY_POS_SETATTR ,
495 .BR KEY_USR_SETATTR ,
496 .BR KEY_GRP_SETATTR ,
498 .BR KEY_OTH_SETATTR .
501 As a convenience, the following macros are defined as masks for
502 all of the permission bits in each of the user categories:
513 arguments are ignored.
515 This operation is exposed by
518 .BR keyctl_setperm (3).
520 .BR KEYCTL_DESCRIBE " (since Linux 2.6.10)"
521 Obtain a string describing the attributes of a specified key.
523 The ID of the key to be described is specified in
527 The descriptive string is returned in the buffer pointed to by
534 specifies the size of that buffer in bytes.
536 The key must grant the caller
540 The returned string is null-terminated and
541 contains the following information about the key:
544 .IR type ; uid ; gid ; perm ; description
555 are decimal strings, and
557 is a hexadecimal permissions mask.
558 The descriptive string is written with the following format:
566 .B Note: the intention is that the descriptive string should
567 .B be extensible in future kernel versions.
570 field will not contain semicolons;
571 .\" FIXME But, the kernel does not enforce the requirement
572 .\" that the key description contains no semicolons!
573 .\" So, user space has no guarantee here??
574 .\" Either something more needs to be said here,
575 .\" or a kernel fix is required.
576 it should be parsed by working backwards from the end of the string
577 to find the last semicolon.
578 This allows future semicolon-delimited fields to be inserted
579 in the descriptive string in the future.
581 Writing to the buffer is attempted only when
583 is non-NULL and the specified buffer size
584 is large enough to accept the descriptive string
585 (including the terminating null byte).
586 .\" Function commentary says it copies up to buflen bytes, but see the
587 .\" (buffer && buflen >= ret) condition in keyctl_describe_key() in
588 .\" security/keyctl.c
589 In order to determine whether the buffer size was too small,
590 check to see if the return value of the operation is greater than
597 This operation is exposed by
600 .BR keyctl_describe (3).
603 Clear the contents of (i.e., unlink all keys from) a keyring.
606 (which must be of keyring type)
607 .\" or the error ENOTDIR results
612 .\" According to Documentation/security/keys.txt:
613 .\" This function can also be used to clear special kernel keyrings if they
614 .\" are appropriately marked if the user has CAP_SYS_ADMIN capability. The
615 .\" DNS resolver cache keyring is an example of this.
619 permission on the keyring.
628 This operation is exposed by
631 .BR keyctl_clear (3).
633 .BR KEYCTL_LINK " (since Linux 2.6.10)"
634 Create a link from a keyring to a key.
636 The key to be linked is specified in
640 the keyring is specified in
645 If a key with the same type and description is already linked in the keyring,
646 then that key is displaced from the keyring.
648 Before creating the link,
649 the kernel checks the nesting of the keyrings and returns appropriate errors
650 if the link would produce a cycle
651 or if the nesting of keyrings would be too deep
652 (The limit on the nesting of keyrings is determined by the kernel constant
653 .BR KEYRING_SEARCH_MAX_DEPTH ,
654 defined with the value 6, and is necessary to prevent overflows
655 on the kernel stack when recursively searching keyrings).
659 permission on the key being added and
661 permission on the keyring.
669 This operation is exposed by
674 .BR KEYCTL_UNLINK " (since Linux 2.6.10)"
675 Unlink a key from a keyring.
677 The ID of the key to be unlinked is specified in
681 the ID of the keyring from which it is to be unlinked is specified in
686 If the key is not currently linked into the keyring, an error results.
690 permission on the keyring from which the key is being removed.
692 If the last link to a key is removed,
693 then that key will be scheduled for destruction.
701 This operation is exposed by
704 .BR keyctl_unlink (3).
706 .BR KEYCTL_SEARCH " (since Linux 2.6.10)"
707 Search for a key in a keyring tree,
708 returning its ID and optionally linking it to a specified keyring.
710 The tree to be searched is specified by passing
711 the ID of the head keyring in
715 The search is performed breadth-first and recursively.
721 arguments specify the key to be searched for:
725 contains the key type
726 (a null-terminated character string up to 32 bytes in size,
727 including the terminating null byte), and
731 contains the description of the key
732 (a null-terminated character string up to 4096 bytes in size,
733 including the terminating null byte).
735 The source keyring must grant
737 permission to the caller.
738 When performing the recursive search, only keyrings that grant the caller
740 permission will be searched.
741 Only keys with for which the caller has
743 permission can be found.
745 If the key is found, its ID is returned as the function result.
747 If the key is found and
751 is nonzero, then, subject to the same constraints and rules as
753 the key is linked into the keyring whose ID is specified in
755 If the destination keyring specified in
757 already contains a link to a key that has the same type and description,
758 then that link will be displaced by a link to
759 the key found by this operation.
761 Instead of valid existing keyring IDs, the source
765 keyrings can be one of the special keyring IDs listed under
766 .BR KEYCTL_GET_KEYRING_ID .
768 This operation is exposed by
771 .BR keyctl_search (3).
773 .BR KEYCTL_READ " (since Linux 2.6.10)"
774 Read the payload data of a key.
776 The ID of the key whose payload is to be read is specified in
780 This can be the ID of an existing key,
781 or any of the special key IDs listed for
782 .BR KEYCTL_GET_KEYRING_ID .
783 .\" including KEY_SPEC_REQKEY_AUTH_KEY
785 The payload is placed in the buffer pointed by
789 the size of that buffer must be specified in
794 The returned data will be processed for presentation
795 according to the key type.
796 For example, a keyring will return an array of
798 entries representing the IDs of all the keys that are linked to it.
801 key type will return its data as is.
802 If a key type does not implement this function,
803 the operation fails with the error
809 as much of the payload data as will fit is copied into the buffer.
810 On a successful return,
811 the return value is always the total size of the payload data.
812 To determine whether the buffer was of sufficient size,
813 check to see that the return value is less than or equal to
814 the value supplied in
817 The key must either grant the caller
819 permission, or grant the caller
821 permission when searched for from the process keyrings
822 (i.e., the key is possessed).
828 This operation is exposed by
833 .BR KEYCTL_INSTANTIATE " (since Linux 2.6.10)"
834 (Positively) instantiate an uninstantiated key with a specified payload.
836 The ID of the key to be instantiated is provided in
841 The key payload is specified in the buffer pointed to by
845 the size of that buffer is specified in
850 The payload may be a NULL pointer and the buffer size may be 0
851 if this is supported by the key type (e.g., it is a keyring).
853 The operation may be fail if the payload data is in the wrong format
854 or is otherwise invalid.
860 is nonzero, then, subject to the same constraints and rules as
862 the instantiated key is linked into the keyring whose ID specified in
865 The caller must have the appropriate authorization key,
866 and once the uninstantiated key has been instantiated,
867 the authorization key is revoked.
868 In other words, this operation is available only from a
869 .BR request\-key (8)-style
873 for an explanation of uninstantiated keys and key instantiation.
875 This operation is exposed by
878 .BR keyctl_instantiate (3).
880 .BR KEYCTL_NEGATE " (since Linux 2.6.10)"
881 Negatively instantiate an uninstantiated key.
883 This operation is equivalent to the call:
887 keyctl(KEYCTL_REJECT, arg2, arg3, ENOKEY, arg4);
895 This operation is exposed by
898 .BR keyctl_negate (3).
900 .BR KEYCTL_SET_REQKEY_KEYRING " (since Linux 2.6.13)"
901 Set the default keyring to which implicitly requested keys
902 will be linked for this thread, and return the previous setting.
903 Implicit key requests are those made by internal kernel components,
904 .\" I.e., calls to the kernel's internal request_key() interface,
905 .\" which is distinct from the request_key(2) system call (which
906 .\" ultimately employs the kernel-internal interface).
907 such as can occur when, for example, opening files
908 on an AFS or NFS filesystem.
909 Setting the default keyring also has an effect when requesting
910 a key from user space; see
918 should contain one of the following values,
919 to specify the new default keyring:
922 .B KEY_REQKEY_DEFL_NO_CHANGE
923 Don't change the default keyring.
924 This can be used to discover the current default keyring
925 (without changing it).
927 .B KEY_REQKEY_DEFL_DEFAULT
928 This selects the default behaviour,
929 which is to use the thread-specific keyring if there is one,
930 otherwise the process-specific keyring if there is one,
931 otherwise the session keyring if there is one,
932 otherwise the UID-specific session keyring,
933 otherwise the user-specific keyring.
935 .B KEY_REQKEY_DEFL_THREAD_KEYRING
936 Use the thread-specific keyring
937 .RB ( thread\-keyring (7))
938 as the new default keyring.
940 .B KEY_REQKEY_DEFL_PROCESS_KEYRING
941 Use the process-specific keyring
942 .RB ( process\-keyring (7))
943 as the new default keyring.
945 .B KEY_REQKEY_DEFL_SESSION_KEYRING
946 Use the session-specific keyring
947 .RB ( session\-keyring (7))
948 as the new default keyring.
950 .B KEY_REQKEY_DEFL_USER_KEYRING
951 Use the UID-specific keyring
952 .RB ( user\-keyring (7))
953 as the new default keyring.
955 .B KEY_REQKEY_DEFL_USER_SESSION_KEYRING
956 Use the UID-specific session keyring
957 .RB ( user\-session\-keyring (7))
958 as the new default keyring.
960 .BR KEY_REQKEY_DEFL_REQUESTOR_KEYRING " (since Linux 2.6.29)"
961 .\" 8bbf4976b59fc9fc2861e79cab7beb3f6d647640
962 Use the requestor keyring.
963 .\" FIXME The preceding explanation needs to be expanded.
964 .\" Is the following correct:
966 .\" The requestor keyring is the dest_keyring that
967 .\" was supplied to a call to request_key(2)?
969 .\" David Howells said: to be checked
972 All other values are invalid.
973 .\" (including the still-unsupported KEY_REQKEY_DEFL_GROUP_KEYRING)
982 The setting controlled by this operation is inherited by the child of
987 This operation is exposed by
990 .BR keyctl_set_reqkey_keyring (3).
992 .BR KEYCTL_SET_TIMEOUT " (since Linux 2.6.16)"
993 Set a timeout on a key.
995 The ID of the key is specified in
999 The timeout value, in seconds from the current time,
1003 .IR "unsigned int" ).
1004 The timeout is measured against the realtime clock.
1006 Specifying the timeout value as 0 clears any existing timeout on the key.
1010 file displays the remaining time until each key will expire.
1011 (This is the only method of discovering the timeout on a key.)
1013 The caller must either have the
1015 permission on the key
1016 or hold an instantiation authorization token for the key (see
1017 .BR request_key (2)).
1019 The key and any links to the key will be
1020 automatically garbage collected after the timeout expires.
1021 Subsequent attempts to access the key will then fail with the error
1024 This operation cannot be used to set timeouts on revoked, expired,
1025 or negatively instantiated keys.
1033 This operation is exposed by
1036 .BR keyctl_set_timeout (3).
1038 .BR KEYCTL_ASSUME_AUTHORITY " (since Linux 2.6.16)"
1039 Assume (or divest) the authority for the calling thread
1040 to instantiate a key.
1046 specifies either a nonzero key ID to assume authority,
1047 or the value 0 to divest authority.
1051 is nonzero, then it specifies the ID of an uninstantiated key for which
1052 authority is to be assumed.
1053 That key can then be instantiated using one of
1054 .BR KEYCTL_INSTANTIATE ,
1055 .BR KEYCTL_INSTANTIATE_IOV ,
1059 Once the key has been instantiated,
1060 the thread is automatically divested of authority to instantiate the key.
1062 Authority over a key can be assumed only if the calling thread has present
1063 in its keyrings the authorization key that is
1064 associated with the specified key.
1065 (In other words, the
1066 .B KEYCTL_ASSUME_AUTHORITY
1067 operation is available only from a
1068 .BR request\-key (8)-style
1071 for an explanation of how this operation is used.)
1072 The caller must have
1074 permission on the authorization key.
1076 If the specified key has a matching authorization key,
1077 then the ID of that key is returned.
1078 The authorization key can be read
1080 to obtain the callout information passed to
1081 .BR request_key (2).
1085 is 0, then the currently assumed authority is cleared (divested),
1086 and the value 0 is returned.
1089 .B KEYCTL_ASSUME_AUTHORITY
1090 mechanism allows a program such as
1091 .BR request\-key (8)
1092 to assume the necessary authority to instantiate a new uninstantiated key
1093 that was created as a consequence of a call to
1094 .BR request_key (2).
1095 For further information, see
1097 and the kernel source file
1098 .IR Documentation/security/keys\-request\-key.txt .
1107 This operation is exposed by
1110 .BR keyctl_assume_authority (3).
1112 .BR KEYCTL_GET_SECURITY " (since Linux 2.6.26)"
1113 .\" commit 70a5bb72b55e82fbfbf1e22cae6975fac58a1e2d
1114 Get the LSM (Linux Security Module) security label of the specified key.
1116 The ID of the key whose security label is to be fetched is specified in
1120 The security label (terminated by a null byte)
1121 will be placed in the buffer pointed to by
1125 the size of the buffer must be provided in
1132 is specified as NULL or the buffer size specified in
1134 is too small, the full size of the security label string
1135 (including the terminating null byte)
1136 is returned as the function result,
1137 and nothing is copied to the buffer.
1139 The caller must have
1141 permission on the specified key.
1143 The returned security label string will be rendered in a form appropriate
1144 to the LSM in force.
1145 For example, with SELinux, it may look like:
1149 unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
1153 If no LSM is currently in force,
1154 then an empty string is placed in the buffer.
1158 argument is ignored.
1160 This operation is exposed by
1163 .BR keyctl_get_security (3)
1165 .BR keyctl_get_security_alloc (3).
1167 .BR KEYCTL_SESSION_TO_PARENT " (since Linux 2.6.32)"
1168 .\" commit ee18d64c1f632043a02e6f5ba5e045bb26a5465f
1169 Replace the session keyring to which the
1171 of the calling process
1172 subscribes with the session keyring of the calling process.
1173 .\" What is the use case for KEYCTL_SESSION_TO_PARENT?
1174 .\" David Howells: the Process Authentication Groups people requested this,
1175 .\" but then didn't use it; maybe there are no users.
1177 The keyring will be replaced in the parent process at the point
1178 where the parent next transitions from kernel space to user space.
1180 The keyring must exist and must grant the caller
1183 The parent process must be single-threaded and have
1184 the same effective ownership as this process
1185 and must not be set-user-ID or set-group-ID.
1186 The UID of the parent process's existing session keyring (f it has one),
1187 as well as the UID of the caller's session keyring
1188 much match the caller's effective UID.
1190 The fact that it is the parent process that is affected by this operation
1191 allows a program such as the shell to start a child process that
1192 uses this operation to change the shell's session keyring.
1206 This operation is exposed by
1209 .BR keyctl_session_to_parent (3).
1211 .BR KEYCTL_REJECT " (since Linux 2.6.39)"
1212 .\" commit fdd1b94581782a2ddf9124414e5b7a5f48ce2f9c
1213 Mark a key as negatively instantiated and set an expiration timer
1215 This operation provides a superset of the functionality of the earlier
1219 The ID of the key that is to be negatively instantiated is specified in
1226 .IR "unsigned int" )
1227 argument specifies the lifetime of the key, in seconds.
1231 .IR "unsigned int" )
1232 specifies the error to be returned when a search hits this key;
1233 typically, this is one of
1243 is nonzero, then, subject to the same constraints and rules as
1245 the negatively instantiated key is linked into the keyring
1246 whose ID is specified in
1249 The caller must have the appropriate authorization key.
1250 In other words, this operation is available only from a
1251 .BR request\-key (8)-style
1254 .BR request_key (2).
1256 The caller must have the appropriate authorization key,
1257 and once the uninstantiated key has been instantiated,
1258 the authorization key is revoked.
1259 In other words, this operation is available only from a
1260 .BR request\-key (8)-style
1264 for an explanation of uninstantiated keys and key instantiation.
1266 This operation is exposed by
1269 .BR keyctl_reject (3).
1271 .BR KEYCTL_INSTANTIATE_IOV " (since Linux 2.6.39)"
1272 .\" commit ee009e4a0d4555ed522a631bae9896399674f063
1273 Instantiate an uninstantiated key with a payload specified
1274 via a vector of buffers.
1276 This operation is the same as
1277 .BR KEYCTL_INSTANTIATE ,
1278 but the payload data is specified as an array of
1283 The pointer to the payload vector is specified in
1286 .IR "const struct iovec\~*" ).
1287 The number of items in the vector is specified in
1290 .IR "unsigned int" ).
1298 are interpreted as for
1299 .BR KEYCTL_INSTANTIATE .
1301 This operation is exposed by
1304 .BR keyctl_instantiate_iov (3).
1306 .BR KEYCTL_INVALIDATE " (since Linux 3.5)"
1307 .\" commit fd75815f727f157a05f4c96b5294a4617c0557da
1308 Mark a key as invalid.
1310 The ID of the key to be invalidated is specified in
1315 To invalidate a key,
1316 the caller must have
1318 permission on the key.
1319 .\" CAP_SYS_ADMIN is permitted to invalidate certain special keys
1321 This operation marks the key as invalid
1322 and schedules immediate garbage collection.
1323 The garbage collector removes the invalidated key from all keyrings and
1324 deletes the key when its reference count reaches zero.
1325 After this operation,
1326 the key will be ignored by all searches,
1327 even if it is not yet deleted.
1329 Keys that are marked invalid become invisible to normal key operations
1330 immediately, though they are still visible in
1332 (marked with an 'i' flag)
1333 until they are actually removed.
1342 This operation is exposed by
1345 .BR keyctl_invalidate (3).
1347 .BR KEYCTL_GET_PERSISTENT " (since Linux 3.13)"
1348 .\" commit f36f8c75ae2e7d4da34f4c908cebdb4aa42c977e
1349 Get the persistent keyring
1350 .RB ( persistent\-keyring (7))
1351 for a specified user and link it to a specified keyring.
1353 The user ID is specified in
1357 If the value \-1 is specified, the caller's real user ID is used.
1358 The ID of the destination keyring is specified in
1363 The caller must have the
1365 capability in its user namespace in order to fetch the persistent keyring
1366 for a user ID that does not match either the real or effective user ID
1369 If the call is successful,
1370 a link to the persistent keyring is added to the keyring
1371 whose ID was specified in
1374 The caller must have
1376 permission on the keyring.
1378 The persistent keyring will be created by the kernel
1379 if it does not yet exist.
1382 .B KEYCTL_GET_PERSISTENT
1383 operation is performed, the persistent keyring will
1384 have its expiration timeout reset to the value in:
1388 /proc/sys/kernel/keys/persistent_keyring_expiry
1392 Should the timeout be reached,
1393 the persistent keyring will be removed and
1394 everything it pins can then be garbage collected.
1396 Persistent keyrings were added to Linux in kernel version 3.13.
1404 This operation is exposed by
1407 .BR keyctl_get_persistent (3).
1409 .BR KEYCTL_DH_COMPUTE " (since Linux 4.7)"
1410 .\" commit ddbb41148724367394d0880c516bfaeed127b52e
1411 Compute a Diffie-Hellman shared secret or public key,
1412 optionally applying key derivation function (KDF) to the result.
1416 argument is a pointer to a set of parameters containing
1417 serial numbers for three
1419 keys used in the Diffie-Hellman calculation,
1420 packaged in a structure of the following form:
1424 struct keyctl_dh_params {
1425 int32_t private; /* The local private key */
1426 int32_t prime; /* The prime, known to both parties */
1427 int32_t base; /* The base integer: either a shared
1428 generator or the remote public key */
1433 Each of the three keys specified in this structure must grant the caller
1436 The payloads of these keys are used to calculate the Diffie-Hellman
1441 base \(ha private mod prime
1445 If the base is the shared generator, the result is the local public key.
1446 If the base is the remote public key, the result is the shared secret.
1452 points to a buffer where the result of the calculation is placed.
1453 The size of that buffer is specified in
1458 The buffer must be large enough to accommodate the output data,
1459 otherwise an error is returned.
1463 in which case the buffer is not used and
1464 the operation returns the minimum required buffer size
1465 (i.e., the length of the prime).
1467 Diffie-Hellman computations can be performed in user space,
1468 but require a multiple-precision integer (MPI) library.
1469 Moving the implementation into the kernel gives access to
1470 the kernel MPI implementation,
1471 and allows access to secure or acceleration hardware.
1473 Adding support for DH computation to the
1475 system call was considered a good fit due to the DH algorithm's use
1476 for deriving shared keys;
1477 it also allows the type of the key to determine
1478 which DH implementation (software or hardware) is appropriate.
1479 .\" commit f1c316a3ab9d24df6022682422fe897492f2c0c8
1485 then the DH result itself is returned.
1486 Otherwise (since Linux 4.12), it is a pointer to a structure which specifies
1487 parameters of the KDF operation to be applied:
1491 struct keyctl_kdf_params {
1492 char *hashname; /* Hash algorithm name */
1493 char *otherinfo; /* SP800\-56A OtherInfo */
1494 __u32 otherinfolen; /* Length of otherinfo data */
1495 __u32 __spare[8]; /* Reserved */
1502 field is a null-terminated string which specifies a hash name
1503 (available in the kernel's crypto API; the list of the hashes available
1504 is rather tricky to observe; please refer to the
1505 .UR https://www.kernel.org\:/doc\:/html\:/latest\:/crypto\:/architecture.html
1506 "Kernel Crypto API Architecture"
1508 documentation for the information regarding how hash names are constructed and
1509 your kernel's source and configuration regarding what ciphers
1510 and templates with type
1511 .B CRYPTO_ALG_TYPE_SHASH
1513 to be applied to DH result in KDF operation.
1519 data as described in SP800-56A section 5.8.1.2 and is algorithm-specific.
1520 This data is concatenated with the result of DH operation and is provided as
1521 an input to the KDF operation.
1522 Its size is provided in the
1524 field and is limited by
1525 .B KEYCTL_KDF_MAX_OI_LEN
1526 constant that defined in
1527 .I security/keys/internal.h
1532 field is currently unused.
1533 .\" commit 4f9dabfaf8df971f8a3b6aa324f8f817be38d538
1534 It was ignored until Linux 4.13 (but still should be
1535 user-addressable since it is copied to the kernel),
1536 and should contain zeros since Linux 4.13.
1538 The KDF implementation complies with SP800-56A as well
1539 as with SP800-108 (the counter KDF).
1541 .\" keyutils commit 742c9d7b94051d3b21f9f61a73ed6b5f3544cb82
1542 .\" keyutils commit d68a981e5db41d059ac782071c35d1e8f3aaf61c
1543 This operation is exposed by
1545 (from version 1.5.10 onwards) via the functions
1546 .BR keyctl_dh_compute (3)
1548 .BR keyctl_dh_compute_alloc (3).
1550 .BR KEYCTL_RESTRICT_KEYRING " (since Linux 4.12)"
1551 .\" commit 6563c91fd645556c7801748f15bc727c77fcd311
1552 .\" commit 7228b66aaf723a623e578aa4db7d083bb39546c9
1553 Apply a key-linking restriction to the keyring with the ID provided in
1557 The caller must have
1559 permission on the key.
1562 is NULL, any attempt to add a key to the keyring is blocked;
1563 otherwise it contains a pointer to a string with a key type name and
1565 contains a pointer to string that describes the type-specific restriction.
1566 As of Linux 4.12, only the type "asymmetric" has restrictions defined:
1570 Allows only keys that are signed by a key linked to the built-in keyring
1571 (".builtin_trusted_keys").
1573 .B builtin_and_secondary_trusted
1574 Allows only keys that are signed by a key linked to the secondary keyring
1575 (".secondary_trusted_keys") or, by extension, a key in a built-in keyring,
1576 as the latter is linked to the former.
1578 .BI key_or_keyring: key
1580 .BI key_or_keyring: key :chain
1583 specifies the ID of a key of type "asymmetric",
1584 then only keys that are signed by this key are allowed.
1588 specifies the ID of a keyring,
1589 then only keys that are signed by a key linked
1590 to this keyring are allowed.
1592 If ":chain" is specified, keys that are signed by a keys linked to the
1593 destination keyring (that is, the keyring with the ID specified in the
1595 argument) are also allowed.
1598 Note that a restriction can be configured only once for the specified keyring;
1599 once a restriction is set, it can't be overridden.
1604 .\" FIXME Document KEYCTL_RESTRICT_KEYRING, added in Linux 4.12
1605 .\" commit 6563c91fd645556c7801748f15bc727c77fcd311
1606 .\" Author: Mat Martineau <mathew.j.martineau@linux.intel.com>
1607 .\" See Documentation/security/keys.txt
1609 For a successful call, the return value depends on the operation:
1611 .B KEYCTL_GET_KEYRING_ID
1612 The ID of the requested keyring.
1614 .B KEYCTL_JOIN_SESSION_KEYRING
1615 The ID of the joined session keyring.
1618 The size of the description (including the terminating null byte),
1619 irrespective of the provided buffer size.
1622 The ID of the key that was found.
1625 The amount of data that is available in the key,
1626 irrespective of the provided buffer size.
1628 .B KEYCTL_SET_REQKEY_KEYRING
1629 The ID of the previous default keyring
1630 to which implicitly requested keys were linked
1632 .BR KEY_REQKEY_DEFL_USER_* ).
1634 .B KEYCTL_ASSUME_AUTHORITY
1635 Either 0, if the ID given was 0,
1636 or the ID of the authorization key matching the specified key,
1637 if a nonzero key ID was provided.
1639 .B KEYCTL_GET_SECURITY
1640 The size of the LSM security label string
1641 (including the terminating null byte),
1642 irrespective of the provided buffer size.
1644 .B KEYCTL_GET_PERSISTENT
1645 The ID of the persistent keyring.
1647 .B KEYCTL_DH_COMPUTE
1648 The number of bytes copied to the buffer, or, if
1650 is 0, the required buffer size.
1652 All other operations
1655 On error, \-1 is returned, and
1657 is set to indicate the error.
1661 The requested operation wasn't permitted.
1666 .B KEYCTL_DH_COMPUTE
1667 and there was an error during crypto module initialization.
1673 and the requested link would result in a cycle.
1678 .B KEYCTL_RESTRICT_KEYRING
1679 and the requested keyring restriction would result in a cycle.
1682 The key quota for the caller's user would be exceeded by creating a key or
1683 linking it to the keyring.
1688 .B KEYCTL_RESTRICT_KEYRING
1689 and keyring provided in
1691 argument already has a restriction set.
1696 .B KEYCTL_DH_COMPUTE
1697 and one of the following has failed:
1701 .IR "struct keyctl_dh_params" ,
1704 argument, from user space;
1707 .IR "struct keyctl_kdf_params" ,
1708 provided in the non-NULL
1710 argument, from user space
1711 (in case kernel supports performing KDF operation on DH operation result);
1713 copying of data pointed by the
1716 .I "struct keyctl_kdf_params"
1719 copying of data pointed by the
1722 .I struct keyctl_kdf_params
1723 from user space if the
1727 copying of the result to user space.
1734 and an invalid permission bit was specified in
1741 and the size of the description in
1743 (including the terminating null byte) exceeded 4096 bytes.
1746 size of the string (including the terminating null byte) specified in
1751 (the key description)
1752 exceeded the limit (32 bytes and 4096 bytes respectively).
1754 .BR EINVAL " (Linux kernels before 4.12)"
1757 .BR KEYCTL_DH_COMPUTE ,
1765 .B KEYCTL_DH_COMPUTE
1766 And the digest size of the hashing algorithm supplied is zero.
1771 .B KEYCTL_DH_COMPUTE
1772 and the buffer size provided is not enough to hold the result.
1773 Provide 0 as a buffer size in order to obtain the minimum buffer size.
1778 .B KEYCTL_DH_COMPUTE
1779 and the hash name provided in the
1782 .I struct keyctl_kdf_params
1785 argument is too big (the limit is implementation-specific and varies between
1786 kernel versions, but it is deemed big enough for all valid algorithm names).
1789 .\" commit 4f9dabfaf8df971f8a3b6aa324f8f817be38d538
1792 .B KEYCTL_DH_COMPUTE
1796 .I struct keyctl_kdf_params
1799 argument contains nonzero values.
1802 An expired key was found or specified.
1805 A rejected key was found or specified.
1808 A revoked key was found or specified.
1814 and the requested link would cause the maximum nesting depth
1815 for keyrings to be exceeded.
1820 .B KEYCTL_DH_COMPUTE
1821 and the buffer length exceeds
1822 .B KEYCTL_KDF_MAX_OUTPUT_LEN
1823 (which is 1024 currently)
1827 .I struct keyctl_kdf_parms
1831 .B KEYCTL_KDF_MAX_OI_LEN
1832 (which is 64 currently).
1834 .BR ENFILE " (Linux kernels before 3.13)"
1838 and the keyring is full.
1840 .\" commit b2a4df200d570b2c33a57e1ebfa5896e4bc81b69
1841 the available space for storing keyring links was limited to
1842 a single page of memory; since Linux 3.13, there is no fixed limit.)
1848 and the key to be unlinked isn't linked to the keyring.
1853 .B KEYCTL_DH_COMPUTE
1854 and the hashing algorithm specified in the
1857 .I struct keyctl_kdf_params
1860 argument hasn't been found.
1865 .B KEYCTL_RESTRICT_KEYRING
1866 and the type provided in
1868 argument doesn't support setting key linking restrictions.
1871 No matching key was found or an invalid key was specified.
1875 .B KEYCTL_GET_KEYRING_ID
1878 the key specified in
1882 was zero (meaning don't create the key if it didn't exist).
1885 One of kernel memory allocation routines failed during the execution of the
1889 A key of keyring type was expected but the ID of a key with
1890 a different type was provided.
1896 and the key type does not support reading
1904 and the key type does not support updating.
1909 .BR KEYCTL_RESTRICT_KEYRING ,
1910 the type provided in
1912 argument was "asymmetric",
1913 and the key specified in the restriction specification provided in
1915 has type other than "asymmetric" or "keyring".
1920 .BR KEYCTL_GET_PERSISTENT ,
1922 specified a UID other than the calling thread's real or effective UID,
1923 and the caller did not have the
1930 .B KEYCTL_SESSION_TO_PARENT
1932 all of the UIDs (GIDs) of the parent process do not match
1933 the effective UID (GID) of the calling process;
1934 the UID of the parent's existing session keyring or
1935 the UID of the caller's session keyring did not match
1936 the effective UID of the caller;
1937 the parent process is not single-thread;
1938 or the parent process is
1945 .B KEYCTL_DH_COMPUTE
1946 and the initialization of crypto modules has timed out.
1948 This system call first appeared in Linux 2.6.10.
1950 This system call is a nonstandard Linux extension.
1952 A wrapper is provided in the
1955 (The accompanying package provides the
1958 However, rather than using this system call directly,
1959 you probably want to use the various library functions
1960 mentioned in the descriptions of individual operations above.
1962 The program below provide subset of the functionality of the
1963 .BR request\-key (8)
1964 program provided by the
1967 For informational purposes,
1968 the program records various information in a log file.
1971 .BR request_key (2),
1973 .BR request\-key (8)
1974 program is invoked with command-line arguments that
1975 describe a key that is to be instantiated.
1976 The example program fetches and logs these arguments.
1977 The program assumes authority to instantiate the requested key,
1978 and then instantiates that key.
1980 The following shell session demonstrates the use of this program.
1982 we compile the program and then use it to temporarily replace the standard
1983 .BR request\-key (8)
1985 (Note that temporarily disabling the standard
1986 .BR request\-key (8)
1987 program may not be safe on some systems.)
1988 While our example program is installed,
1989 we use the example program shown in
1995 $ \fBcc \-o key_instantiate key_instantiate.c \-lkeyutils\fP
1996 $ \fBsudo mv /sbin/request\-key /sbin/request\-key.backup\fP
1997 $ \fBsudo cp key_instantiate /sbin/request\-key\fP
1998 $ \fB./t_request_key user mykey somepayloaddata\fP
2000 $ \fBsudo mv /sbin/request\-key.backup /sbin/request\-key\fP
2004 Looking at the log file created by this program,
2005 we can see the command-line arguments supplied to our example program:
2009 $ \fBcat /tmp/key_instantiate.log\fP
2010 Time: Mon Nov 7 13:06:47 2016
2012 Command line arguments:
2013 argv[0]: /sbin/request\-key
2015 key_to_instantiate: 20d035bf
2020 session_keyring: 256e6a6
2022 Key description: user;1000;1000;3f010000;mykey
2023 Auth key payload: somepayloaddata
2024 Destination keyring: 256e6a6
2025 Auth key description: .request_key_auth;1000;1000;0b010000;20d035bf
2029 The last few lines of the above output show that the example program
2032 the description of the key to be instantiated,
2033 which included the name of the key
2036 the payload of the authorization key, which consisted of the data
2037 .RI ( somepayloaddata )
2039 .BR request_key (2);
2041 the destination keyring that was specified in the call to
2042 .BR request_key (2);
2045 the description of the authorization key,
2046 where we can see that the name of the authorization key matches
2047 the ID of the key that is to be instantiated
2050 The example program in
2052 specified the destination keyring as
2053 .BR KEY_SPEC_SESSION_KEYRING .
2054 By examining the contents of
2056 we can see that this was translated to the ID of the destination keyring
2058 shown in the log output above;
2059 we can also see the newly created key with the name
2066 $ \fBcat /proc/keys | egrep \(aqmykey|256e6a6\(aq\fP
2067 0256e6a6 I\-\-Q\-\-\- 194 perm 3f030000 1000 1000 keyring _ses: 3
2068 20d035bf I\-\-Q\-\-\- 1 perm 3f010000 1000 1000 user mykey: 16
2073 .\" SRC BEGIN (key_instantiate.c)
2075 /* key_instantiate.c */
2078 #include <keyutils.h>
2083 #include <sys/types.h>
2086 #ifndef KEY_SPEC_REQUESTOR_KEYRING
2087 #define KEY_SPEC_REQUESTOR_KEYRING (\-8)
2091 main(int argc, char *argv[])
2093 int akp_size; /* Size of auth_key_payload */
2096 char auth_key_payload[256];
2102 key_serial_t key_to_instantiate, dest_keyring;
2103 key_serial_t thread_keyring, process_keyring, session_keyring;
2106 fprintf(stderr, "Usage: %s op key uid gid thread_keyring "
2107 "process_keyring session_keyring\en", argv[0]);
2111 fp = fopen("/tmp/key_instantiate.log", "w");
2118 fprintf(fp, "Time: %s\en", ctime(&t));
2121 * The kernel passes a fixed set of arguments to the program
2122 * that it execs; fetch them.
2124 operation = argv[1];
2125 key_to_instantiate = atoi(argv[2]);
2126 uid = atoi(argv[3]);
2127 gid = atoi(argv[4]);
2128 thread_keyring = atoi(argv[5]);
2129 process_keyring = atoi(argv[6]);
2130 session_keyring = atoi(argv[7]);
2132 fprintf(fp, "Command line arguments:\en");
2133 fprintf(fp, " argv[0]: %s\en", argv[0]);
2134 fprintf(fp, " operation: %s\en", operation);
2135 fprintf(fp, " key_to_instantiate: %jx\en",
2136 (uintmax_t) key_to_instantiate);
2137 fprintf(fp, " UID: %jd\en", (intmax_t) uid);
2138 fprintf(fp, " GID: %jd\en", (intmax_t) gid);
2139 fprintf(fp, " thread_keyring: %jx\en",
2140 (uintmax_t) thread_keyring);
2141 fprintf(fp, " process_keyring: %jx\en",
2142 (uintmax_t) process_keyring);
2143 fprintf(fp, " session_keyring: %jx\en",
2144 (uintmax_t) session_keyring);
2148 * Assume the authority to instantiate the key named in argv[2].
2150 if (keyctl(KEYCTL_ASSUME_AUTHORITY, key_to_instantiate) == \-1) {
2151 fprintf(fp, "KEYCTL_ASSUME_AUTHORITY failed: %s\en",
2157 * Fetch the description of the key that is to be instantiated.
2159 if (keyctl(KEYCTL_DESCRIBE, key_to_instantiate,
2160 dbuf, sizeof(dbuf)) == \-1) {
2161 fprintf(fp, "KEYCTL_DESCRIBE failed: %s\en", strerror(errno));
2165 fprintf(fp, "Key description: %s\en", dbuf);
2168 * Fetch the payload of the authorization key, which is
2169 * actually the callout data given to request_key().
2171 akp_size = keyctl(KEYCTL_READ, KEY_SPEC_REQKEY_AUTH_KEY,
2172 auth_key_payload, sizeof(auth_key_payload));
2173 if (akp_size == \-1) {
2174 fprintf(fp, "KEYCTL_READ failed: %s\en", strerror(errno));
2178 auth_key_payload[akp_size] = \(aq\e0\(aq;
2179 fprintf(fp, "Auth key payload: %s\en", auth_key_payload);
2182 * For interest, get the ID of the authorization key and
2185 auth_key = keyctl(KEYCTL_GET_KEYRING_ID,
2186 KEY_SPEC_REQKEY_AUTH_KEY);
2187 if (auth_key == \-1) {
2188 fprintf(fp, "KEYCTL_GET_KEYRING_ID failed: %s\en",
2193 fprintf(fp, "Auth key ID: %jx\en", (uintmax_t) auth_key);
2196 * Fetch key ID for the request_key(2) destination keyring.
2198 dest_keyring = keyctl(KEYCTL_GET_KEYRING_ID,
2199 KEY_SPEC_REQUESTOR_KEYRING);
2200 if (dest_keyring == \-1) {
2201 fprintf(fp, "KEYCTL_GET_KEYRING_ID failed: %s\en",
2206 fprintf(fp, "Destination keyring: %jx\en", (uintmax_t) dest_keyring);
2209 * Fetch the description of the authorization key. This
2210 * allows us to see the key type, UID, GID, permissions,
2211 * and description (name) of the key. Among other things,
2212 * we will see that the name of the key is a hexadecimal
2213 * string representing the ID of the key to be instantiated.
2215 if (keyctl(KEYCTL_DESCRIBE, KEY_SPEC_REQKEY_AUTH_KEY,
2216 dbuf, sizeof(dbuf)) == \-1)
2218 fprintf(fp, "KEYCTL_DESCRIBE failed: %s\en", strerror(errno));
2222 fprintf(fp, "Auth key description: %s\en", dbuf);
2225 * Instantiate the key using the callout data that was supplied
2226 * in the payload of the authorization key.
2228 if (keyctl(KEYCTL_INSTANTIATE, key_to_instantiate,
2229 auth_key_payload, akp_size + 1, dest_keyring) == \-1)
2231 fprintf(fp, "KEYCTL_INSTANTIATE failed: %s\en",
2245 .BR request_key (2),
2246 .\" .BR find_key_by_type_and_name (3)
2247 .\" There is a man page, but this function seems not to exist
2249 .BR keyctl_assume_authority (3),
2250 .BR keyctl_chown (3),
2251 .BR keyctl_clear (3),
2252 .BR keyctl_describe (3),
2253 .BR keyctl_describe_alloc (3),
2254 .BR keyctl_dh_compute (3),
2255 .BR keyctl_dh_compute_alloc (3),
2256 .BR keyctl_get_keyring_ID (3),
2257 .BR keyctl_get_persistent (3),
2258 .BR keyctl_get_security (3),
2259 .BR keyctl_get_security_alloc (3),
2260 .BR keyctl_instantiate (3),
2261 .BR keyctl_instantiate_iov (3),
2262 .BR keyctl_invalidate (3),
2263 .BR keyctl_join_session_keyring (3),
2264 .BR keyctl_link (3),
2265 .BR keyctl_negate (3),
2266 .BR keyctl_read (3),
2267 .BR keyctl_read_alloc (3),
2268 .BR keyctl_reject (3),
2269 .BR keyctl_revoke (3),
2270 .BR keyctl_search (3),
2271 .BR keyctl_session_to_parent (3),
2272 .BR keyctl_set_reqkey_keyring (3),
2273 .BR keyctl_set_timeout (3),
2274 .BR keyctl_setperm (3),
2275 .BR keyctl_unlink (3),
2276 .BR keyctl_update (3),
2277 .BR recursive_key_scan (3),
2278 .BR recursive_session_key_scan (3),
2279 .BR capabilities (7),
2280 .BR credentials (7),
2283 .BR persistent\-keyring (7),
2284 .BR process\-keyring (7),
2285 .BR session\-keyring (7),
2286 .BR thread\-keyring (7),
2287 .BR user\-keyring (7),
2288 .BR user_namespaces (7),
2289 .BR user\-session\-keyring (7),
2290 .BR request\-key (8)
2292 The kernel source files under
2293 .I Documentation/security/keys/
2294 (or, before Linux 4.13, in the file
2295 .IR Documentation/security/keys.txt ).