RFC2744 - Generic Security Service API Version 2 : C-binding(2)

时间:2005-02-16 来源: 作者: 点击:
gss_init_sec_context and gss_accept_sec_context), the optional src_name output from gss_accept_sec_context and gss_inquire_context will, for such contexts, return a reserved internal-form name, defin
  
gss_init_sec_context and gss_accept_sec_context), the optional
src_name output from gss_accept_sec_context and gss_inquire_context
will, for such contexts, return a reserved internal-form name,
defined by the implementation.

When presented to gss_display_name, this reserved internal-form name
will result in a printable name that is syntactically distinguishable
from any valid principal name supported by the implementation,
associated with a name-type object identifier with the value
GSS_C_NT_ANONYMOUS, whose value us given in Appendix A. The
printable form of an anonymous name should be chosen such that it
implies anonymity, since this name may appear in, for example, audit
logs. For example, the string "<anonymous>" might be a good choice,
if no valid printable names supported by the implementation can begin
with "<" and end with ">".

4.5. Confidentiality

If a context supports the confidentiality service, gss_wrap may be
used to encrypt application messages. Messages are selectively
encrypted, under the control of the conf_req_flag input parameter to
gss_wrap.

4.6. Inter-process context transfer

GSS-API V2 provides routines (gss_export_sec_context and
gss_import_sec_context) which allow a security context to be
transferred between processes on a single machine. The most common
use for such a feature is a client-server design where the server is
implemented as a single process that accepts incoming security
contexts, which then launches child processes to deal with the data
on these contexts. In such a design, the child processes must have
access to the security context data structure created within the
parent by its call to gss_accept_sec_context so that they can use
per-message protection services and delete the security context when
the communication session ends.

Since the security context data structure is expected to contain
sequencing information, it is impractical in general to share a
context between processes. Thus GSS-API provides a call
(gss_export_sec_context) that the process which currently owns the
context can call to declare that it has no intention to use the
context subsequently, and to create an inter-process token containing
information needed by the adopting process to successfully import the
context. After successful completion of gss_export_sec_context, the
original security context is made inaccessible to the calling process
by GSS-API, and any context handles referring to this context are no
longer valid. The originating process transfers the inter-process
token to the adopting process, which passes it to
gss_import_sec_context, and a fresh gss_ctx_id_t is created such that
it is functionally identical to the original context.

The inter-process token may contain sensitive data from the original
security context (including cryptographic keys). Applications using
inter-process tokens to transfer security contexts must take
appropriate steps to protect these tokens in transit.

Implementations are not required to support the inter-process
transfer of security contexts. The ability to transfer a security
context is indicated when the context is created, by
gss_init_sec_context or gss_accept_sec_context setting the
GSS_C_TRANS_FLAG bit in their ret_flags parameter.

4.7. The use of incomplete contexts

Some mechanisms may allow the per-message services to be used before
the context establishment process is complete. For example, a
mechanism may include sufficient information in its initial context-
level token for the context acceptor to immediately decode messages
protected with gss_wrap or gss_get_mic. For such a mechanism, the
initiating application need not wait until subsequent context-level

tokens have been sent and received before invoking the per-message
protection services.

The ability of a context to provide per-message services in advance
of complete context establishment is indicated by the setting of the
GSS_C_PROT_READY_FLAG bit in the ret_flags parameter from
gss_init_sec_context and gss_accept_sec_context. Applications wishing
to use per-message protection services on partially-established
contexts should check this flag before attempting to invoke gss_wrap
or gss_get_mic.

5. GSS-API Routine Descriptions

In addition to the explicit major status codes documented here, the
code GSS_S_FAILURE may be returned by any routine, indicating an
implementation-specific or mechanism-specific error condition,
further details of which are reported via the minor_status parameter.

5.1. gss_accept_sec_context

OM_uint32 gss_accept_sec_context (
OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
const gss_cred_id_t acceptor_cred_handle,
const gss_buffer_t input_token_buffer,
const gss_channel_bindings_t input_chan_bindings,
const 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)

Purpose:

Allows a remotely initiated security context between the application
and a remote peer to be established. The routine may return a
output_token which should be transferred to the peer application,
where the peer application will present it to gss_init_sec_context.
If no token need be sent, gss_accept_sec_context will indicate this
by setting the length field of the output_token argument to zero. To
complete the context establishment, one or more reply tokens may be
required from the peer application; if so, gss_accept_sec_context
will return a status flag of GSS_S_CONTINUE_NEEDED, in which case it
should be called again when the reply token is received from the peer
application, passing the token to gss_accept_sec_context via the
input_token parameters.

Portable applications should be constructed to use the token length
and return status to determine whether a token needs to be sent or
waited for. Thus a typical portable caller should always invoke
gss_accept_sec_context within a loop:

gss_ctx_id_t context_hdl = GSS_C_NO_CONTEXT;

