1 .\" $NetBSD: gss_acquire_cred.3,v 1.3 2014/04/24 13:45:34 pettai Exp $
3 .\" Copyright (c) 2003 - 2007 Kungliga Tekniska Högskolan
4 .\" (Royal Institute of Technology, Stockholm, Sweden).
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" 3. Neither the name of the Institute nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .Dt GSS_ACQUIRE_CRED 3
40 .Nm gss_accept_sec_context ,
41 .Nm gss_acquire_cred ,
43 .Nm gss_add_oid_set_member ,
44 .Nm gss_canonicalize_name ,
45 .Nm gss_compare_name ,
46 .Nm gss_context_time ,
47 .Nm gss_create_empty_oid_set ,
48 .Nm gss_delete_sec_context ,
49 .Nm gss_display_name ,
50 .Nm gss_display_status ,
51 .Nm gss_duplicate_name ,
53 .Nm gss_export_sec_context ,
56 .Nm gss_import_sec_context ,
57 .Nm gss_indicate_mechs ,
58 .Nm gss_init_sec_context ,
59 .Nm gss_inquire_context ,
60 .Nm gss_inquire_cred ,
61 .Nm gss_inquire_cred_by_mech ,
62 .Nm gss_inquire_mechs_for_name ,
63 .Nm gss_inquire_names_for_mech ,
64 .Nm gss_krb5_ccache_name ,
65 .Nm gss_krb5_compat_des3_mic ,
66 .Nm gss_krb5_copy_ccache ,
67 .Nm gss_krb5_import_cred
68 .Nm gsskrb5_extract_authz_data_from_sec_context ,
69 .Nm gsskrb5_register_acceptor_identity ,
70 .Nm gss_krb5_import_ccache ,
71 .Nm gss_krb5_get_tkt_flags ,
72 .Nm gss_process_context_token ,
73 .Nm gss_release_buffer ,
74 .Nm gss_release_cred ,
75 .Nm gss_release_name ,
76 .Nm gss_release_oid_set ,
79 .Nm gss_test_oid_set_member ,
85 .Nm gss_wrap_size_limit
86 .Nd Generic Security Service Application Program Interface library
88 GSS-API library (libgssapi, -lgssapi)
93 .Fo gss_accept_sec_context
94 .Fa "OM_uint32 * minor_status"
95 .Fa "gss_ctx_id_t * context_handle"
96 .Fa "const gss_cred_id_t acceptor_cred_handle"
97 .Fa "const gss_buffer_t input_token_buffer"
98 .Fa "const gss_channel_bindings_t input_chan_bindings"
99 .Fa "gss_name_t * src_name"
100 .Fa "gss_OID * mech_type"
101 .Fa "gss_buffer_t output_token"
102 .Fa "OM_uint32 * ret_flags"
103 .Fa "OM_uint32 * time_rec"
104 .Fa "gss_cred_id_t * delegated_cred_handle"
109 .Fa "OM_uint32 * minor_status"
110 .Fa "const gss_name_t desired_name"
111 .Fa "OM_uint32 time_req"
112 .Fa "const gss_OID_set desired_mechs"
113 .Fa "gss_cred_usage_t cred_usage"
114 .Fa "gss_cred_id_t * output_cred_handle"
115 .Fa "gss_OID_set * actual_mechs"
116 .Fa "OM_uint32 * time_rec"
120 .Fa "OM_uint32 *minor_status"
121 .Fa "const gss_cred_id_t input_cred_handle"
122 .Fa "const gss_name_t desired_name"
123 .Fa "const gss_OID desired_mech"
124 .Fa "gss_cred_usage_t cred_usage"
125 .Fa "OM_uint32 initiator_time_req"
126 .Fa "OM_uint32 acceptor_time_req"
127 .Fa "gss_cred_id_t *output_cred_handle"
128 .Fa "gss_OID_set *actual_mechs"
129 .Fa "OM_uint32 *initiator_time_rec"
130 .Fa "OM_uint32 *acceptor_time_rec"
133 .Fo gss_add_oid_set_member
134 .Fa "OM_uint32 * minor_status"
135 .Fa "const gss_OID member_oid"
136 .Fa "gss_OID_set * oid_set"
139 .Fo gss_canonicalize_name
140 .Fa "OM_uint32 * minor_status"
141 .Fa "const gss_name_t input_name"
142 .Fa "const gss_OID mech_type"
143 .Fa "gss_name_t * output_name"
147 .Fa "OM_uint32 * minor_status"
148 .Fa "const gss_name_t name1"
149 .Fa "const gss_name_t name2"
150 .Fa "int * name_equal"
154 .Fa "OM_uint32 * minor_status"
155 .Fa "const gss_ctx_id_t context_handle"
156 .Fa "OM_uint32 * time_rec"
159 .Fo gss_create_empty_oid_set
160 .Fa "OM_uint32 * minor_status"
161 .Fa "gss_OID_set * oid_set"
164 .Fo gss_delete_sec_context
165 .Fa "OM_uint32 * minor_status"
166 .Fa "gss_ctx_id_t * context_handle"
167 .Fa "gss_buffer_t output_token"
171 .Fa "OM_uint32 * minor_status"
172 .Fa "const gss_name_t input_name"
173 .Fa "gss_buffer_t output_name_buffer"
174 .Fa "gss_OID * output_name_type"
177 .Fo gss_display_status
178 .Fa "OM_uint32 *minor_status"
179 .Fa "OM_uint32 status_value"
180 .Fa "int status_type"
181 .Fa "const gss_OID mech_type"
182 .Fa "OM_uint32 *message_context"
183 .Fa "gss_buffer_t status_string"
186 .Fo gss_duplicate_name
187 .Fa "OM_uint32 * minor_status"
188 .Fa "const gss_name_t src_name"
189 .Fa "gss_name_t * dest_name"
193 .Fa "OM_uint32 * minor_status"
194 .Fa "const gss_name_t input_name"
195 .Fa "gss_buffer_t exported_name"
198 .Fo gss_export_sec_context
199 .Fa "OM_uint32 * minor_status"
200 .Fa "gss_ctx_id_t * context_handle"
201 .Fa "gss_buffer_t interprocess_token"
205 .Fa "OM_uint32 * minor_status"
206 .Fa "const gss_ctx_id_t context_handle"
207 .Fa "gss_qop_t qop_req"
208 .Fa "const gss_buffer_t message_buffer"
209 .Fa "gss_buffer_t message_token"
213 .Fa "OM_uint32 * minor_status"
214 .Fa "const gss_buffer_t input_name_buffer"
215 .Fa "const gss_OID input_name_type"
216 .Fa "gss_name_t * output_name"
219 .Fo gss_import_sec_context
220 .Fa "OM_uint32 * minor_status"
221 .Fa "const gss_buffer_t interprocess_token"
222 .Fa "gss_ctx_id_t * context_handle"
225 .Fo gss_indicate_mechs
226 .Fa "OM_uint32 * minor_status"
227 .Fa "gss_OID_set * mech_set"
230 .Fo gss_init_sec_context
231 .Fa "OM_uint32 * minor_status"
232 .Fa "const gss_cred_id_t initiator_cred_handle"
233 .Fa "gss_ctx_id_t * context_handle"
234 .Fa "const gss_name_t target_name"
235 .Fa "const gss_OID mech_type"
236 .Fa "OM_uint32 req_flags"
237 .Fa "OM_uint32 time_req"
238 .Fa "const gss_channel_bindings_t input_chan_bindings"
239 .Fa "const gss_buffer_t input_token"
240 .Fa "gss_OID * actual_mech_type"
241 .Fa "gss_buffer_t output_token"
242 .Fa "OM_uint32 * ret_flags"
243 .Fa "OM_uint32 * time_rec"
246 .Fo gss_inquire_context
247 .Fa "OM_uint32 * minor_status"
248 .Fa "const gss_ctx_id_t context_handle"
249 .Fa "gss_name_t * src_name"
250 .Fa "gss_name_t * targ_name"
251 .Fa "OM_uint32 * lifetime_rec"
252 .Fa "gss_OID * mech_type"
253 .Fa "OM_uint32 * ctx_flags"
254 .Fa "int * locally_initiated"
255 .Fa "int * open_context"
259 .Fa "OM_uint32 * minor_status"
260 .Fa "const gss_cred_id_t cred_handle"
261 .Fa "gss_name_t * name"
262 .Fa "OM_uint32 * lifetime"
263 .Fa "gss_cred_usage_t * cred_usage"
264 .Fa "gss_OID_set * mechanisms"
267 .Fo gss_inquire_cred_by_mech
268 .Fa "OM_uint32 * minor_status"
269 .Fa "const gss_cred_id_t cred_handle"
270 .Fa "const gss_OID mech_type"
271 .Fa "gss_name_t * name"
272 .Fa "OM_uint32 * initiator_lifetime"
273 .Fa "OM_uint32 * acceptor_lifetime"
274 .Fa "gss_cred_usage_t * cred_usage"
277 .Fo gss_inquire_mechs_for_name
278 .Fa "OM_uint32 * minor_status"
279 .Fa "const gss_name_t input_name"
280 .Fa "gss_OID_set * mech_types"
283 .Fo gss_inquire_names_for_mech
284 .Fa "OM_uint32 * minor_status"
285 .Fa "const gss_OID mechanism"
286 .Fa "gss_OID_set * name_types"
289 .Fo gss_krb5_ccache_name
290 .Fa "OM_uint32 *minor"
291 .Fa "const char *name"
292 .Fa "const char **old_name"
295 .Fo gss_krb5_copy_ccache
296 .Fa "OM_uint32 *minor"
297 .Fa "gss_cred_id_t cred"
298 .Fa "krb5_ccache out"
301 .Fo gss_krb5_import_cred
302 .Fa "OM_uint32 *minor_status"
304 .Fa "krb5_principal keytab_principal"
305 .Fa "krb5_keytab keytab"
306 .Fa "gss_cred_id_t *cred"
309 .Fo gss_krb5_compat_des3_mic
310 .Fa "OM_uint32 * minor_status"
311 .Fa "gss_ctx_id_t context_handle"
315 .Fo gsskrb5_extract_authz_data_from_sec_context
316 .Fa "OM_uint32 *minor_status"
317 .Fa "gss_ctx_id_t context_handle"
319 .Fa "gss_buffer_t ad_data"
322 .Fo gsskrb5_register_acceptor_identity
323 .Fa "const char *identity"
326 .Fo gss_krb5_import_cache
327 .Fa "OM_uint32 *minor"
329 .Fa "krb5_keytab keytab"
330 .Fa "gss_cred_id_t *cred"
333 .Fo gss_krb5_get_tkt_flags
334 .Fa "OM_uint32 *minor_status"
335 .Fa "gss_ctx_id_t context_handle"
336 .Fa "OM_uint32 *tkt_flags"
339 .Fo gss_process_context_token
340 .Fa "OM_uint32 * minor_status"
341 .Fa "const gss_ctx_id_t context_handle"
342 .Fa "const gss_buffer_t token_buffer"
345 .Fo gss_release_buffer
346 .Fa "OM_uint32 * minor_status"
347 .Fa "gss_buffer_t buffer"
351 .Fa "OM_uint32 * minor_status"
352 .Fa "gss_cred_id_t * cred_handle"
356 .Fa "OM_uint32 * minor_status"
357 .Fa "gss_name_t * input_name"
360 .Fo gss_release_oid_set
361 .Fa "OM_uint32 * minor_status"
362 .Fa "gss_OID_set * set"
366 .Fa "OM_uint32 * minor_status"
367 .Fa "gss_ctx_id_t context_handle"
368 .Fa "int conf_req_flag"
370 .Fa "gss_buffer_t input_message_buffer"
371 .Fa "int * conf_state"
372 .Fa "gss_buffer_t output_message_buffer"
376 .Fa "OM_uint32 * minor_status"
377 .Fa "gss_ctx_id_t context_handle"
379 .Fa "gss_buffer_t message_buffer"
380 .Fa "gss_buffer_t message_token"
383 .Fo gss_test_oid_set_member
384 .Fa "OM_uint32 * minor_status"
385 .Fa "const gss_OID member"
386 .Fa "const gss_OID_set set"
391 .Fa "OM_uint32 * minor_status"
392 .Fa "gss_ctx_id_t context_handle"
393 .Fa "gss_buffer_t input_message_buffer"
394 .Fa "gss_buffer_t output_message_buffer"
395 .Fa "int * conf_state"
396 .Fa "int * qop_state"
400 .Fa "OM_uint32 * minor_status"
401 .Fa "const gss_ctx_id_t context_handle"
402 .Fa "const gss_buffer_t input_message_buffer"
403 .Fa "gss_buffer_t output_message_buffer"
404 .Fa "int * conf_state"
405 .Fa "gss_qop_t * qop_state"
409 .Fa "OM_uint32 * minor_status"
410 .Fa "gss_ctx_id_t context_handle"
411 .Fa "gss_buffer_t message_buffer"
412 .Fa "gss_buffer_t token_buffer"
413 .Fa "int * qop_state"
417 .Fa "OM_uint32 * minor_status"
418 .Fa "const gss_ctx_id_t context_handle"
419 .Fa "const gss_buffer_t message_buffer"
420 .Fa "const gss_buffer_t token_buffer"
421 .Fa "gss_qop_t * qop_state"
425 .Fa "OM_uint32 * minor_status"
426 .Fa "const gss_ctx_id_t context_handle"
427 .Fa "int conf_req_flag"
428 .Fa "gss_qop_t qop_req"
429 .Fa "const gss_buffer_t input_message_buffer"
430 .Fa "int * conf_state"
431 .Fa "gss_buffer_t output_message_buffer"
434 .Fo gss_wrap_size_limit
435 .Fa "OM_uint32 * minor_status"
436 .Fa "const gss_ctx_id_t context_handle"
437 .Fa "int conf_req_flag"
438 .Fa "gss_qop_t qop_req"
439 .Fa "OM_uint32 req_output_size"
440 .Fa "OM_uint32 * max_input_size"
443 Generic Security Service API (GSS-API) version 2, and its C binding,
448 Version 1 (deprecated) of the C binding is described in
451 Heimdals GSS-API implementation supports the following mechanisms
454 .Li GSS_KRB5_MECHANISM
456 .Li GSS_SPNEGO_MECHANISM
459 GSS-API have generic name types that all mechanism are supposed to
460 implement (if possible):
463 .Li GSS_C_NT_USER_NAME
465 .Li GSS_C_NT_MACHINE_UID_NAME
467 .Li GSS_C_NT_STRING_UID_NAME
469 .Li GSS_C_NT_HOSTBASED_SERVICE
471 .Li GSS_C_NT_ANONYMOUS
473 .Li GSS_C_NT_EXPORT_NAME
476 GSS-API implementations that supports Kerberos 5 have some additional
480 .Li GSS_KRB5_NT_PRINCIPAL_NAME
482 .Li GSS_KRB5_NT_USER_NAME
484 .Li GSS_KRB5_NT_MACHINE_UID_NAME
486 .Li GSS_KRB5_NT_STRING_UID_NAME
489 In GSS-API, names have two forms, internal names and contiguous string
493 .Li Internal name and mechanism name
495 Internal names are implementation specific representation of
498 special form of internal names corresponds to one and only one mechanism.
500 In GSS-API an internal name is stored in a
503 .Li Contiguous string name and exported name
505 Contiguous string names are gssapi names stored in a
507 that together with a name type identifier (OID) uniquely specifies a
509 A special form of the contiguous string name is the exported name that
510 have a OID embedded in the string to make it unique.
511 Exported name have the nametype
512 .Dv GSS_C_NT_EXPORT_NAME .
514 In GSS-API an contiguous string name is stored in a
517 Exported names also have the property that they are specified by the
518 mechanism itself and compatible between different GSS-API
522 There are two ways of comparing GSS-API names, either comparing two
523 internal names with each other or two contiguous string names with
526 To compare two internal names with each other, import (if needed) the
529 into the GSS-API implementation and the compare the imported name with
530 .Fn gss_compare_name .
532 Importing names can be slow, so when its possible to store exported
533 names in the access control list, comparing contiguous string name
536 when comparing contiguous string name, first export them into a
537 .Dv GSS_C_NT_EXPORT_NAME
540 and then compare with
543 Note that there are might be a difference between the two methods of
546 .Fn gss_compare_name )
547 will compare to (unauthenticated) names are the same.
548 The second will compare if a mechanism will authenticate them as the
555 the default syntax is used for all mechanism the GSS-API
556 implementation supports.
557 When compare the imported name of
559 it may match serveral mechanism names (MN).
561 The resulting name from
563 must not be used for acccess control.
566 takes the gss name in
568 and puts a printable form in
569 .Fa output_name_buffer .
570 .Fa output_name_buffer
571 should be freed when done using
572 .Fn gss_release_buffer .
578 and will in the latter case contain the OID type of the name.
579 The name must only be used for printing.
580 If access control is needed, see section
583 .Fn gss_inquire_context
584 returns information about the context.
585 Information is available even after the context have expired.
589 (dont expire) or the number of seconds that the context is still valid.
590 A value of 0 means that the context is expired.
592 argument should be considered readonly and must not be released.
596 are both mechanims names and must be released with
601 will return the amount of time (in seconds) of the context is still
606 .Dv GSS_S_CONTEXT_EXPIRED
614 are part of the GSS-API V1 interface and are obsolete.
615 The functions should not be used for new applications.
616 They are provided so that version 1 applications can link against the
619 .Fn gss_krb5_ccache_name
620 sets the internal kerberos 5 credential cache name to
622 The old name is returned in
624 and must not be freed.
625 The data allocated for
627 is free upon next call to
628 .Fn gss_krb5_ccache_name .
629 This function is not threadsafe if
633 .Fn gss_krb5_copy_ccache
634 will extract the krb5 credentials that are transferred from the
635 initiator to the acceptor when using token delegation in the Kerberos
637 The acceptor receives the delegated token in the last argument to
638 .Fn gss_accept_sec_context .
640 .Fn gss_krb5_import_cred
641 will import the krb5 credentials (both keytab and/or credential cache)
642 into gss credential so it can be used withing GSS-API.
645 is copied by reference and thus shared, so if the credential is destroyed
647 .Fa krb5_cc_destroy ,
651 .Fn gss_krb5_import_ccache
654 .Fn gsskrb5_register_acceptor_identity
655 sets the Kerberos 5 filebased keytab that the acceptor will use. The
659 .Fn gsskrb5_extract_authz_data_from_sec_context
660 extracts the Kerberos authorizationdata that may be stored within the
662 Tha caller must free the returned buffer
665 .Fn gss_release_buffer
668 .Fn gss_krb5_get_tkt_flags
669 return the ticket flags for the kerberos ticket receive when
670 authenticating the initiator.
671 Only valid on the acceptor context.
673 .Fn gss_krb5_compat_des3_mic
674 turns on or off the compatibility with older version of Heimdal using
675 des3 get and verify mic, this is way to programmatically set the
676 [gssapi]broken_des3_mic and [gssapi]correct_des3_mic flags (see
677 COMPATIBILITY section in
680 .Dv GSS_C_KRB5_COMPAT_DES3_MIC
682 .Fn gss_krb5_compat_des3_mic
684 .Fn gss_krb5_compat_des3_mic
685 will be removed in a later version of the GSS-API library.