comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/man/man3/keyctl_read.3 @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 68:5028fdace37b
1 .\"
2 .\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
3 .\" Written by David Howells (dhowells@redhat.com)
4 .\"
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License
7 .\" as published by the Free Software Foundation; either version
8 .\" 2 of the License, or (at your option) any later version.
9 .\"
10 .TH KEYCTL_READ 3 "21 Feb 2014" Linux "Linux Key Management Calls"
11 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 .SH NAME
13 keyctl_read \- read a key
14 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
15 .SH SYNOPSIS
16 .nf
17 .B #include <keyutils.h>
18 .sp
19 .BI "long keyctl_read(key_serial_t " key ", char *" buffer ,
20 .BI "size_t" buflen ");"
21 .sp
22 .BI "long keyctl_read_alloc(key_serial_t " key ", void **" _buffer ");"
23 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
24 .SH DESCRIPTION
25 .BR keyctl_read ()
26 reads the payload of a key if the key type supports it.
27 .P
28 The caller must have
29 .B read
30 permission on a key to be able to read it.
31 .P
32 .I buffer
33 and
34 .I buflen
35 specify the buffer into which the payload data will be placed. If the buffer
36 is too small, then the full size of the payload will be returned, and the
37 contents of the buffer may be overwritten in some undefined way.
38 .P
39 .BR keyctl_read_alloc ()
40 is similar to
41 .BR keyctl_read ()
42 except that it allocates a buffer big enough to hold the payload data and
43 places the data in it. If successful, a pointer to the buffer is placed in
44 .IR *_buffer .
45 The caller must free the buffer.
46 .P
47 .BR keyctl_read_alloc ()
48 adds a NUL character after the data it retrieves, though this is not counted
49 in the size value it returns.
50 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
51 .SH READING KEYRINGS
52 This call can be used to list the contents of a keyring. The data is
53 presented to the user as an array of
54 .B key_serial_t
55 values, each of which corresponds to a key to which the keyring holds a link.
56 .P
57 The size of the keyring will be sizeof(key_serial_t) multiplied by the number
58 of keys. The size of key_serial_t is invariant across different word sizes,
59 though the byte-ordering is as appropriate for the kernel.
60 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
61 .SH RETURN VALUE
62 On success
63 .BR keyctl_read ()
64 returns the amount of data placed into the buffer. If the buffer was too
65 small, then the size of buffer required will be returned, and the contents of
66 the buffer may have been overwritten in some undefined way.
67 .P
68 On success
69 .BR keyctl_read_alloc ()
70 returns the amount of data in the buffer.
71 .P
72 On error, both functions set
73 .I errno
74 to an appropriate code and return the value
75 .BR -1 .
76 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
77 .SH ERRORS
78 .TP
79 .B ENOKEY
80 The key specified is invalid.
81 .TP
82 .B EKEYEXPIRED
83 The key specified has expired.
84 .TP
85 .B EKEYREVOKED
86 The key specified had been revoked.
87 .TP
88 .B EACCES
89 The key exists, but is not
90 .B readable
91 by the calling process.
92 .TP
93 .B EOPNOTSUPP
94 The key type does not support reading of the payload data.
95 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
96 .SH LINKING
97 This is a library function that can be found in
98 .IR libkeyutils .
99 When linking,
100 .B \-lkeyutils
101 should be specified to the linker.
102 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
103 .SH SEE ALSO
104 .ad l
105 .nh
106 .BR keyctl (1),
107 .BR add_key (2),
108 .BR keyctl (2),
109 .BR request_key (2),
110 .BR keyctl (3),
111 .BR keyrings (7),
112 .BR keyutils (7)