do {
receive_token_from_peer(input_token);
maj_stat = gss_accept_sec_context(&min_stat,
&context_hdl,
cred_hdl,
input_token,
input_bindings,
&client_name,
&mech_type,
output_token,
&ret_flags,
&time_rec,
&deleg_cred);
if (GSS_ERROR(maj_stat)) {
report_error(maj_stat, min_stat);
};
if (output_token->length != 0) {
send_token_to_peer(output_token);

gss_release_buffer(&min_stat, output_token);
};
if (GSS_ERROR(maj_stat)) {
if (context_hdl != GSS_C_NO_CONTEXT)
gss_delete_sec_context(&min_stat,
&context_hdl,
GSS_C_NO_BUFFER);
break;
};
} while (maj_stat & GSS_S_CONTINUE_NEEDED);

Whenever the routine returns a major status that includes the value
GSS_S_CONTINUE_NEEDED, the context is not fully established and the
following restrictions apply to the output parameters:

The value returned via the time_rec parameter is undefined Unless the
accompanying ret_flags parameter contains the bit
GSS_C_PROT_READY_FLAG, indicating that per-message services may be
applied in advance of a successful completion status, the value
returned via the mech_type parameter may be undefined until the
routine returns a major status value of GSS_S_COMPLETE.

The values of the GSS_C_DELEG_FLAG,
GSS_C_MUTUAL_FLAG,GSS_C_REPLAY_FLAG, GSS_C_SEQUENCE_FLAG,
GSS_C_CONF_FLAG,GSS_C_INTEG_FLAG and GSS_C_ANON_FLAG bits returned
via the ret_flags parameter should contain the values that the
implementation expects would be valid if context establishment were
to succeed.

The values of the GSS_C_PROT_READY_FLAG and GSS_C_TRANS_FLAG bits
within ret_flags should indicate the actual state at the time
gss_accept_sec_context returns, whether or not the context is fully
established.

Although this requires that GSS-API implementations set the
GSS_C_PROT_READY_FLAG in the final ret_flags returned to a caller
(i.e. when accompanied by a GSS_S_COMPLETE status code), applications
should not rely on this behavior as the flag was not defined in
Version 1 of the GSS-API. Instead, applications should be prepared to
use per-message services after a successful context establishment,
according to the GSS_C_INTEG_FLAG and GSS_C_CONF_FLAG values.

All other bits within the ret_flags argument should be set to zero.
While the routine returns GSS_S_CONTINUE_NEEDED, the values returned
via the ret_flags argument indicate the services that the
implementation expects to be available from the established context.

If the initial call of gss_accept_sec_context() fails, the
implementation should not create a context object, and should leave
the value of the context_handle parameter set to GSS_C_NO_CONTEXT to
indicate this. In the event of a failure on a subsequent call, the
implementation is permitted to delete the "half-built" security
context (in which case it should set the context_handle parameter to
GSS_C_NO_CONTEXT), but the preferred behavior is to leave the
security context (and the context_handle parameter) untouched for the
application to delete (using gss_delete_sec_context).

During context establishment, the informational status bits
GSS_S_OLD_TOKEN and GSS_S_DUPLICATE_TOKEN indicate fatal errors, and
GSS-API mechanisms should always return them in association with a
routine error of GSS_S_FAILURE. This requirement for pairing did not
exist in version 1 of the GSS-API specification, so applications that
wish to run over version 1 implementations must special-case these
codes.

Parameters:

context_handle gss_ctx_id_t, read/modify context handle for new
context. Supply GSS_C_NO_CONTEXT for first
call; use value returned in subsequent calls.
Once gss_accept_sec_context() has returned a
value via this parameter, resources have been
assigned to the corresponding context, and must
be freed by the application after use with a
call to gss_delete_sec_context().

acceptor_cred_handle gss_cred_id_t, read Credential handle claimed
by context acceptor. Specify
GSS_C_NO_CREDENTIAL to accept the context as a
default principal. If GSS_C_NO_CREDENTIAL is
specified, but no default acceptor principal is
defined, GSS_S_NO_CRED will be returned.

input_token_buffer buffer, opaque, read token obtained from remote
application.

input_chan_bindings channel bindings, read, optional Application-
specified bindings. Allows application to
securely bind channel identification information
to the security context. If channel bindings
are not used, specify GSS_C_NO_CHANNEL_BINDINGS.

src_name gss_name_t, modify, optional Authenticated name
of context initiator. After use, this name
should be deallocated by passing it to
gss_release_name(). If not required, specify
NULL.

mech_type Object ID, modify, optional Security mechanism
used. The returned OID value will be a pointer
into static storage, and should be treated as
read-only by the caller (in particular, it does
not need to be freed). If not required, specify
NULL.

output_token buffer, opaque, modify Token to be passed to
peer application. If the length field of the
returned token buffer is 0, then no token need
be passed to the peer application. If a non-
zero length field is returned, the associated
storage must be freed after use by the
application with a call to gss_release_buffer().

