keyctl — manipulate the kernel's key management facility
#include <keyutils.h>
long
keyctl( |
int cmd, |
...); |
keyctl() has a number of
functions available:
KEYCTL_GET_KEYRING_IDAsk for a keyring's ID.
KEYCTL_JOIN_SESSION_KEYRINGJoin or start named session keyring.
KEYCTL_UPDATEUpdate a key.
KEYCTL_REVOKERevoke a key.
KEYCTL_CHOWNSet ownership of a key.
KEYCTL_SETPERMSet perms on a key.
KEYCTL_DESCRIBEDescribe a key.
KEYCTL_CLEARClear contents of a keyring.
KEYCTL_LINKLink a key into a keyring.
KEYCTL_UNLINKUnlink a key from a keyring.
KEYCTL_SEARCHSearch for a key in a keyring.
KEYCTL_READRead a key or keyring's contents.
KEYCTL_INSTANTIATEInstantiate a partially constructed key.
KEYCTL_NEGATENegate a partially constructed key.
KEYCTL_SET_REQKEY_KEYRINGSet default request-key keyring.
KEYCTL_SET_TIMEOUTSet timeout on a key.
KEYCTL_ASSUME_AUTHORITYAssume authority to instantiate key.
These are wrapped by libkeyutils into individual
functions to permit the compiler to check types. See the
See Also section at
the bottom.
On success keyctl() returns
the serial number of the key it found. On error, the value
−1 will be returned and errno will have been set to an
appropriate error.
A key operation wasn't permitted.
The key quota for the caller's user would be exceeded by creating a key or linking it to the keyring.
An expired key was found or specified.
A rejected key was found or specified.
A revoked key was found or specified.
No matching key was found or an invalid key was specified.
Although this is a Linux system call, it is not present in
libc but can be
found rather in libkeyutils. When linking,
−lkeyutils should be
specified to the linker.
keyctl(1), add_key(2), request_key(2), keyctl_set_timeout(3), keyctl_chown(3), keyctl_clear(3), keyctl_describe(3), keyctl_describe_alloc(3), keyctl_get_keyring_ID(3), keyctl_instantiate(3), keyctl_join_session_keyring(3), keyctl_link(3), keyctl_negate(3), keyctl_revoke(3), keyctl_search(3), keyctl_setperm(3), keyctl_set_reqkey_keyring(3), keyctl_set_timeout(3), keyctl_read(3), keyctl_read_alloc(3), keyctl_unlink(3), keyctl_update(3), keyrings(7), request-key(8)
The kernel source file Documentation/security/keys.txt.
This page is part of release 4.07 of the Linux man-pages project. A
description of the project, information about reporting bugs,
and the latest version of this page, can be found at
https://www.kernel.org/doc/man−pages/.
|
Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. Written by David Howells (dhowellsredhat.com) %%%LICENSE_START(GPLv2+_SW_ONEPARA) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. %%%LICENSE_END FIXME Document KEYCTL_GET_SECURITY (new in 2.6.26) commit 70a5bb72b55e82fbfbf1e22cae6975fac58a1e2d Author: David Howells <dhowellsredhat.com> Date: Tue Apr 29 01:01:26 2008 -0700 FIXME Document KEYCTL_SESSION_TO_PARENT (new in 2.6.32) commit ee18d64c1f632043a02e6f5ba5e045bb26a5465f Author: David Howells <dhowellsredhat.com> Date: Wed Sep 2 09:14:21 2009 +0100 FIXME Document KEYCTL_REJECT (new in 2.6.39) commit fdd1b94581782a2ddf9124414e5b7a5f48ce2f9c Author: David Howells <dhowellsredhat.com> Documentation/security/keys.txt FIXME Document KEYCTL_INSTANTIATE_IOV (new in 2.6.39) commit ee009e4a0d4555ed522a631bae9896399674f064 Author: David Howells <dhowellsredhat.com> Documentation/security/keys.txt FIXME Document KEYCTL_INVALIDATE (new in 3.5) commit fd75815f727f157a05f4c96b5294a4617c0557da Author: David Howells <dhowellsredhat.com> Documentation/security/keys.txt FIXME Document KEYCTL_GET_PERSISTENT (new in 3.13) commit f36f8c75ae2e7d4da34f4c908cebdb4aa42c977e Author: David Howells <dhowellsredhat.com> |