1 .\" Copyright (c) 2001 Kungliga Tekniska Högskolan
2 .\" $Id: krb5_keytab.3,v 1.5 2002/08/28 15:30:54 joda Exp $
8 .Nm krb5_keytab_entry ,
10 .Nm krb5_kt_add_entry ,
13 .Nm krb5_kt_copy_entry_contents ,
15 .Nm krb5_kt_default_name ,
16 .Nm krb5_kt_end_seq_get ,
17 .Nm krb5_kt_free_entry ,
18 .Nm krb5_kt_get_entry ,
19 .Nm krb5_kt_get_name ,
20 .Nm krb5_kt_next_entry ,
21 .Nm krb5_kt_read_service_key ,
22 .Nm krb5_kt_register ,
23 .Nm krb5_kt_remove_entry ,
25 .Nm krb5_kt_start_seq_get
26 .Nd manage keytab (key storage) files
28 Kerberos 5 Library (libkrb5, -lkrb5)
34 .Fa "krb5_context context"
36 .Fa "krb5_keytab_entry *entry"
40 .Fa "krb5_context context"
45 .Fa "krb5_context context"
46 .Fa "krb5_keytab_entry *entry"
47 .Fa "krb5_const_principal principal"
49 .Fa "krb5_enctype enctype"
52 .Fo krb5_kt_copy_entry_contents
53 .Fa "krb5_context context"
54 .Fa "const krb5_keytab_entry *in"
55 .Fa "krb5_keytab_entry *out"
59 .Fa "krb5_context context"
63 .Fo krb5_kt_default_name
64 .Fa "krb5_context context"
69 .Fo krb5_kt_end_seq_get
70 .Fa "krb5_context context"
72 .Fa "krb5_kt_cursor *cursor"
75 .Fo krb5_kt_free_entry
76 .Fa "krb5_context context"
77 .Fa "krb5_keytab_entry *entry"
81 .Fa "krb5_context context"
83 .Fa "krb5_const_principal principal"
85 .Fa "krb5_enctype enctype"
86 .Fa "krb5_keytab_entry *entry"
90 .Fa "krb5_context context"
91 .Fa "krb5_keytab keytab"
96 .Fo krb5_kt_next_entry
97 .Fa "krb5_context context"
99 .Fa "krb5_keytab_entry *entry"
100 .Fa "krb5_kt_cursor *cursor"
103 .Fo krb5_kt_read_service_key
104 .Fa "krb5_context context"
105 .Fa "krb5_pointer keyprocarg"
106 .Fa "krb5_principal principal"
108 .Fa "krb5_enctype enctype"
109 .Fa "krb5_keyblock **key"
113 .Fa "krb5_context context"
114 .Fa "const krb5_kt_ops *ops"
117 .Fo krb5_kt_remove_entry
118 .Fa "krb5_context context"
120 .Fa "krb5_keytab_entry *entry"
124 .Fa "krb5_context context"
125 .Fa "const char *name"
126 .Fa "krb5_keytab *id"
129 .Fo krb5_kt_start_seq_get
130 .Fa "krb5_context context"
132 .Fa "krb5_kt_cursor *cursor"
135 A keytab name is on the form
139 part is specific to each keytab-type.
141 When a keytab-name is resolved, the type is matched with an interal
142 list of keytab types. If there is no matching keytab type,
143 the default keytab is used. The current default type is
145 The default value can be changed in the configuration file
147 by setting the variable
148 .Li [defaults]default_keytab_name .
150 The keytab types that are implemented in Heimdal
154 store the keytab in a file, the type's name is
156 The residual part is a filename.
158 store the keytab in a
161 .Pa /usr/afs/etc/KeyFile ) ,
164 The residual part is a filename.
166 the keytab is a Kerberos 4
168 that is on-the-fly converted to a keytab. The type's name is
170 The residual part is a filename.
172 The keytab is stored in a memory segment. This allows sensitive and/or
173 temporary data not to be stored on disk. The type's name is
175 There are no residual part, the only pointer back to the keytab is the
178 .Fn krb5_kt_resolve .
181 .Nm krb5_keytab_entry
182 holds all data for an entry in a keytab file, like principal name,
183 key-type, key, key-version number, etc.
185 holds the current position that is used when iterating through a
187 .Fn krb5_kt_start_seq_get ,
188 .Fn krb5_kt_next_entry ,
190 .Fn krb5_kt_end_seq_get .
193 contains the different operations that can be done to a keytab. This
194 structure is normally only used when doing a new keytab-type
198 is the equvalent of an
200 on keytab. Resolve the keytab name in
204 Returns 0 or an error. The opposite of
209 frees all resources allocated to the keytab.
214 to the default keytab.
215 Returns 0 or an error.
217 .Fn krb5_kt_default_name
218 copy the name of the default keytab into
220 Return 0 or KRB5_CONFIG_NOTENUFSPACE if
224 .Fn krb5_kt_add_entry
230 is returned if the keytab is a readonly keytab.
233 compares the passed in
245 might be 0 which acts as a wildcard. Return TRUE if they compare the
246 same, FALSE otherwise.
248 .Fn krb5_kt_copy_entry_contents
249 copies the contents of
253 Returns 0 or an error.
256 retrieves the name of the keytab
261 Returns 0 or an error.
263 .Fn krb5_kt_free_entry
264 frees the contents of
267 .Fn krb5_kt_start_seq_get
270 to point at the beginning of
272 Returns 0 or an error.
274 .Fn krb5_kt_next_entry
275 gets the next entry from
281 Returns 0 or an error.
283 .Fn krb5_kt_end_seq_get
284 releases all resources associated with
287 .Fn krb5_kt_get_entry
288 retrieves the keytab entry for
296 Returns 0 or an error.
298 .Fn krb5_kt_read_service_key
299 reads the key identified by
305 (the default if == NULL) into
307 Returns 0 or an error.
309 .Fn krb5_kt_remove_entry
314 Returns 0 or an error.
317 registers a new keytab type
319 Returns 0 or an error.
321 This is a minimalistic version of
326 main (int argc, char **argv)
328 krb5_context context;
330 krb5_kt_cursor cursor;
331 krb5_keytab_entry entry;
335 if (krb5_init_context (&context) != 0)
336 errx(1, "krb5_context");
338 ret = krb5_kt_default (context, &keytab);
340 krb5_err(context, 1, ret, "krb5_kt_default");
342 ret = krb5_kt_start_seq_get(context, keytab, &cursor);
344 krb5_err(context, 1, ret, "krb5_kt_start_seq_get");
345 while((ret = krb5_kt_next_entry(context, keytab, &entry, &cursor)) == 0){
346 krb5_unparse_name_short(context, entry.principal, &principal);
347 printf("principal: %s\\n", principal);
349 krb5_kt_free_entry(context, &entry);
351 ret = krb5_kt_end_seq_get(context, keytab, &cursor);
353 krb5_err(context, 1, ret, "krb5_kt_end_seq_get");
354 krb5_free_context(context);