ret_flags bit-mask, modify, optional Contains various
independent flags, each of which indicates that
the context supports a specific service option.
If not needed, specify NULL. Symbolic names are
provided for each flag, and the symbolic names
corresponding to the required flags should be
logically-ANDed with the ret_flags value to test
whether a given option is supported by the
context. The flags are:
GSS_C_DELEG_FLAG
True - Delegated credentials are available
via the delegated_cred_handle
parameter
False - No credentials were delegated
GSS_C_MUTUAL_FLAG
True - Remote peer asked for mutual
authentication
False - Remote peer did not ask for mutual
authentication
GSS_C_REPLAY_FLAG
True - replay of protected messages
will be detected
False - replayed messages will not be
detected
GSS_C_SEQUENCE_FLAG
True - out-of-sequence protected
messages will be detected
False - out-of-sequence messages will not
be detected
GSS_C_CONF_FLAG
True - Confidentiality service may be
invoked by calling the gss_wrap
routine
False - No confidentiality service (via
gss_wrap) available. gss_wrap will
provide message encapsulation,
data-origin authentication and
integrity services only.
GSS_C_INTEG_FLAG
True - Integrity service may be invoked by
calling either gss_get_mic or
gss_wrap routines.
False - Per-message integrity service
unavailable.
GSS_C_ANON_FLAG
True - The initiator does not wish to
be authenticated; the src_name
parameter (if requested) contains

an anonymous internal name.
False - The initiator has been
authenticated normally.
GSS_C_PROT_READY_FLAG
True - Protection services (as specified
by the states of the GSS_C_CONF_FLAG
and GSS_C_INTEG_FLAG) are available
if the accompanying major status
return value is either GSS_S_COMPLETE
or GSS_S_CONTINUE_NEEDED.
False - Protection services (as specified
by the states of the GSS_C_CONF_FLAG
and GSS_C_INTEG_FLAG) are available
only if the accompanying major status
return value is GSS_S_COMPLETE.
GSS_C_TRANS_FLAG
True - The resultant security context may
be transferred to other processes via
a call to gss_export_sec_context().
False - The security context is not
transferable.
All other bits should be set to zero.

time_rec Integer, modify, optional
number of seconds for which the context will
remain valid. Specify NULL if not required.

delegated_cred_handle
gss_cred_id_t, modify, optional credential
handle for credentials received from context
initiator. Only valid if deleg_flag in
ret_flags is true, in which case an explicit
credential handle (i.e. not GSS_C_NO_CREDENTIAL)
will be returned; if deleg_flag is false,
gss_accept_context() will set this parameter to
GSS_C_NO_CREDENTIAL. If a credential handle is
returned, the associated resources must be
released by the application after use with a
call to gss_release_cred(). Specify NULL if not
required.

minor_status Integer, modify
Mechanism specific status code.

GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
application is required to complete the
context, and that gss_accept_sec_context must
be called again with that token.

GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on
the input_token failed.

GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks
performed on the credential failed.

GSS_S_NO_CRED The supplied credentials were not valid for context
acceptance, or the credential handle did not
reference any credentials.

GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.

GSS_S_BAD_BINDINGS The input_token contains different channel
bindings to those specified via the
input_chan_bindings parameter.

GSS_S_NO_CONTEXT Indicates that the supplied context handle did not
refer to a valid context.

GSS_S_BAD_SIG The input_token contains an invalid MIC.

GSS_S_OLD_TOKEN The input_token was too old. This is a fatal error
during context establishment.

GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a duplicate of
a token already processed. This is a fatal
error during context establishment.

GSS_S_BAD_MECH The received token specified a mechanism that is
not supported by the implementation or the
provided credential.

5.2. gss_acquire_cred

OM_uint32 gss_acquire_cred (
OM_uint32 *minor_status,
const gss_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)

Purpose:

Allows an application to acquire a handle for a pre-existing
credential by name. GSS-API implementations must impose a local
access-control policy on callers of this routine to prevent
unauthorized callers from acquiring credentials to which they are not
entitled. This routine is not intended to provide a "login to the
network" function, as such a function would involve the creation of
new credentials rather than merely acquiring a handle to existing
credentials. Such functions, if required, should be defined in
implementation-specific extensions to the API.

If desired_name is GSS_C_NO_NAME, the call is interpreted as a
request for a credential handle that will invoke default behavior
when passed to gss_init_sec_context() (if cred_usage is
GSS_C_INITIATE or GSS_C_BOTH) or gss_accept_sec_context() (if
cred_usage is GSS_C_ACCEPT or GSS_C_BOTH).

Mechanisms should honor the desired_mechs parameter, and return a
credential that is suitable to use only with the requested
mechanisms. An exception to this is the case where one underlying
credential element can be shared by multiple mechanisms; in this case
it is permissible for an implementation to indicate all mechanisms
with which the credential element may be used. If desired_mechs is
an empty set, behavior is undefined.

