GSS_ACQUIRE_CRED(3)
π GSS_ACQUIRE_CRED(3) π
okay bestie, so this page lives in the Library Functions Manual, and yes it's filed under GSS_ACQUIRE_CRED(3) but it's actually the whole β¨Generic Security Service Application Program Interface libraryβ¨ β like, the entire GSS-API family hangs out here together. One giant friend group page. Not me being obsessed with a C header π
πΈ NAME πΈ
So the icons on this page are, like, a LOT of them. Every single one of these functions shows up here, no cap:
gss_accept_sec_contextgss_acquire_credgss_add_credgss_add_oid_set_membergss_canonicalize_namegss_compare_namegss_context_timegss_create_empty_oid_setgss_delete_sec_contextgss_display_namegss_display_statusgss_duplicate_namegss_export_namegss_export_sec_contextgss_get_micgss_import_namegss_import_sec_contextgss_indicate_mechsgss_init_sec_contextgss_inquire_contextgss_inquire_credgss_inquire_cred_by_mechgss_inquire_mechs_for_namegss_inquire_names_for_mechgss_krb5_ccache_namegss_krb5_compat_des3_micgss_krb5_copy_ccachegss_krb5_import_credgsskrb5_extract_authz_data_from_sec_contextgsskrb5_register_acceptor_identitygss_krb5_import_ccachegss_krb5_get_tkt_flagsgss_process_context_tokengss_release_buffergss_release_credgss_release_namegss_release_oid_setgss_sealgss_signgss_test_oid_set_membergss_unsealgss_unwrapgss_verifygss_verify_micgss_wrapgss_wrap_size_limit
and together they're serving the Generic Security Service Application Program Interface library. it's giving "one big happy security API family". π
π LIBRARY π
- GSS-API library β and the way you link it is
libgssapi, with the flag-lgssapi. literally just plug it in, she's ready π«Ά
β¨ SYNOPSIS β¨
first things first, you gotta invite her in:
#include <gssapi.h>
and then, bestie... the cast list. every single signature, exactly as she is, no edits, no notes:
OM_uint32
gss_accept_sec_context(OM_uint32 * minor_status,
gss_ctx_id_t * context_handle,
gss_const_cred_id_t acceptor_cred_handle,
const gss_buffer_t input_token_buffer,
const gss_channel_bindings_t input_chan_bindings,
gss_name_t * src_name, gss_OID * mech_type,
gss_buffer_t output_token, OM_uint32 * ret_flags,
OM_uint32 * time_rec, gss_cred_id_t * delegated_cred_handle);
OM_uint32
gss_acquire_cred(OM_uint32 * minor_status,
gss_const_name_t desired_name, OM_uint32 time_req,
const gss_OID_set desired_mechs, gss_cred_usage_t cred_usage,
gss_cred_id_t * output_cred_handle, gss_OID_set * actual_mechs,
OM_uint32 * time_rec);
OM_uint32
gss_add_cred(OM_uint32 *minor_status,
gss_const_cred_id_t input_cred_handle,
gss_const_name_t desired_name, const gss_OID desired_mech,
gss_cred_usage_t cred_usage, OM_uint32 initiator_time_req,
OM_uint32 acceptor_time_req, gss_cred_id_t *output_cred_handle,
gss_OID_set *actual_mechs, OM_uint32 *initiator_time_rec,
OM_uint32 *acceptor_time_rec);
OM_uint32
gss_add_oid_set_member(OM_uint32 * minor_status,
const gss_OID member_oid, gss_OID_set * oid_set);
OM_uint32
gss_canonicalize_name(OM_uint32 * minor_status,
gss_const_name_t input_name, const gss_OID mech_type,
gss_name_t * output_name);
OM_uint32
gss_compare_name(OM_uint32 * minor_status, gss_const_name_t name1,
gss_const_name_t name2, int * name_equal);
OM_uint32
gss_context_time(OM_uint32 * minor_status,
gss_const_ctx_id_t context_handle, OM_uint32 * time_rec);
OM_uint32
gss_create_empty_oid_set(OM_uint32 * minor_status,
gss_OID_set * oid_set);
OM_uint32
gss_delete_sec_context(OM_uint32 * minor_status,
gss_ctx_id_t * context_handle, gss_buffer_t output_token);
OM_uint32
gss_display_name(OM_uint32 * minor_status, gss_const_name_t input_name,
gss_buffer_t output_name_buffer, gss_OID * output_name_type);
OM_uint32
gss_display_status(OM_uint32 *minor_status, OM_uint32 status_value,
int status_type, const gss_OID mech_type,
OM_uint32 *message_context, gss_buffer_t status_string);
OM_uint32
gss_duplicate_name(OM_uint32 * minor_status, gss_const_name_t src_name,
gss_name_t * dest_name);
OM_uint32
gss_export_name(OM_uint32 * minor_status, gss_const_name_t input_name,
gss_buffer_t exported_name);
OM_uint32
gss_export_sec_context(OM_uint32 * minor_status,
gss_ctx_id_t * context_handle, gss_buffer_t interprocess_token);
OM_uint32
gss_get_mic(OM_uint32 * minor_status, gss_const_ctx_id_t context_handle,
gss_qop_t qop_req, const gss_buffer_t message_buffer,
gss_buffer_t message_token);
OM_uint32
gss_import_name(OM_uint32 * minor_status,
const gss_buffer_t input_name_buffer, const gss_OID input_name_type,
gss_name_t * output_name);
OM_uint32
gss_import_sec_context(OM_uint32 * minor_status,
const gss_buffer_t interprocess_token,
gss_ctx_id_t * context_handle);
OM_uint32
gss_indicate_mechs(OM_uint32 * minor_status, gss_OID_set * mech_set);
OM_uint32
gss_init_sec_context(OM_uint32 * minor_status,
gss_const_cred_id_t initiator_cred_handle,
gss_ctx_id_t * context_handle, gss_const_name_t target_name,
const gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req,
const gss_channel_bindings_t input_chan_bindings,
const gss_buffer_t input_token, gss_OID * actual_mech_type,
gss_buffer_t output_token, OM_uint32 * ret_flags,
OM_uint32 * time_rec);
OM_uint32
gss_inquire_context(OM_uint32 * minor_status,
gss_const_ctx_id_t context_handle, gss_name_t * src_name,
gss_name_t * targ_name, OM_uint32 * lifetime_rec,
gss_OID * mech_type, OM_uint32 * ctx_flags, int * locally_initiated,
int * open_context);
OM_uint32
gss_inquire_cred(OM_uint32 * minor_status,
gss_const_cred_id_t cred_handle, gss_name_t * name,
OM_uint32 * lifetime, gss_cred_usage_t * cred_usage,
gss_OID_set * mechanisms);
OM_uint32
gss_inquire_cred_by_mech(OM_uint32 * minor_status,
gss_const_cred_id_t cred_handle, const gss_OID mech_type,
gss_name_t * name, OM_uint32 * initiator_lifetime,
OM_uint32 * acceptor_lifetime, gss_cred_usage_t * cred_usage);
OM_uint32
gss_inquire_mechs_for_name(OM_uint32 * minor_status,
gss_const_name_t input_name, gss_OID_set * mech_types);
OM_uint32
gss_inquire_names_for_mech(OM_uint32 * minor_status,
const gss_OID mechanism, gss_OID_set * name_types);
OM_uint32
gss_krb5_ccache_name(OM_uint32 *minor, const char *name,
const char **old_name);
OM_uint32
gss_krb5_copy_ccache(OM_uint32 *minor, gss_cred_id_t cred,
krb5_ccache out);
OM_uint32
gss_krb5_import_cred(OM_uint32 *minor_status, krb5_ccache id,
krb5_principal keytab_principal, krb5_keytab keytab,
gss_cred_id_t *cred);
OM_uint32
gss_krb5_compat_des3_mic(OM_uint32 * minor_status,
gss_ctx_id_t context_handle, int onoff);
OM_uint32
gsskrb5_extract_authz_data_from_sec_context(OM_uint32 *minor_status,
gss_ctx_id_t context_handle, int ad_type, gss_buffer_t ad_data);
OM_uint32
gsskrb5_register_acceptor_identity(const char *identity);
OM_uint32
gss_krb5_import_cache(OM_uint32 *minor, krb5_ccache id,
krb5_keytab keytab, gss_cred_id_t *cred);
OM_uint32
gss_krb5_get_tkt_flags(OM_uint32 *minor_status,
gss_ctx_id_t context_handle, OM_uint32 *tkt_flags);
OM_uint32
gss_process_context_token(OM_uint32 * minor_status,
gss_const_ctx_id_t context_handle, const gss_buffer_t token_buffer);
OM_uint32
gss_release_buffer(OM_uint32 * minor_status, gss_buffer_t buffer);
OM_uint32
gss_release_cred(OM_uint32 * minor_status, gss_cred_id_t * cred_handle);
OM_uint32
gss_release_name(OM_uint32 * minor_status, gss_name_t * input_name);
OM_uint32
gss_release_oid_set(OM_uint32 * minor_status, gss_OID_set * set);
OM_uint32
gss_seal(OM_uint32 * minor_status, gss_ctx_id_t context_handle,
int conf_req_flag, int qop_req, gss_buffer_t input_message_buffer,
int * conf_state, gss_buffer_t output_message_buffer);
OM_uint32
gss_sign(OM_uint32 * minor_status, gss_ctx_id_t context_handle,
int qop_req, gss_buffer_t message_buffer,
gss_buffer_t message_token);
OM_uint32
gss_test_oid_set_member(OM_uint32 * minor_status, const gss_OID member,
const gss_OID_set set, int * present);
OM_uint32
gss_unseal(OM_uint32 * minor_status, gss_ctx_id_t context_handle,
gss_buffer_t input_message_buffer,
gss_buffer_t output_message_buffer, int * conf_state,
int * qop_state);
OM_uint32
gss_unwrap(OM_uint32 * minor_status, gss_const_ctx_id_t context_handle,
const gss_buffer_t input_message_buffer,
gss_buffer_t output_message_buffer, int * conf_state,
gss_qop_t * qop_state);
OM_uint32
gss_verify(OM_uint32 * minor_status, gss_ctx_id_t context_handle,
gss_buffer_t message_buffer, gss_buffer_t token_buffer,
int * qop_state);
OM_uint32
gss_verify_mic(OM_uint32 * minor_status,
gss_const_ctx_id_t context_handle,
const gss_buffer_t message_buffer, const gss_buffer_t token_buffer,
gss_qop_t * qop_state);
OM_uint32
gss_wrap(OM_uint32 * minor_status, gss_const_ctx_id_t context_handle,
int conf_req_flag, gss_qop_t qop_req,
const gss_buffer_t input_message_buffer, int * conf_state,
gss_buffer_t output_message_buffer);
OM_uint32
gss_wrap_size_limit(OM_uint32 * minor_status,
gss_const_ctx_id_t context_handle, int conf_req_flag,
gss_qop_t qop_req, OM_uint32 req_output_size,
OM_uint32 * max_input_size);
not me counting forty-six whole functions and still needing more page π bestie we are SO not done yet. this is only part one. there's more coming, don't go anywhere π
β¨ DESCRIPTION β¨
okay so bestie, gather round π the Generic Security Service API (GSS-API) version 2, plus its C binding, is all written down in RFC2743 and RFC2744. and version 1 of the C binding (which is deprecated, so likeβ¦ do not) lives in RFC1509.
Heimdal's GSS-API implementation ships with these mechanisms:
GSS_KRB5_MECHANISMGSS_SPNEGO_MECHANISM
and GSS-API has these generic name types that every mechanism is supposed to implement (if possible, no pressure):
GSS_C_NT_USER_NAMEGSS_C_NT_MACHINE_UID_NAMEGSS_C_NT_STRING_UID_NAMEGSS_C_NT_HOSTBASED_SERVICEGSS_C_NT_ANONYMOUSGSS_C_NT_EXPORT_NAME
meanwhile, GSS-API implementations that support Kerberos 5 get some extra name types on top, because of course they do π :
GSS_KRB5_NT_PRINCIPAL_NAMEGSS_KRB5_NT_USER_NAMEGSS_KRB5_NT_MACHINE_UID_NAMEGSS_KRB5_NT_STRING_UID_NAME
now, in GSS-API, names come in two forms, and this is the part you actually need to know: internal names and contiguous string names.
Internal name and mechanism name
Internal names are the implementation-specific representation of a GSS-API name. Mechanism names are a special form of internal names that correspond to one and only one mechanism.
in GSS-API, an internal name is stored in a gss_name_t.
Contiguous string name and exported name
Contiguous string names are gssapi names stored in a OCTET STRING that, together with a name type identifier (OID), uniquely specifies a gss-name. a special form of the contiguous string name is the exported name, which has an OID embedded right in the string to make it unique. exported names have the nametype GSS_C_NT_EXPORT_NAME.
in GSS-API, a contiguous string name is stored in a gss_buffer_t.
exported names also have the property that they're specified by the mechanism itself and are compatible between different GSS-API implementations β which is lowkey iconic of them π¦.
π ACCESS CONTROL π
there are two ways of comparing GSS-API names, bestie: either compare two internal names with each other, or compare two contiguous string names with each other. pick your fighter.
route one: to compare two internal names with each other, import (if needed) the names with gss_import_name() into the GSS-API implementation, then compare the imported name with gss_compare_name().
route two: importing names can be slow, so when it's possible to store exported names in the access control list, comparing contiguous string name might be better. when comparing contiguous string name, first export them into a GSS_C_NT_EXPORT_NAME name with gss_export_name(), and then compare with memcmp(3).
β οΈ note that there might be a difference between the two methods of comparing names. the first (using gss_compare_name()) will compare to (unauthenticated) names are the same. the second will compare if a mechanism will authenticate them as the same principal. not the same thing, bestie!!
for example, if gss_import_name() name was used with GSS_C_NO_OID, the default syntax is used for all mechanism the GSS-API implementation supports. when you compare the imported name of GSS_C_NO_OID it may match several mechanism names (MN).
π¨ and the resulting name from gss_display_name() must not be used for acccess control. periodt. do not do it.
π οΈ FUNCTIONS π οΈ
gss_display_name()β takes the gss name ininput_nameand puts a printable form inoutput_name_buffer.output_name_buffershould be freed when done usinggss_release_buffer().output_name_typecan either beNULLor a pointer to agss_OID, and in the latter case it'll contain the OID type of the name. the name must only be used for printing π. if access control is needed, go see the "ACCESS CONTROL" section above.gss_inquire_context()β returns information about the context. info is available even after the context has expired, fun fact. thelifetime_recargument is set toGSS_C_INDEFINITE(don't expire) or the number of seconds that the context is still valid. a value of0means that the context is expired. themech_typeargument should be considered readonly and must not be released.src_nameanddest_name()are both mechanims names and must be released withgss_release_name()when no longer used.gss_context_timeβ will return the amount of time (in seconds) the context is still valid. if it's expired,time_recwill be set to0andGSS_S_CONTEXT_EXPIREDreturned.gss_sign(),gss_verify(),gss_seal(), andgss_unseal()β these are part of the GSS-API V1 interface and are obsolete π. they should not be used for new applications. they're only provided so that version 1 applications can link against the library.
π« EXTENSIONS π«
gss_krb5_ccache_name()β sets the internal kerberos 5 credential cache name toname. the old name is returned inold_name, and must not be freed. the data allocated forold_nameis free upon the next call togss_krb5_ccache_name(). heads up: this function is not threadsafe if theold_nameargument is used π.gss_krb5_copy_ccache()β will extract the krb5 credentials that are transferred from the initiator to the acceptor when using token delegation in the Kerberos mechanism. the acceptor receives the delegated token in the last argument togss_accept_sec_context().gss_krb5_import_cred()β will import the krb5 credentials (both keytab and/or credential cache) into gss credential so it can be used within GSS-API. the ccache is copied by reference and thus shared, so if the credential is destroyed withkrb5_cc_destroy, all users of thegss_cred_id_treturned bygss_krb5_import_ccache()will fail. shared means shared, bestie π«Ά.gsskrb5_register_acceptor_identity()β sets the Kerberos 5 filebased keytab that the acceptor will use. the identifier is the file name.gsskrb5_extract_authz_data_from_sec_context()β extracts the Kerberos authorizationdata that may be stored within the context. the caller must free the returned bufferad_datawithgss_release_buffer()upon success.gss_krb5_get_tkt_flags()β returns the ticket flags for the kerberos ticket receive when authenticating the initiator. only valid on the acceptor context.gss_krb5_compat_des3_mic()β turns on or off the compatibility with older versions of Heimdal using des3 get and verify mic. this is a way to programmatically set the[gssapi]broken_des3_micand[gssapi]correct_des3_micflags (see COMPATIBILITY section ingssapi(3)). if the CPP symbolGSS_C_KRB5_COMPAT_DES3_MICis present,gss_krb5_compat_des3_mic()exists. note:gss_krb5_compat_des3_mic()will be removed in a later version of the GSS-API library, so don't get too attached π.
π SEE ALSO π
gssapi(3), krb5(3), krb5_ccache(3), kerberos(8)
and that's the whole thing, bestie, you ate that π this was the HEIMDAL GSS_ACQUIRE_CRED(3) page, dated October 26, 2005 β yes, it's an elder, but it's still serving π
go forth and authenticate responsibly, mwah π
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- debian bookworm: heimdal-dev 7.8.git20221117.28daf24+dfsg-2 Β· BSD-3-Clause
- debian trixie: heimdal-dev 7.8.git20221117.28daf24+dfsg-9+deb13u1 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- ubuntu jammy: heimdal-dev 7.7.0+dfsg-3ubuntu1 Β· BSD-3-Clause
- ubuntu noble: heimdal-dev 7.8.git20221117.28daf24+dfsg-5ubuntu3 Β· BSD-3-Clause
- ubuntu questing: heimdal-dev 7.8.git20221117.28daf24+dfsg-9ubuntu1
- ubuntu resolute: heimdal-dev 7.8.git20221117.28daf24+dfsg-11ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: heimdal-dev 7.8.git20240113.1b4565a+dfsg-2ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2003 - 2007 Kungliga Tekniska HΓΆgskolan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms