This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / kerberosIV / man / krb.3
CommitLineData
8f8a9528
JH
1.\" $Source: /home/cvs/386BSD/src/kerberosIV/man/krb.3,v $
2.\" $Author: wollman $
3.\" $Header: /home/cvs/386BSD/src/kerberosIV/man/krb.3,v 1.1.1.1 1994/02/25 01:14:44 wollman Exp $
fdf53e02
GW
4.\" Copyright 1989 by the Massachusetts Institute of Technology.
5.\"
6.\" For copying and distribution information,
7.\" please see the file <mit-copyright.h>.
8.\"
9.TH KERBEROS 3 "Kerberos Version 4.0" "MIT Project Athena"
10.SH NAME
11krb_mk_req, krb_rd_req, krb_kntoln, krb_set_key, krb_get_cred,
12krb_mk_priv, krb_rd_priv, krb_mk_safe, krb_rd_safe, krb_mk_err,
13krb_rd_err, krb_ck_repl \- Kerberos authentication library
14.SH SYNOPSIS
15.nf
16.nj
17.ft B
18#include <kerberosIV/des.h>
19#include <kerberosIV/krb.h>
20.PP
21.ft B
22extern char *krb_err_txt[];
23.PP
24.ft B
25int krb_mk_req(authent,service,instance,realm,checksum)
26KTEXT authent;
27char *service;
28char *instance;
29char *realm;
30u_long checksum;
31.PP
32.ft B
33int krb_rd_req(authent,service,instance,from_addr,ad,fn)
34KTEXT authent;
35char *service;
36char *instance;
37u_long from_addr;
38AUTH_DAT *ad;
39char *fn;
40.PP
41.ft B
42int krb_kntoln(ad,lname)
43AUTH_DAT *ad;
44char *lname;
45.PP
46.ft B
47int krb_set_key(key,cvt)
48char *key;
49int cvt;
50.PP
51.ft B
52int krb_get_cred(service,instance,realm,c)
53char *service;
54char *instance;
55char *realm;
56CREDENTIALS *c;
57.PP
58.ft B
59long krb_mk_priv(in,out,in_length,schedule,key,sender,receiver)
60u_char *in;
61u_char *out;
62u_long in_length;
63des_cblock key;
64des_key_schedule schedule;
65struct sockaddr_in *sender;
66struct sockaddr_in *receiver;
67.PP
68.ft B
69long krb_rd_priv(in,in_length,schedule,key,sender,receiver,msg_data)
70u_char *in;
71u_long in_length;
72Key_schedule schedule;
73des_cblock key;
74struct sockaddr_in *sender;
75struct sockaddr_in *receiver;
76MSG_DAT *msg_data;
77.PP
78.ft B
79long krb_mk_safe(in,out,in_length,key,sender,receiver)
80u_char *in;
81u_char *out;
82u_long in_length;
83des_cblock key;
84struct sockaddr_in *sender;
85struct sockaddr_in *receiver;
86.PP
87.ft B
88long krb_rd_safe(in,length,key,sender,receiver,msg_data)
89u_char *in;
90u_long length;
91des_cblock key;
92struct sockaddr_in *sender;
93struct sockaddr_in *receiver;
94MSG_DAT *msg_data;
95.PP
96.ft B
97long krb_mk_err(out,code,string)
98u_char *out;
99long code;
100char *string;
101.PP
102.ft B
103long krb_rd_err(in,length,code,msg_data)
104u_char *in;
105u_long length;
106long code;
107MSG_DAT *msg_data;
108.fi
109.ft R
110.SH DESCRIPTION
111This library supports network authentication and various related
112operations. The library contains many routines beyond those described
113in this man page, but they are not intended to be used directly.
114Instead, they are called by the routines that are described, the
115authentication server and the login program.
116.PP
117.I krb_err_txt[]
118contains text string descriptions of various Kerberos error codes returned
119by some of the routines below.
120.PP
121.I krb_mk_req
122takes a pointer to a text structure in which an authenticator is to be
123built. It also takes the name, instance, and realm of the service to be
124used and an optional checksum. It is up to the application to decide
125how to generate the checksum.
126.I krb_mk_req
127then retrieves a ticket for the desired service and creates an
128authenticator. The authenticator is built in
129.I authent
130and is accessible
131to the calling procedure.
132.PP
133It is up to the application to get the authenticator to the service
134where it will be read by
135.I krb_rd_req.
8f8a9528 136Unless an attacker possesses the session key contained in the ticket, it
fdf53e02
GW
137will be unable to modify the authenticator. Thus, the checksum can be
138used to verify the authenticity of the other data that will pass through
139a connection.
140.PP
141.I krb_rd_req
142takes an authenticator of type
143.B KTEXT,
144a service name, an instance, the address of the
145host originating the request, and a pointer to a structure of type
146.B AUTH_DAT
147which is filled in with information obtained from the authenticator.
148It also optionally takes the name of the file in which it will find the
149secret key(s) for the service.
150If the supplied
151.I instance
152contains "*", then the first service key with the same service name
153found in the service key file will be used, and the
154.I instance
155argument will be filled in with the chosen instance. This means that
156the caller must provide space for such an instance name.
157.PP
158It is used to find out information about the principal when a request
159has been made to a service. It is up to the application protocol to get
160the authenticator from the client to the service. The authenticator is
161then passed to
162.I krb_rd_req
163to extract the desired information.
164.PP
165.I krb_rd_req
166returns zero (RD_AP_OK) upon successful authentication. If a packet was
167forged, modified, or replayed, authentication will fail. If the
168authentication fails, a non-zero value is returned indicating the
169particular problem encountered. See
170.I krb.h
171for the list of error codes.
172.PP
173If the last argument is the null string (""), krb_rd_req will use the
174file /etc/srvtab to find its keys. If the last argument is NULL, it
175will assume that the key has been set by
176.I krb_set_key
177and will not bother looking further.
178.PP
179.I krb_kntoln
180converts a Kerberos name to a local name. It takes a structure
181of type AUTH_DAT and uses the name and instance to look in the database
182/etc/aname to find the corresponding local name. The local name is
183returned and can be used by an application to change uids, directories,
184or other parameters. It is not an integral part of Kerberos, but is
185instead provided to support the use of Kerberos in existing utilities.
186.PP
187.I krb_set_key
188takes as an argument a des key. It then creates
189a key schedule from it and saves the original key to be used as an
190initialization vector.
191It is used to set the server's key which
192must be used to decrypt tickets.
193.PP
194If called with a non-zero second argument,
195.I krb_set_key
196will first convert the input from a string of arbitrary length to a DES
197key by encrypting it with a one-way function.
198.PP
199In most cases it should not be necessary to call
200.I krb_set_key.
201The necessary keys will usually be obtained and set inside
202.I krb_rd_req. krb_set_key
203is provided for those applications that do not wish to place the
204application keys on disk.
205.PP
206.I krb_get_cred
207searches the caller's ticket file for a ticket for the given service, instance,
208and realm; and, if a ticket is found, fills in the given CREDENTIALS structure
209with the ticket information.
210.PP
211If the ticket was found,
212.I krb_get_cred
213returns GC_OK.
214If the ticket file can't be found, can't be read, doesn't belong to
215the user (other than root), isn't a regular file, or is in the wrong
216mode, the error GC_TKFIL is returned.
217.PP
218.I krb_mk_priv
219creates an encrypted, authenticated
220message from any arbitrary application data, pointed to by
221.I in
222and
223.I in_length
224bytes long.
225The private session key, pointed to by
226.I key
227and the key schedule,
228.I schedule,
229are used to encrypt the data and some header information using
230.I pcbc_encrypt.
231.I sender
232and
233.I receiver
234point to the Internet address of the two parties.
235In addition to providing privacy, this protocol message protects
236against modifications, insertions or replays. The encapsulated message and
237header are placed in the area pointed to by
238.I out
239and the routine returns the length of the output, or -1 indicating
240an error.
241.PP
242.I krb_rd_priv
243decrypts and authenticates a received
244.I krb_mk_priv
245message.
246.I in
247points to the beginning of the received message, whose length
248is specified in
249.I in_length.
250The private session key, pointed to by
251.I key,
252and the key schedule,
253.I schedule,
254are used to decrypt and verify the received message.
255.I msg_data
256is a pointer to a
257.I MSG_DAT
258struct, defined in
259.I krb.h.
260The routine fills in the
261.I app_data
262field with a pointer to the decrypted application data,
263.I app_length
264with the length of the
265.I app_data
266field,
267.I time_sec
268and
269.I time_5ms
270with the timestamps in the message, and
271.I swap
272with a 1 if the byte order of the receiver is different than that of
273the sender. (The application must still determine if it is appropriate
274to byte-swap application data; the Kerberos protocol fields are already taken
275care of). The
276.I hash
277field returns a value useful as input to the
278.I krb_ck_repl
279routine.
280
281The routine returns zero if ok, or a Kerberos error code. Modified messages
282and old messages cause errors, but it is up to the caller to
283check the time sequence of messages, and to check against recently replayed
284messages using
285.I krb_ck_repl
286if so desired.
287.PP
288.I krb_mk_safe
289creates an authenticated, but unencrypted message from any arbitrary
290application data,
291pointed to by
292.I in
293and
294.I in_length
295bytes long.
296The private session key, pointed to by
297.I key,
298is used to seed the
299.I quad_cksum()
300checksum algorithm used as part of the authentication.
301.I sender
302and
303.I receiver
304point to the Internet address of the two parties.
305This message does not provide privacy, but does protect (via detection)
306against modifications, insertions or replays. The encapsulated message and
307header are placed in the area pointed to by
308.I out
309and the routine returns the length of the output, or -1 indicating
310an error.
311The authentication provided by this routine is not as strong as that
312provided by
313.I krb_mk_priv
314or by computing the checksum using
315.I cbc_cksum
316instead, both of which authenticate via DES.
317.PP
318
319.I krb_rd_safe
320authenticates a received
321.I krb_mk_safe
322message.
323.I in
324points to the beginning of the received message, whose length
325is specified in
326.I in_length.
327The private session key, pointed to by
328.I key,
329is used to seed the quad_cksum() routine as part of the authentication.
330.I msg_data
331is a pointer to a
332.I MSG_DAT
333struct, defined in
334.I krb.h .
335The routine fills in these
336.I MSG_DAT
337fields:
338the
339.I app_data
340field with a pointer to the application data,
341.I app_length
342with the length of the
343.I app_data
344field,
345.I time_sec
346and
347.I time_5ms
348with the timestamps in the message, and
349.I swap
350with a 1 if the byte order of the receiver is different than that of
351the sender.
352(The application must still determine if it is appropriate
353to byte-swap application data; the Kerberos protocol fields are already taken
354care of). The
355.I hash
356field returns a value useful as input to the
357.I krb_ck_repl
358routine.
359
360The routine returns zero if ok, or a Kerberos error code. Modified messages
361and old messages cause errors, but it is up to the caller to
362check the time sequence of messages, and to check against recently replayed
363messages using
364.I krb_ck_repl
365if so desired.
366.PP
367.I krb_mk_err
368constructs an application level error message that may be used along
369with
370.I krb_mk_priv
371or
372.I krb_mk_safe.
373.I out
374is a pointer to the output buffer,
375.I code
376is an application specific error code, and
377.I string
378is an application specific error string.
379
380.PP
381.I krb_rd_err
382unpacks a received
383.I krb_mk_err
384message.
385.I in
386points to the beginning of the received message, whose length
387is specified in
388.I in_length.
389.I code
390is a pointer to a value to be filled in with the error
391value provided by the application.
392.I msg_data
393is a pointer to a
394.I MSG_DAT
395struct, defined in
396.I krb.h .
397The routine fills in these
398.I MSG_DAT
399fields: the
400.I app_data
401field with a pointer to the application error text,
402.I app_length
403with the length of the
404.I app_data
405field, and
406.I swap
407with a 1 if the byte order of the receiver is different than that of
408the sender. (The application must still determine if it is appropriate
409to byte-swap application data; the Kerberos protocol fields are already taken
410care of).
411
412The routine returns zero if the error message has been successfully received,
413or a Kerberos error code.
414.PP
415The
416.I KTEXT
417structure is used to pass around text of varying lengths. It consists
418of a buffer for the data, and a length. krb_rd_req takes an argument of this
419type containing the authenticator, and krb_mk_req returns the
420authenticator in a structure of this type. KTEXT itself is really a
421pointer to the structure. The actual structure is of type KTEXT_ST.
422.PP
423The
424.I AUTH_DAT
425structure is filled in by krb_rd_req. It must be allocated before
426calling krb_rd_req, and a pointer to it is passed. The structure is
427filled in with data obtained from Kerberos.
428.I MSG_DAT
429structure is filled in by either krb_rd_priv, krb_rd_safe, or
430krb_rd_err. It must be allocated before the call and a pointer to it
431is passed. The structure is
432filled in with data obtained from Kerberos.
433.PP
434.SH FILES
435/usr/include/kerberosIV/krb.h
436.br
437/usr/lib/libkrb.a
438.br
439/usr/include/kerberosIV/des.h
440.br
441/usr/lib/libdes.a
442.br
443/etc/kerberosIV/aname
444.br
445/etc/kerberosIV/srvtab
446.br
447/tmp/tkt[uid]
448.SH "SEE ALSO"
449kerberos(1), des_crypt(3)
450.SH DIAGNOSTICS
451.SH BUGS
452The caller of
453.I krb_rd_req, krb_rd_priv, and krb_rd_safe
454must check time order and for replay attempts.
455.I krb_ck_repl
456is not implemented yet.
457.SH AUTHORS
458Clifford Neuman, MIT Project Athena
459.br
460Steve Miller, MIT Project Athena/Digital Equipment Corporation
461.SH RESTRICTIONS
462COPYRIGHT 1985,1986,1989 Massachusetts Institute of Technology