This routine is expected to be used primarily by context acceptors,
since implementations are likely to provide mechanism-specific ways
of obtaining GSS-API initiator credentials from the system login
process. Some implementations may therefore not support the
acquisition of GSS_C_INITIATE or GSS_C_BOTH credentials via
gss_acquire_cred for any name other than GSS_C_NO_NAME, or a name
produced by applying either gss_inquire_cred to a valid credential,
or gss_inquire_context to an active context.

If credential acquisition is time-consuming for a mechanism, the
mechanism may choose to delay the actual acquisition until the
credential is required (e.g. by gss_init_sec_context or
gss_accept_sec_context). Such mechanism-specific implementation
decisions should be invisible to the calling application; thus a call
of gss_inquire_cred immediately following the call of
gss_acquire_cred must return valid credential data, and may therefore
incur the overhead of a deferred credential acquisition.

Parameters:

desired_name gss_name_t, read
Name of principal whose credential
should be acquired

time_req Integer, read, optional
number of seconds that credentials
should remain valid. Specify GSS_C_INDEFINITE
to request that the credentials have the maximum
permitted lifetime.

desired_mechs Set of Object IDs, read, optional
set of underlying security mechanisms that
may be used. GSS_C_NO_OID_SET may be used
to obtain an implementation-specific default.

cred_usage gss_cred_usage_t, read
GSS_C_BOTH - Credentials may be used
either to initiate or accept
security contexts.
GSS_C_INITIATE - Credentials will only be
used to initiate security contexts.
GSS_C_ACCEPT - Credentials will only be used to
accept security contexts.

output_cred_handle gss_cred_id_t, modify
The returned credential handle. Resources
associated with this credential handle must
be released by the application after use
with a call to gss_release_cred().

actual_mechs Set of Object IDs, modify, optional
The set of mechanisms for which the
credential is valid. Storage associated
with the returned OID-set must be released by
the application after use with a call to
gss_release_oid_set(). Specify NULL if not
required.

time_rec Integer, modify, optional
Actual number of seconds for which the
returned credentials will remain valid. If the
implementation does not support expiration of
credentials, the value GSS_C_INDEFINITE will
be returned. Specify NULL if not required

minor_status Integer, modify
Mechanism specific status code.

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_MECH Unavailable mechanism requested

GSS_S_BAD_NAMETYPE Type contained within desired_name parameter
is not supported

GSS_S_BAD_NAME Value supplied for desired_name parameter is ill
formed.

GSS_S_CREDENTIALS_EXPIRED The credentials could not be acquired
Because they have expired.

GSS_S_NO_CRED No credentials were found for the specified name.

5.3. gss_add_cred

OM_uint32 gss_add_cred (
OM_uint32 *minor_status,
const gss_cred_id_t input_cred_handle,
const gss_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)

Purpose:

Adds a credential-element to a credential. The credential-element is
identified by the name of the principal to which it refers. GSS-API
implementations must impose a local access-control policy on callers
of this routine to prevent unauthorized callers from acquiring
credential-elements to which they are not entitled. This routine is
not intended to provide a "login to the network" function, as such a
function would involve the creation of new mechanism-specific
authentication data, rather than merely acquiring a GSS-API handle to
existing data. Such functions, if required, should be defined in
implementation-specific extensions to the API.

If desired_name is GSS_C_NO_NAME, the call is interpreted as a
request to add a credential element that will invoke default behavior
when passed to gss_init_sec_context() (if cred_usage is
GSS_C_INITIATE or GSS_C_BOTH) or gss_accept_sec_context() (if
cred_usage is GSS_C_ACCEPT or GSS_C_BOTH).

This routine is expected to be used primarily by context acceptors,
since implementations are likely to provide mechanism-specific ways
of obtaining GSS-API initiator credentials from the system login
process. Some implementations may therefore not support the
acquisition of GSS_C_INITIATE or GSS_C_BOTH credentials via
gss_acquire_cred for any name other than GSS_C_NO_NAME, or a name
produced by applying either gss_inquire_cred to a valid credential,
or gss_inquire_context to an active context.

If credential acquisition is time-consuming for a mechanism, the
mechanism may choose to delay the actual acquisition until the
credential is required (e.g. by gss_init_sec_context or
gss_accept_sec_context). Such mechanism-specific implementation
decisions should be invisible to the calling application; thus a call
of gss_inquire_cred immediately following the call of gss_add_cred
must return valid credential data, and may therefore incur the
overhead of a deferred credential acquisition.

This routine can be used to either compose a new credential
containing all credential-elements of the original in addition to the
newly-acquire credential-element, or to add the new credential-
element to an existing credential. If NULL is specified for the
output_cred_handle parameter argument, the new credential-element
will be added to the credential identified by input_cred_handle; if a
valid pointer is specified for the output_cred_handle parameter, a
new credential handle will be created.

