1 .\" Copyright (c) 2001 - 2002 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the Institute nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" $Id: krb5_auth_context.3,v 1.8 2003/04/16 13:58:13 lha Exp $
35 .Dt KRB5_AUTH_CONTEXT 3
38 .Nm krb5_auth_context ,
39 .Nm krb5_auth_con_init ,
40 .Nm krb5_auth_con_free ,
41 .Nm krb5_auth_con_setflags ,
42 .Nm krb5_auth_con_getflags ,
43 .Nm krb5_auth_con_setaddrs ,
44 .Nm krb5_auth_con_setaddrs_from_fd ,
45 .Nm krb5_auth_con_getaddrs ,
46 .Nm krb5_auth_con_genaddrs ,
47 .Nm krb5_auth_con_getkey ,
48 .Nm krb5_auth_con_setkey ,
49 .Nm krb5_auth_con_getuserkey ,
50 .Nm krb5_auth_con_setuserkey ,
51 .Nm krb5_auth_con_getlocalsubkey ,
52 .Nm krb5_auth_con_setlocalsubkey ,
53 .Nm krb5_auth_con_getremotesubkey ,
54 .Nm krb5_auth_con_setremotesubkey ,
55 .Nm krb5_auth_setcksumtype ,
56 .Nm krb5_auth_getcksumtype ,
57 .Nm krb5_auth_setkeytype ,
58 .Nm krb5_auth_getkeytype ,
59 .Nm krb5_auth_getlocalseqnumber ,
60 .Nm krb5_auth_setlocalseqnumber ,
61 .Nm krb5_auth_getremoteseqnumber ,
62 .Nm krb5_auth_setremoteseqnumber ,
63 .Nm krb5_auth_getauthenticator ,
64 .Nm krb5_auth_con_getrcache ,
65 .Nm krb5_auth_con_setrcache ,
66 .Nm krb5_auth_con_initivector ,
67 .Nm krb5_auth_con_setivector
68 .Nd manage authentication on connection level
70 Kerberos 5 Library (libkrb5, -lkrb5)
74 .Fo krb5_auth_con_init
75 .Fa "krb5_context context"
76 .Fa "krb5_auth_context *auth_context"
79 .Fo krb5_auth_con_free
80 .Fa "krb5_context context"
81 .Fa "krb5_auth_context auth_context"
84 .Fo krb5_auth_con_setflags
85 .Fa "krb5_context context"
86 .Fa "krb5_auth_context auth_context"
90 .Fo krb5_auth_con_getflags
91 .Fa "krb5_context context"
92 .Fa "krb5_auth_context auth_context"
96 .Fo krb5_auth_con_setaddrs
97 .Fa "krb5_context context"
98 .Fa "krb5_auth_context auth_context"
99 .Fa "krb5_address *local_addr"
100 .Fa "krb5_address *remote_addr"
103 .Fo krb5_auth_con_getaddrs
104 .Fa "krb5_context context"
105 .Fa "krb5_auth_context auth_context"
106 .Fa "krb5_address **local_addr"
107 .Fa "krb5_address **remote_addr"
110 .Fo krb5_auth_con_genaddrs
111 .Fa "krb5_context context"
112 .Fa "krb5_auth_context auth_context"
117 .Fo krb5_auth_con_setaddrs_from_fd
118 .Fa "krb5_context context"
119 .Fa "krb5_auth_context auth_context"
123 .Fo krb5_auth_con_getkey
124 .Fa "krb5_context context"
125 .Fa "krb5_auth_context auth_context"
126 .Fa "krb5_keyblock **keyblock"
129 .Fo krb5_auth_con_getlocalsubkey
130 .Fa "krb5_context context"
131 .Fa "krb5_auth_context auth_context"
132 .Fa "krb5_keyblock **keyblock"
135 .Fo krb5_auth_con_getremotesubkey
136 .Fa "krb5_context context"
137 .Fa "krb5_auth_context auth_context"
138 .Fa "krb5_keyblock **keyblock"
141 .Fo krb5_auth_con_initivector
142 .Fa "krb5_context context"
143 .Fa "krb5_auth_context auth_context"
146 .Fo krb5_auth_con_setivector
147 .Fa "krb5_context context"
148 .Fa "krb5_auth_context *auth_context"
149 .Fa "krb5_pointer ivector"
153 .Nm krb5_auth_context
154 structure holds all context related to an authenticated connection, in
157 that holds the context for the thread or process.
158 .Nm krb5_auth_context
159 is used by various functions that are directly related to
160 authentication between the server/client. Example of data that this
161 structure contains are various flags, addresses of client and server,
162 port numbers, keyblocks (and subkeys), sequence numbers, replay cache,
165 .Fn krb5_auth_con_init
166 allocates and initializes the
167 .Nm krb5_auth_context
168 structure. Default values can be changed with
169 .Fn krb5_auth_con_setcksumtype
171 .Fn krb5_auth_con_setflags .
174 structure must be freed by
175 .Fn krb5_auth_con_free .
177 .Fn krb5_auth_con_getflags
179 .Fn krb5_auth_con_setflags
180 gets and modifies the flags for a
181 .Nm krb5_auth_context
182 structure. Possible flags to set are:
184 .It Dv KRB5_AUTH_CONTEXT_DO_TIME
185 check timestamp on incoming packets.
186 .\".It Dv KRB5_AUTH_CONTEXT_RET_TIME
187 .It Dv KRB5_AUTH_CONTEXT_DO_SEQUENCE
188 Generate and check sequence-number on each packet.
189 .\".It Dv KRB5_AUTH_CONTEXT_RET_SEQUENCE
190 .\".It Dv KRB5_AUTH_CONTEXT_PERMIT_ALL
193 .Fn krb5_auth_con_setaddrs ,
194 .Fn krb5_auth_con_setaddrs_from_fd
196 .Fn krb5_auth_con_getaddrs
197 gets and sets the addresses that are checked when a packet is received.
198 It is mandatory to set an address for the remote
199 host. If the local address is not set, it iss deduced from the underlaying
201 .Fn krb5_auth_con_getaddrs
203 .Fn krb5_free_address
204 on any address that is passed in
208 .Fn krb5_auth_con_setaddr
215 in that case it will just not set that address.
217 .Fn krb5_auth_con_setaddrs_from_fd
218 fetches the addresses from a file descriptor.
220 .Fn krb5_auth_con_genaddrs
221 fetches the address information from the given file descriptor
223 depending on the bitmap argument
230 .It Va KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR
231 fetches the local address from
233 .It Va KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR
234 fetches the remote address from
238 .Fn krb5_auth_con_setkey ,
239 .Fn krb5_auth_con_setuserkey
241 .Fn krb5_auth_con_getkey
242 gets and sets the key used for this auth context. The keyblock returned by
243 .Fn krb5_auth_con_getkey
245 .Fn krb5_free_keyblock .
246 The keyblock send into
247 .Fn krb5_auth_con_setkey
249 .Nm krb5_auth_context ,
250 and thus no special handling is needed.
252 is not a valid keyblock to
253 .Fn krb5_auth_con_setkey .
255 .Fn krb5_auth_con_setuserkey
256 is only useful when doing user to user authentication.
257 .Fn krb5_auth_con_setkey
259 .Fn krb5_auth_con_setuserkey .
261 .Fn krb5_auth_con_getlocalsubkey ,
262 .Fn krb5_auth_con_setlocalsubkey ,
263 .Fn krb5_auth_con_getremotesubkey
265 .Fn krb5_auth_con_setremotesubkey
266 gets and sets the keyblock for the local and remote subkey. The keyblock returned by
267 .Fn krb5_auth_con_getlocalsubkey
269 .Fn krb5_auth_con_getremotesubkey
271 .Fn krb5_free_keyblock .
273 .Fn krb5_auth_setcksumtype
275 .Fn krb5_auth_getcksumtype
276 sets and gets the checksum type that should be used for this
279 .Fn krb5_auth_getremoteseqnumber
280 .Fn krb5_auth_setremoteseqnumber ,
281 .Fn krb5_auth_getlocalseqnumber
283 .Fn krb5_auth_setlocalseqnumber
284 gets and sets the sequence-number for the local and remote
285 sequence-number counter.
287 .Fn krb5_auth_setkeytype
289 .Fn krb5_auth_getkeytype
290 gets and gets the keytype of the keyblock in
291 .Nm krb5_auth_context .
293 .Fn krb5_auth_getauthenticator
294 Retrieves the authenticator that was used during mutual
297 returned should be freed by calling
298 .Fn krb5_free_authenticator .
300 .Fn krb5_auth_con_getrcache
302 .Fn krb5_auth_con_setrcache
303 gets and sets the replay-cache.
305 .Fn krb5_auth_con_initivector
306 allocates memory for and zeros the initial vector in the
310 .Fn krb5_auth_con_setivector
311 sets the i_vector portion of