.\" .\" Copyright (C) 2013 Red Hat, Inc. All Rights Reserved. .\" Written by David Howells (dhowells@redhat.com) .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public Licence .\" as published by the Free Software Foundation; either version .\" 2 of the Licence, or (at your option) any later version. .\" .TH FIND_KEY_BY_TYPE_AND_NAME 3 "10 Sep 2013" Linux "Linux Key Utility Calls" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH NAME find_key_by_type_and_name \- find a key by type and name .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH SYNOPSIS .nf .B #include .sp .BI "key_serial_t find_key_by_type_and_name(const char *" type , .BI " const char *" description ", key_serial_t " destringid ");" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH DESCRIPTION .BR find_key_by_type_and_name () searches for a key with the given .I type and exact .IR description , firstly in the thread, process and session keyrings to which a process is subscribed and secondly in .IR /proc/keys . .P If a key is found, and .I destringid is not 0 and specifies a keyring, then the found key will be linked into it. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH RETURN VALUE The function returns the ID of the key if a key was found or \-1 otherwise. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH ERRORS .TP .B ENOKEY No key was found or the keyring specified is invalid. .TP .B EKEYEXPIRED The key or keyring have expired. .TP .B EKEYREVOKED The key or keyring have been revoked. .TP .B EACCES The key is not accessible or keyring exists, but is not .B writable by the calling process. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH LINKING When linking, .B \-lkeyutils should be specified to the linker. .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .SH SEE ALSO .ad l .nh .BR request_key (2), .BR keyctl (3), .BR keyrings (7)