If GSS_C_NO_CREDENTIAL is specified as the input_cred_handle,
gss_add_cred will compose a credential (and set the
output_cred_handle parameter accordingly) based on default behavior.
That is, the call will have the same effect as if the application had
first made a call to gss_acquire_cred(), specifying the same usage
and passing GSS_C_NO_NAME as the desired_name parameter to obtain an
explicit credential handle embodying default behavior, passed this
credential handle to gss_add_cred(), and finally called
gss_release_cred() on the first credential handle.

If GSS_C_NO_CREDENTIAL is specified as the input_cred_handle
parameter, a non-NULL output_cred_handle must be supplied.

Parameters:

minor_status Integer, modify
Mechanism specific status code.

input_cred_handle gss_cred_id_t, read, optional
The credential to which a credential-element
will be added. If GSS_C_NO_CREDENTIAL is
specified, the routine will compose the new
credential based on default behavior (see
description above). Note that, while the
credential-handle is not modified by
gss_add_cred(), the underlying credential
will be modified if output_credential_handle
is NULL.

desired_name gss_name_t, read.
Name of principal whose credential
should be acquired.

desired_mech Object ID, read
Underlying security mechanism with which the
credential may be used.

cred_usage gss_cred_usage_t, read
GSS_C_BOTH - Credential may be used
either to initiate or accept
security contexts.
GSS_C_INITIATE - Credential will only be
used to initiate security
contexts.
GSS_C_ACCEPT - Credential will only be used to
accept security contexts.

initiator_time_req Integer, read, optional
number of seconds that the credential
should remain valid for initiating security
contexts. This argument is ignored if the
composed credentials are of type GSS_C_ACCEPT.
Specify GSS_C_INDEFINITE to request that the
credentials have the maximum permitted
initiator lifetime.

acceptor_time_req Integer, read, optional
number of seconds that the credential
should remain valid for accepting security
contexts. This argument is ignored if the
composed credentials are of type GSS_C_INITIATE.

Specify GSS_C_INDEFINITE to request that the
credentials have the maximum permitted initiator
lifetime.

output_cred_handle gss_cred_id_t, modify, optional
The returned credential handle, containing
the new credential-element and all the
credential-elements from input_cred_handle.
If a valid pointer to a gss_cred_id_t is
supplied for this parameter, gss_add_cred
creates a new credential handle containing all
credential-elements from the input_cred_handle
and the newly acquired credential-element; if
NULL is specified for this parameter, the newly
acquired credential-element will be added
to the credential identified by input_cred_handle.

The resources associated with any credential
handle returned via this parameter must be
released by the application after use with a
call to gss_release_cred().

actual_mechs Set of Object IDs, modify, optional
The complete set of mechanisms for which
the new credential is valid. Storage for
the returned OID-set must be freed by the
application after use with a call to
gss_release_oid_set(). Specify NULL if
not required.

initiator_time_rec Integer, modify, optional
Actual number of seconds for which the
returned credentials will remain valid for
initiating contexts using the specified
mechanism. If the implementation or mechanism
does not support expiration of credentials, the
value GSS_C_INDEFINITE will be returned. Specify
NULL if not required

acceptor_time_rec Integer, modify, optional
Actual number of seconds for which the
returned credentials will remain valid for
accepting security contexts using the specified
mechanism. If the implementation or mechanism
does not support expiration of credentials, the
value GSS_C_INDEFINITE will be returned. Specify
NULL if not required

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_MECH Unavailable mechanism requested

GSS_S_BAD_NAMETYPE Type contained within desired_name parameter
is not supported

GSS_S_BAD_NAME Value supplied for desired_name parameter is
ill-formed.

GSS_S_DUPLICATE_ELEMENT The credential already contains an element
for the requested mechanism with overlapping
usage and validity period.

GSS_S_CREDENTIALS_EXPIRED The required credentials could not be
added because they have expired.

GSS_S_NO_CRED No credentials were found for the specified name.

5.4. gss_add_oid_set_member

OM_uint32 gss_add_oid_set_member (
OM_uint32 *minor_status,
const gss_OID member_oid,
gss_OID_set *oid_set)

Purpose:

Add an Object Identifier to an Object Identifier set. This routine
is intended for use in conjunction with gss_create_empty_oid_set when
constructing a set of mechanism OIDs for input to gss_acquire_cred.
The oid_set parameter must refer to an OID-set that was created by
GSS-API (e.g. a set returned by gss_create_empty_oid_set()). GSS-API
creates a copy of the member_oid and inserts this copy into the set,
expanding the storage allocated to the OID-set's elements array if
necessary. The routine may add the new member OID anywhere within
the elements array, and implementations should verify that the new
member_oid is not already contained within the elements array; if the
member_oid is already present, the oid_set should remain unchanged.

Parameters:

minor_status Integer, modify
Mechanism specific status code

member_oid Object ID, read
The object identifier to copied into
the set.

oid_set Set of Object ID, modify
The set in which the object identifier
should be inserted.

Function value: GSS status code

GSS_S_COMPLETE Successful completion

5.5. gss_canonicalize_name

OM_uint32 gss_canonicalize_name (
OM_uint32 *minor_status,
const gss_name_t input_name,
const gss_OID mech_type,
gss_name_t *output_name)

Purpose:

Generate a canonical mechanism name (MN) from an arbitrary internal
name. The mechanism name is the name that would be returned to a
context acceptor on successful authentication of a context where the
initiator used the input_name in a successful call to
gss_acquire_cred, specifying an OID set containing <mech_type> as its
only member, followed by a call to gss_init_sec_context, specifying
<mech_type> as the authentication mechanism.

Parameters:

minor_status Integer, modify
Mechanism specific status code

input_name gss_name_t, read
The name for which a canonical form is
desired

mech_type Object ID, read
The authentication mechanism for which the
canonical form of the name is desired. The
desired mechanism must be specified explicitly;
no default is provided.

output_name gss_name_t, modify
The resultant canonical name. Storage
associated with this name must be freed by
the application after use with a call to
gss_release_name().

Function value: GSS status code

GSS_S_COMPLETE Successful completion.

GSS_S_BAD_MECH The identified mechanism is not supported.

GSS_S_BAD_NAMETYPE The provided internal name contains no elements
that could be processed by the specified
mechanism.

GSS_S_BAD_NAME The provided internal name was ill-formed.

5.6. gss_compare_name

OM_uint32 gss_compare_name (
OM_uint32 *minor_status,
const gss_name_t name1,
const gss_name_t name2,
int *name_equal)

Purpose:

Allows an application to compare two internal-form names to determine
whether they refer to the same entity.

If either name presented to gss_compare_name denotes an anonymous
principal, the routines should indicate that the two names do not
refer to the same identity.

Parameters:

minor_status Integer, modify
Mechanism specific status code.

name1 gss_name_t, read
internal-form name

name2 gss_name_t, read
internal-form name

name_equal boolean, modify
non-zero - names refer to same entity
zero - names refer to different entities
(strictly, the names are not known
to refer to the same identity).

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAMETYPE The two names were of incomparable types.

GSS_S_BAD_NAME One or both of name1 or name2 was ill-formed.

5.7. gss_context_time

OM_uint32 gss_context_time (
OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
OM_uint32 *time_rec)

Purpose:

Determines the number of seconds for which the specified context will
remain valid.

Parameters:

minor_status Integer, modify
Implementation specific status code.

context_handle gss_ctx_id_t, read
Identifies the context to be interrogated.

time_rec Integer, modify
Number of seconds that the context will remain
valid. If the context has already expired,
zero will be returned.

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify
a valid context

5.8. gss_create_empty_oid_set

OM_uint32 gss_create_empty_oid_set (
OM_uint32 *minor_status,
gss_OID_set *oid_set)

Purpose:

Create an object-identifier set containing no object identifiers, to
which members may be subsequently added using the
gss_add_oid_set_member() routine. These routines are intended to be
used to construct sets of mechanism object identifiers, for input to
gss_acquire_cred.

Parameters:

minor_status Integer, modify
Mechanism specific status code

oid_set Set of Object IDs, modify
The empty object identifier set.
The routine will allocate the
gss_OID_set_desc object, which the
application must free after use with
a call to gss_release_oid_set().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

5.9. gss_delete_sec_context

OM_uint32 gss_delete_sec_context (
OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
gss_buffer_t output_token)

Purpose:

Delete a security context. gss_delete_sec_context will delete the
local data structures associated with the specified security context,
and may generate an output_token, which when passed to the peer
gss_process_context_token will instruct it to do likewise. If no
token is required by the mechanism, the GSS-API should set the length
field of the output_token (if provided) to zero. No further security
services may be obtained using the context specified by
context_handle.

In addition to deleting established security contexts,
gss_delete_sec_context must also be able to delete "half-built"
security contexts resulting from an incomplete sequence of
gss_init_sec_context()/gss_accept_sec_context() calls.

The output_token parameter is retained for compatibility with version
1 of the GSS-API. It is recommended that both peer applications
invoke gss_delete_sec_context passing the value GSS_C_NO_BUFFER for
the output_token parameter, indicating that no token is required, and
that gss_delete_sec_context should simply delete local context data
structures. If the application does pass a valid buffer to
gss_delete_sec_context, mechanisms are encouraged to return a zero-
length token, indicating that no peer action is necessary, and that
no token should be transferred by the application.

Parameters:

minor_status Integer, modify
Mechanism specific status code.

context_handle gss_ctx_id_t, modify
context handle identifying context to delete.
After deleting the context, the GSS-API will set
this context handle to GSS_C_NO_CONTEXT.

output_token buffer, opaque, modify, optional
token to be sent to remote application to
instruct it to also delete the context. It
is recommended that applications specify
GSS_C_NO_BUFFER for this parameter, requesting
local deletion only. If a buffer parameter is
provided by the application, the mechanism may
return a token in it; mechanisms that implement
only local deletion should set the length field of
this token to zero to indicate to the application
that no token is to be sent to the peer.

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_NO_CONTEXT No valid context was supplied

5.10.gss_display_name

OM_uint32 gss_display_name (
OM_uint32 *minor_status,
const gss_name_t input_name,
gss_buffer_t output_name_buffer,
gss_OID *output_name_type)

Purpose:

Allows an application to obtain a textual representation of an opaque
internal-form name for display purposes. The syntax of a printable
name is defined by the GSS-API implementation.

If input_name denotes an anonymous principal, the implementation
should return the gss_OID value GSS_C_NT_ANONYMOUS as the
output_name_type, and a textual name that is syntactically distinct
from all valid supported printable names in output_name_buffer.

If input_name was created by a call to gss_import_name, specifying
GSS_C_NO_OID as the name-type, implementations that employ lazy
conversion between name types may return GSS_C_NO_OID via the
output_name_type parameter.

Parameters:

minor_status Integer, modify
Mechanism specific status code.

input_name gss_name_t, read
name to be displayed

output_name_buffer buffer, character-string, modify
buffer to receive textual name string.
The application must free storage associated
with this name after use with a call to
gss_release_buffer().

output_name_type Object ID, modify, optional
The type of the returned name. The returned
gss_OID will be a pointer into static storage,
and should be treated as read-only by the caller
(in particular, the application should not attempt
to free it). Specify NULL if not required.

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAME input_name was ill-formed

5.11.gss_display_status

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)

Purpose:

Allows an application to obtain a textual representation of a GSS-API
status code, for display to the user or for logging purposes. Since
some status values may indicate multiple conditions, applications may
need to call gss_display_status multiple times, each call generating
a single text string. The message_context parameter is used by
gss_display_status to store state information about which error
messages have already been extracted from a given status_value;
message_context must be initialized to 0 by the application prior to
the first call, and gss_display_status will return a non-zero value
in this parameter if there are further messages to extract.

The message_context parameter contains all state information required
by gss_display_status in order to extract further messages from the
status_value; even when a non-zero value is returned in this
parameter, the application is not required to call gss_display_status
again unless subsequent messages are desired. The following code
extracts all messages from a given status code and prints them to
stderr:

OM_uint32 message_context;
OM_uint32 status_code;
OM_uint32 maj_status;
OM_uint32 min_status;
gss_buffer_desc status_string;

...

message_context = 0;

do {

maj_status = gss_display_status (
&min_status,
status_code,
GSS_C_GSS_CODE,
GSS_C_NO_OID,
&message_context,
&status_string)

fprintf(stderr,
"%.*s\n",
(int)status_string.length,

(char *)status_string.value);

gss_release_buffer(&min_status, &status_string);

} while (message_context != 0);

Parameters:

minor_status Integer, modify
Mechanism specific status code.

status_value Integer, read
Status value to be converted

status_type Integer, read
GSS_C_GSS_CODE - status_value is a GSS status
code

GSS_C_MECH_CODE - status_value is a mechanism
status code

mech_type Object ID, read, optional
Underlying mechanism (used to interpret a
minor status value) Supply GSS_C_NO_OID to
obtain the system default.

message_context Integer, read/modify
Should be initialized to zero by the
application prior to the first call.
On return from gss_display_status(),
a non-zero status_value parameter indicates
that additional messages may be extracted
from the status code via subsequent calls

to gss_display_status(), passing the same
status_value, status_type, mech_type, and
message_context parameters.

status_string buffer, character string, modify
textual interpretation of the status_value.
Storage associated with this parameter must
be freed by the application after use with
a call to gss_release_buffer().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_MECH Indicates that translation in accordance with
an unsupported mechanism type was requested

GSS_S_BAD_STATUS The status value was not recognized, or the
status type was neither GSS_C_GSS_CODE nor
GSS_C_MECH_CODE.

5.12. gss_duplicate_name

OM_uint32 gss_duplicate_name (
OM_uint32 *minor_status,
const gss_name_t src_name,
gss_name_t *dest_name)

Purpose:

Create an exact duplicate of the existing internal name src_name.
The new dest_name will be independent of src_name (i.e. src_name and
dest_name must both be released, and the release of one shall not
affect the validity of the other).

Parameters:

minor_status Integer, modify
Mechanism specific status code.

src_name gss_name_t, read
internal name to be duplicated.

dest_name gss_name_t, modify
The resultant copy of <src_name>.
Storage associated with this name must
be freed by the application after use
with a call to gss_release_name().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAME The src_name parameter was ill-formed.

5.13. gss_export_name

OM_uint32 gss_export_name (
OM_uint32 *minor_status,
const gss_name_t input_name,
gss_buffer_t exported_name)

Purpose:

To produce a canonical contiguous string representation of a
mechanism name (MN), suitable for direct comparison (e.g. with
memcmp) for use in authorization functions (e.g. matching entries in
an access-control list). The <input_name> parameter must specify a
valid MN (i.e. an internal name generated by gss_accept_sec_context
or by gss_canonicalize_name).

Parameters:

minor_status Integer, modify
Mechanism specific status code

input_name gss_name_t, read
The MN to be exported

exported_name gss_buffer_t, octet-string, modify
The canonical contiguous string form of
<input_name>. Storage associated with
this string must freed by the application
after use with gss_release_buffer().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_NAME_NOT_MN The provided internal name was not a mechanism
name.

GSS_S_BAD_NAME The provided internal name was ill-formed.

GSS_S_BAD_NAMETYPE The internal name was of a type not supported
by the GSS-API implementation.

5.14. gss_export_sec_context

OM_uint32 gss_export_sec_context (
OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
gss_buffer_t interprocess_token)

Purpose:

Provided to support the sharing of work between multiple processes.
This routine will typically be used by the context-acceptor, in an
application where a single process receives incoming connection
requests and accepts security contexts over them, then passes the
established context to one or more other processes for message
exchange. gss_export_sec_context() deactivates the security context
for the calling process and creates an interprocess token which, when
passed to gss_import_sec_context in another process, will re-activate
the context in the second process. Only a single instantiation of a
given context may be active at any one time; a subsequent attempt by
a context exporter to access the exported security context will fail.

The implementation may constrain the set of processes by which the
interprocess token may be imported, either as a function of local
security policy, or as a result of implementation decisions. For
example, some implementations may constrain contexts to be passed
only between processes that run under the same account, or which are
part of the same process group.

The interprocess token may contain security-sensitive information
(for example cryptographic keys). While mechanisms are encouraged to
either avoid placing such sensitive information within interprocess
tokens, or to encrypt the token before returning it to the
application, in a typical object-library GSS-API implementation this
may not be possible. Thus the application must take care to protect
the interprocess token, and ensure that any process to which the
token is transferred is trustworthy.

If creation of the interprocess token is successful, the
implementation shall deallocate all process-wide resources associated
with the security context, and set the context_handle to
GSS_C_NO_CONTEXT. In the event of an error that makes it impossible
to complete the export of the security context, the implementation
must not return an interprocess token, and should strive to leave the
security context referenced by the context_handle parameter
untouched. If this is impossible, it is permissible for the
implementation to delete the security context, providing it also sets
the context_handle parameter to GSS_C_NO_CONTEXT.

Parameters:

minor_status Integer, modify
Mechanism specific status code

context_handle gss_ctx_id_t, modify
context handle identifying the context to
transfer.

interprocess_token buffer, opaque, modify
token to be transferred to target process.
Storage associated with this token must be
freed by the application after use with a
call to gss_release_buffer().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_CONTEXT_EXPIRED The context has expired

GSS_S_NO_CONTEXT The context was invalid

GSS_S_UNAVAILABLE The operation is not supported.

5.15. gss_get_mic

OM_uint32 gss_get_mic (
OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
gss_qop_t qop_req,
const gss_buffer_t message_buffer,
gss_buffer_t msg_token)

Purpose:

Generates a cryptographic MIC for the supplied message, and places
the MIC in a token for transfer to the peer application. The qop_req
parameter allows a choice between several cryptographic algorithms,
if supported by the chosen mechanism.

Since some application-level protocols may wish to use tokens emitted
by gss_wrap() to provide "secure framing", implementations must
support derivation of MICs from zero-length messages.

Parameters:

minor_status Integer, modify
Implementation specific status code.

context_handle gss_ctx_id_t, read
identifies the context on which the message
will be sent

qop_req gss_qop_t, read, optional
Specifies requested quality of protection.
Callers are encouraged, on portability grounds,
to accept the default quality of protection
offered by the chosen mechanism, which may be
requested by specifying GSS_C_QOP_DEFAULT for
this parameter. If an unsupported protection
strength is requested, gss_get_mic will return a
major_status of GSS_S_BAD_QOP.

message_buffer buffer, opaque, read
message to be protected

msg_token buffer, opaque, modify
buffer to receive token. The application must
free storage associated with this buffer after
use with a call to gss_release_buffer().

Function value: GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify
a valid context

GSS_S_BAD_QOP The specified QOP is not supported by the
mechanism.

5.16. gss_import_name

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)

Purpose:

Convert a contiguous string name to internal form. In general, the
internal name returned (via the <output_name> parameter) will not be
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容