メインコンテンツまでスキップ

3. GSSAPI ルーチンの説明

2.1. gss_acquire_cred​

      OM_uint32  gss_acquire_cred (
OM_uint32 * minor_status,
gss_name_t desired_name,
OM_uint32 time_req,
gss_OID_set desired_mechs,
int cred_usage,
gss_cred_id_t * output_cred_handle,
gss_OID_set * actual_mechs,
OM_int32 * time_rec)
Purpose:

アプリケーションが名前によって既存の資格情報へのハンドルを取得できるようにする。GSSAPI 実装は、権限のない呼び出し側が受ける権限のない資格情報を取得できないように、このルーチンの呼び出し側に対してローカルのアクセス制御ポリシーを課さなければならない。このルーチンは「ネットワークへのログイン」機能を提供することを意図していない。そのような機能は、既存の資格情報へのハンドルを取得するだけではなく新たな資格情報を生成することになるからである。そのような機能が必要な場合は、API の実装固有の拡張として定義されるべきである。

あるメカニズムにとって資格情報の取得に時間がかかる場合、そのメカニズムは実際の取得を (例えば gss_init_sec_context や gss_accept_sec_context によって) 資格情報が必要になるまで遅らせることを選択してもよい。そのようなメカニズム固有の実装上の判断は、呼び出し側アプリケーションには見えないようにすべきである。したがって、gss_acquire_cred の呼び出しの直後に gss_inquire_cred を呼び出した場合、有効な資格情報データを返さなければならず、その結果、遅延された資格情報取得のオーバーヘッドが生じることがある。

パラメーター:

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

      time_req          integer, read
                        number of seconds that credentials
                        should remain valid

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

      cred_usage        integer, 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.

      actual_mechs      Set of Object IDs, modify, optional
                        The set of mechanisms for which the
                        credential is valid.  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_FAILURE     Unspecified failure.  The minor_status parameter
                        contains more detailed information

3.2. gss_release_cred​

      OM_uint32  gss_release_cred (
OM_uint32 * minor_status,
gss_cred_id_t * cred_handle)

目的:

指定された資格情報ハンドルがプロセスによって不要になったことを GSSAPI に通知する。すべてのプロセスが資格情報を解放すると、その資格情報は削除される。

パラメーター:

      cred_handle       gss_cred_id_t, modify, optional
buffer containing opaque credential
handle. If GSS_C_NO_CREDENTIAL is supplied,
the default credential will be released

minor_status integer, modify
Mechanism specific status code.

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_NO_CRED Credentials could not be accessed.

3.3. gss_init_sec_context​

      OM_uint32  gss_init_sec_context (
OM_uint32 * minor_status,
gss_cred_id_t claimant_cred_handle,
gss_ctx_id_t * context_handle,
gss_name_t target_name,
gss_OID mech_type,
int req_flags,
int time_req,
gss_channel_bindings_t
input_chan_bindings,
gss_buffer_t input_token
gss_OID * actual_mech_type,
gss_buffer_t output_token,
int * ret_flags,
OM_uint32 * time_rec )

目的:

アプリケーションとリモート・ピアとの間にセキュリティ・コンテキストを確立する手順を開始する。最初は input_token パラメーターに GSS_C_NO_BUFFER を指定すべきである。このルーチンは output_token を返すことがあり、それはピア・アプリケーションへ転送され、ピア・アプリケーションはそれを gss_accept_sec_context へ渡す。トークンを送信する必要がない場合、gss_init_sec_context は output_token 引数の length フィールドをゼロに設定することによってその旨を示す。コンテキストの確立を完了するためには、ピア・アプリケーションから 1 つまたは複数の応答トークンが必要になることがある。その場合、gss_init_sec_context は GSS_S_CONTINUE_NEEDED を示す状態を返す。このときは、ピア・アプリケーションから応答トークンを受け取った時点で、そのトークンを input_token パラメーターを介して gss_init_sec_context へ渡し、ルーチンを再び呼び出すべきである。

ret_flags および time_rec パラメーターを介して返される値は、ルーチンが GSS_S_COMPLETE を返さない限り定義されない。

パラメーター:

      claimant_cred_handle  gss_cred_id_t, read, optional
                            handle for credentials claimed.  Supply
                            GSS_C_NO_CREDENTIAL to use default
                            credentials.

      context_handle    gss_ctx_id_t, read/modify
                        context handle for new context.  Supply
                        GSS_C_NO_CONTEXT for first call; use value
                        returned by first call in continuation calls.

      target_name       gss_name_t, read
                        Name of target

      mech_type         OID, read, optional
                        Object ID of desired mechanism. Supply
                        GSS_C_NULL_OID to obtain an implementation
                        specific default

      req_flags         bit-mask, read
                        Contains four independent flags, each of
                        which requests that the context support a
                        specific service option.  Symbolic
                        names are provided for each flag, and the
                        symbolic names corresponding to the required
                        flags should be logically-ORed
                        together to form the bit-mask value.  The
                        flags are:

                        GSS_C_DELEG_FLAG
                              True - Delegate credentials to remote peer
                              False - Don't delegate
                        GSS_C_MUTUAL_FLAG
                              True - Request that remote peer
                                     authenticate itself
                              False - Authenticate self to remote peer
                                      only
                        GSS_C_REPLAY_FLAG
                              True - Enable replay detection for signed
                                     or sealed messages
                              False - Don't attempt to detect
                                      replayed messages
                        GSS_C_SEQUENCE_FLAG
                              True - Enable detection of out-of-sequence
                                     signed or sealed messages
                              False - Don't attempt to detect
                                      out-of-sequence messages

      time_req          integer, read
                        Desired number of seconds for which context
                        should remain valid.  Supply 0 to request a
                        default validity period.

      input_chan_bindings     channel bindings, read
                              Application-specified bindings.  Allows
                              application to securely bind channel
                              identification information to the security
                              context.

      input_token       buffer, opaque, read, optional (see text)
                        Token received from peer application.
                        Supply GSS_C_NO_BUFFER on initial call.

      actual_mech_type  OID, modify
                        actual mechanism used.

      output_token      buffer, opaque, modify
                        token to be sent to peer application.  If
                        the length field of the returned buffer is
                        zero, no token need be sent to the peer
                        application.

      ret_flags         bit-mask, modify
                        Contains six independent flags, each of which
                        indicates that the context supports a specific
                        service option.  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 - Credentials were delegated to
                                     the remote peer
                              False - No credentials were delegated
                        GSS_C_MUTUAL_FLAG
                              True - Remote peer has been asked to
                                     authenticated itself
                              False - Remote peer has not been asked to
                                      authenticate itself
                        GSS_C_REPLAY_FLAG
                              True - replay of signed or sealed messages
                                     will be detected
                              False - replayed messages will not be
                                      detected
                        GSS_C_SEQUENCE_FLAG
                              True - out-of-sequence signed or sealed
                                     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 seal routine
                              False - No confidentiality service (via
                                      seal) available. seal 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_sign or gss_seal
                                     routines.
                              False - Per-message integrity service
                                      unavailable.

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

      minor_status      integer, modify
                        Mechanism specific status code.

戻り値:

GSS 状態コード:

GSS_S_COMPLETE 成功完了

   GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
application is required to complete thecontext, and
that gss_init_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
initiation, or the credential handle did not
reference any credentials.

GSS_S_CREDENTIALS_EXPIRED 参照された資格情報の有効期限が切れている

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

GSS_S_BAD_SIG The input_token contains an invalid signature, or a
signature that could not be verified

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_NO_CONTEXT Indicates that the supplied context handle did not
refer to a valid context

GSS_S_BAD_NAMETYPE The provided target_name parameter contained an
invalid or unsupported type of name

GSS_S_BAD_NAME 指定された target_name パラメーターの形式が不正である。

GSS_S_FAILURE 失敗。詳細は minor_status を参照のこと

3.4. gss_accept_sec_context​

      OM_uint32  gss_accept_sec_context (
OM_uint32 * minor_status,
gss_ctx_id_t * context_handle,
gss_cred_id_t verifier_cred_handle,
gss_buffer_t input_token_buffer
gss_channel_bindings_t
input_chan_bindings,
gss_name_t * src_name,
gss_OID * mech_type,
gss_buffer_t output_token,
int * ret_flags,
OM_uint32 * time_rec,
gss_cred_id_t * delegated_cred_handle)

目的:

アプリケーションとリモート・ピアとの間で、リモートから開始されたセキュリティ・コンテキストを確立できるようにする。このルーチンは output_token を返すことがあり、それはピア・アプリケーションへ転送され、ピア・アプリケーションはそれを gss_init_sec_context へ渡す。トークンを送信する必要がない場合、gss_accept_sec_context は output_token 引数の length フィールドをゼロに設定することによってその旨を示す。コンテキストの確立を完了するためには、ピア・アプリケーションから 1 つまたは複数の応答トークンが必要になることがある。その場合、gss_accept_sec_context は GSS_S_CONTINUE_NEEDED の状態フラグを返す。このときは、ピア・アプリケーションから応答トークンを受け取った時点で、そのトークンを input_token パラメーターを介して gss_accept_sec_context へ渡し、ルーチンを再び呼び出すべきである。

src_name、ret_flags、time_rec、および delegated_cred_handle パラメーターを介して返される値は、ルーチンが GSS_S_COMPLETE を返さない限り定義されない。

パラメーター:

      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.

      verifier_cred_handle    gss_cred_id_t, read, optional
                              Credential handle claimed by context
      acceptor.
                              Specify GSS_C_NO_CREDENTIAL to use default
                              credentials.  If GSS_C_NO_CREDENTIAL is
                              specified, but the caller has no default
                              credentials established, an
                              implementation-defined default credential
                              may be used.

      input_token_buffer      buffer, opaque, read
                              token obtained from remote application

      input_chan_bindings     channel bindings, read
                              Application-specified bindings.  Allows
                              application to securely bind channel
                              identification information to the security
                              context.

      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
                        Security mechanism used.  The returned
                        OID value will be a pointer into static
                        storage, and should be treated as read-only
                        by the caller.

      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.

      ret_flags         bit-mask, modify
                        Contains six independent flags, each of
                        which indicates that the context supports a
                        specific service option.  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 signed or sealed messages
                                     will be detected
                              False - replayed messages will not be
                                      detected
                        GSS_C_SEQUENCE_FLAG
                              True - out-of-sequence signed or sealed
                                     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 seal routine
                              False - No confidentiality service (via
                                      seal) available. seal 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_sign or
                                     gss_seal routines.
                              False - Per-message integrity service
                                      unavailable.

      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
                        credential handle for credentials received from
                        context initiator.  Only valid if deleg_flag in
                        ret_flags is true.

      minor_status      integer, modify
                        Mechanism specific status code.

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

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 signature.

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_FAILURE Failure. See minor_status for more information.

3.5. gss_process_context_token​

      OM_uint32  gss_process_context_token (
OM_uint32 * minor_status,
gss_ctx_id_t context_handle,
gss_buffer_t token_buffer)

目的:

トークンをセキュリティ・サービスへ渡す手段を提供する。通常、トークンはコンテキストの確立 (その場合は gss_init_sec_context または gss_accept_sec_context へ渡される) またはメッセージごとのセキュリティ・サービス (その場合は gss_verify または gss_unseal へ渡される) に関連付けられる。トークンはそれ以外の時点で受信されることもあり、gss_process_context_token はそのようなトークンを下位のセキュリティ・サービスへ渡して処理させることを可能にする。現在、そのような追加のトークンは gss_delete_sec_context によってのみ生成されうる。GSSAPI 実装は、セキュリティ・コンテキストの削除を実装するためにこのサービスを利用してもよい。

パラメーター:

      context_handle    gss_ctx_id_t, read
context handle of context on which token is to
be processed

token_buffer buffer, opaque, read
pointer to first byte of token to process

minor_status integer, modify
Implementation specific status code.

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks
performed on the token failed

GSS_S_FAILURE Failure. See minor_status for more information

GSS_S_NO_CONTEXT The context_handle did not refer to a valid
context

3.6. 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)

目的:

セキュリティ・コンテキストを削除する。gss_delete_sec_context は、指定されたセキュリティ・コンテキストに関連付けられたローカルなデータ構造を削除し、output_token を生成する。これをピアの gss_process_context_token へ渡すと、ピア側も同様に削除するよう指示される。context_handle で指定されたコンテキストを用いて、それ以上セキュリティ・サービスを得ることはできない。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code.

context_handle gss_ctx_id_t, modify
context handle identifying context to delete.

output_token buffer, opaque, modify
token to be sent to remote application to
instruct it to also delete the context

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_FAILURE Failure, see minor_status for more information

GSS_S_NO_CONTEXT No valid context was supplied

3.7. gss_context_time​

      OM_uint32  gss_context_time (
OM_uint32 * minor_status,
gss_ctx_id_t context_handle,
OM_uint32 * time_rec)
Purpose:

指定されたコンテキストが有効であり続ける秒数を求める。

      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_CREDENTIALS_EXPIRED The context is recognized, but
associated credentials have expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify a
valid context

3.8. gss_sign​

      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 msg_token)
Purpose:

指定されたメッセージに対して暗号学的署名を生成し、その署名をピア・アプリケーションへ転送するためのトークンに格納する。qop_req パラメーターは、選択されたメカニズムがサポートする場合、複数の暗号アルゴリズムの中から選択できるようにする。

パラメーター:

      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 integer, 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_sign will return a
major_status of GSS_S_FAILURE.

message_buffer buffer, opaque, read
message to be signed

msg_token buffer, opaque, modify
buffer to receive token

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
associated credentials have expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify a
valid context

GSS_S_FAILURE Failure. See minor_status for more information.

3.9. gss_verify​

      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)
Purpose:

token パラメーターに含まれる暗号学的署名が、指定されたメッセージに適合することを検証する。qop_state パラメーターにより、メッセージ受信者はそのメッセージに適用された保護の強度を知ることができる。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code.

context_handle gss_ctx_id_t, read
identifies the context on which the message
arrived

message_buffer buffer, opaque, read
message to be verified

token_buffer buffer, opaque, read
token associated with message

qop_state integer, modify
quality of protection gained from signature

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_DEFECTIVE_TOKEN The token failed consistency checks

GSS_S_BAD_SIG The signature was incorrect

GSS_S_DUPLICATE_TOKEN The token was valid, and contained a correct
signature for the message, but it had already
been processed

GSS_S_OLD_TOKEN The token was valid, and contained a correct
signature for the message, but it is too old

GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
signature for the message, but has been
verified out of sequence; an earlier token has
been signed or sealed by the remote
application, but not yet been processed
locally.

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
associated credentials have expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify a
valid context

GSS_S_FAILURE Failure. See minor_status for more information.

3.10. gss_seal​

      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)

目的:

指定された input_message に暗号学的署名を付け、必要に応じて暗号化する。output_message には署名とメッセージの両方が含まれる。qop_req パラメーターは、選択されたメカニズムがサポートする場合、複数の暗号アルゴリズムの中から選択できるようにする。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code.

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

conf_req_flag boolean, read
True - Both confidentiality and integrity
services are requested
False - Only integrity service is requested

qop_req integer, read, optional
Specifies required quality of protection. A
mechanism-specific default may be requested by
setting qop_req to GSS_C_QOP_DEFAULT. If an
unsupported protection strength is requested,
gss_seal will return a major_status of
GSS_S_FAILURE.

input_message_buffer buffer, opaque, read
message to be sealed

conf_state boolean, modify
True - Confidentiality, data origin
authentication and integrity services
have been applied
False - Integrity and data origin services only
has been applied.

output_message_buffer buffer, opaque, modify
buffer to receive sealed message

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
associated credentials have expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify a
valid context

GSS_S_FAILURE Failure. See minor_status for more information.

3.11. gss_unseal​

      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)

目的:

以前にシールされたメッセージを、埋め込まれた署名を検証しつつ使用可能な形式へ戻す。conf_state パラメーターはメッセージが暗号化されていたかどうかを示し、qop_state パラメーターは機密性と完全性のサービスを提供するために用いられた保護の強度を示す。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code.

context_handle gss_ctx_id_t, read
identifies the context on which the message
arrived

input_message_buffer buffer, opaque, read
sealed message

output_message_buffer buffer, opaque, modify
buffer to receive unsealed message

conf_state boolean, modify
True - Confidentiality and integrity protection
were used
False - Inteegrity service only was used

qop_state integer, modify
quality of protection gained from signature

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_DEFECTIVE_TOKEN The token failed consistency checks

GSS_S_BAD_SIG The signature was incorrect

GSS_S_DUPLICATE_TOKEN The token was valid, and contained a
correct signature for the message, but it had
already been processed

GSS_S_OLD_TOKEN The token was valid, and contained a correct
signature for the message, but it is too old

GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
signature for the message, but has been
verified out of sequence; an earlier token has
been signed or sealed by the remote
application, but not yet been processed
locally.

GSS_S_CONTEXT_EXPIRED The context has already expired

GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
associated credentials have expired

GSS_S_NO_CONTEXT The context_handle parameter did not identify a
valid context

GSS_S_FAILURE Failure. See minor_status for more information.

3.12. gss_display_status​

      OM_uint32  gss_display_status (
OM_uint32 * minor_status,
int status_value,
int status_type,
gss_OID mech_type,
int * message_context,
gss_buffer_t status_string)

目的:

GSSAPI 状態コードのテキスト表現を取得し、ユーザーへの表示やログ記録に利用できるようにする。一部の状態値は複数のエラーを示すことがあるため、アプリケーションは gss_display_status を複数回呼び出し、各呼び出しで 1 つのテキスト文字列を生成する必要がある場合がある。message_context パラメーターは、与えられた status_value からどのエラー・メッセージを抽出すべきかを示すために用いられる。message_context は 0 に初期化すべきであり、抽出すべきメッセージがさらに存在する場合、gss_display_status は 0 以外の値を返す。

パラメーター:

      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_NULL_OID to
obtain the system default.

message_context integer, read/modify
Should be initialized to zero by caller

on first call. If further messages are
contained in the status_value parameter,
message_context will be non-zero on return,
and this value should be passed back to
subsequent calls, along with the same
status_value, status_type and mech_type
parameters.

status_string buffer, character string, modify
textual interpretation of the status_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.

3.13. gss_indicate_mechs​

      OM_uint32  gss_indicate_mechs (
OM_uint32 * minor_status,
gss_OID_set * mech_set)

目的:

         Allows an application to determine which underlying security
mechanisms are available.

パラメーター:

      minor_status      integer, modify
Mechanism specific status code.

mech_set set of Object IDs, modify
set of implementation-supported mechanisms.
The returned gss_OID_set value will be a
pointer into static storage, and should be
treated as read-only by the caller.

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

3.14. gss_compare_name​

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

目的:

2 つの内部形式の名前を比較し、それらが同じ実体を指すかどうかを判定できるようにする。

パラメーター:

      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
True - names refer to same entity
False - 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 type contained within either name1 or
name2 was unrecognized, or the names were of
incomparable types.

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

3.15. gss_display_name​

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

目的:

不透明な内部形式の名前のテキスト表現を取得し、表示に利用できるようにする。印刷可能な名前の構文は GSSAPI 実装によって定義される。

パラメーター:

      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

output_name_type Object ID, modify
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

戻り値:

      GSS status code:

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAMETYPE The type of input_name was not recognized

GSS_S_BAD_NAME input_name was ill-formed

3.16. gss_import_name​

      OM_uint32 gss_import_name (
OM_uint32 * minor_status,
gss_buffer_t input_name_buffer,
gss_OID input_name_type,
gss_name_t * output_name)

目的:

印刷可能な名前を内部形式へ変換する。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code

input_name_buffer buffer, character-string, read
buffer containing printable name to convert

input_name_type Object ID, read, optional
Object Id specifying type of printable
name. Applications may specify either
GSS_C_NULL_OID to use a local system-specific
printable syntax, or an OID registered by the
GSSAPI implementation to name a particular
namespace.

output_name gss_name_t, modify
returned name in internal form

戻り値:

      GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAMETYPE The input_name_type was unrecognized

GSS_S_BAD_NAME The input_name parameter could not be
interpreted as a name of the specified type

3.17. gss_release_name​

      OM_uint32 gss_release_name (
OM_uint32 * minor_status,
gss_name_t * name)

目的:

内部形式の名前に関連付けられた、GSSAPI が割り当てた記憶領域を解放する。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code

name gss_name_t, modify
The name to be deleted

戻り値:

      GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_BAD_NAME The name parameter did not contain a valid name

3.18. gss_release_buffer​

      OM_uint32 gss_release_buffer (
OM_uint32 * minor_status,
gss_buffer_t buffer)

目的:

バッファー形式の名前に関連付けられた記憶領域を解放する。その記憶領域は GSSAPI ルーチンによって割り当てられていなければならない。関連付けられた記憶領域を解放することに加えて、このルーチンは buffer パラメーターの length フィールドをゼロにする。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code

buffer buffer, modify
The storage associated with the buffer will be
deleted. The gss_buffer_desc object will not
be freed, but its length field will be zeroed.

戻り値:

      GSS status code

GSS_S_COMPLETE Successful completion

3.19. gss_release_oid_set​

      OM_uint32 gss_release_oid_set (
OM_uint32 * minor_status,
gss_OID_set * set)

目的:

gss_OID_set オブジェクトに関連付けられた記憶領域を解放する。その記憶領域は GSSAPI ルーチンによって割り当てられていなければならない。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code

set Set of Object IDs, modify
The storage associated with the gss_OID_set
will be deleted.

戻り値:

      GSS status code

GSS_S_COMPLETE Successful completion

3.20. gss_inquire_cred​

      OM_uint32 gss_inquire_cred (
OM_uint32 * minor_status,
gss_cred_id_t cred_handle,
gss_name_t * name,
OM_uint32 * lifetime,
int * cred_usage,
gss_OID_set * mechanisms )

目的:

資格情報に関する情報を取得する。呼び出し側は、対象の資格情報を指すハンドルをすでに取得していなければならない。

パラメーター:

      minor_status      integer, modify
Mechanism specific status code

cred_handle gss_cred_id_t, read
A handle that refers to the target credential.
Specify GSS_C_NO_CREDENTIAL to inquire about
the default credential.

name gss_name_t, modify
The name whose identity the credential asserts.
Specify NULL if not required.

lifetime Integer, modify

The number of seconds for which the credential
will remain valid. If the credential has
expired, this parameter will be set to zero.
If the implementation does not support
credential expiration, the value
GSS_C_INDEFINITE will be returned. Specify
NULL if not required.

cred_usage Integer, modify
How the credential may be used. One of the
following:
GSS_C_INITIATE
GSS_C_ACCEPT
GSS_C_BOTH
Specify NULL if not required.

mechanisms gss_OID_set, modify
Set of mechanisms supported by the credential.
Specify NULL if not required.

戻り値:

      GSS status code

GSS_S_COMPLETE Successful completion

GSS_S_NO_CRED The referenced credentials could not be
accessed.

GSS_S_DEFECTIVE_CREDENTIAL The referenced credentials were
invalid.

GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.
If the lifetime parameter was not passed as
NULL, it will be set to 0.
  #ifndef GSSAPI_H_
  #define GSSAPI_H_

  /*
   * First, define the platform-dependent types.
   */
  typedef <platform-specific> OM_uint32;
  typedef <platform-specific> gss_ctx_id_t;
  typedef <platform-specific> gss_cred_id_t;
  typedef <platform-specific> gss_name_t;



  /*
   * Note that a platform supporting the xom.h X/Open header file
   * may make use of that header for the definitions of OM_uint32
   * and the structure to which gss_OID_desc equates.
   */

  typedef struct gss_OID_desc_struct {
        OM_uint32 length;
        void      *elements;
  } gss_OID_desc, *gss_OID;

  typedef struct gss_OID_set_desc_struct  {
        int     count;
        gss_OID elements;
  } gss_OID_set_desc, *gss_OID_set;

  typedef struct gss_buffer_desc_struct {
        size_t length;
        void *value;
  } gss_buffer_desc, *gss_buffer_t;

  typedef struct gss_channel_bindings_struct {
        OM_uint32 initiator_addrtype;
        gss_buffer_desc initiator_address;
        OM_uint32 acceptor_addrtype;
        gss_buffer_desc acceptor_address;
        gss_buffer_desc application_data;
  } *gss_channel_bindings_t;

  /*
   * Six independent flags each of which indicates that a context
   * supports a specific service option.
   */
  #define GSS_C_DELEG_FLAG 1
  #define GSS_C_MUTUAL_FLAG 2
  #define GSS_C_REPLAY_FLAG 4
  #define GSS_C_SEQUENCE_FLAG 8
  #define GSS_C_CONF_FLAG 16
  #define GSS_C_INTEG_FLAG 32

  /*
   * Credential usage options
   */
  #define GSS_C_BOTH 0
  #define GSS_C_INITIATE 1
  #define GSS_C_ACCEPT 2



  /*
   * Status code types for gss_display_status
   */
  #define GSS_C_GSS_CODE 1
  #define GSS_C_MECH_CODE 2

  /*
   * The constant definitions for channel-bindings address families
   */
  #define GSS_C_AF_UNSPEC     0;
  #define GSS_C_AF_LOCAL      1;
  #define GSS_C_AF_INET       2;
  #define GSS_C_AF_IMPLINK    3;
  #define GSS_C_AF_PUP        4;
  #define GSS_C_AF_CHAOS      5;
  #define GSS_C_AF_NS         6;
  #define GSS_C_AF_NBS        7;
  #define GSS_C_AF_ECMA       8;
  #define GSS_C_AF_DATAKIT    9;
  #define GSS_C_AF_CCITT      10;
  #define GSS_C_AF_SNA        11;
  #define GSS_C_AF_DECnet     12;
  #define GSS_C_AF_DLI        13;
  #define GSS_C_AF_LAT        14;
  #define GSS_C_AF_HYLINK     15;
  #define GSS_C_AF_APPLETALK  16;
  #define GSS_C_AF_BSC        17;
  #define GSS_C_AF_DSS        18;
  #define GSS_C_AF_OSI        19;
  #define GSS_C_AF_X25        21;

  #define GSS_C_AF_NULLADDR   255;

  #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
  #define GSS_C_NULL_OID ((gss_OID) 0)
  #define GSS_C_NULL_OID_SET ((gss_OID_set) 0)
  #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
  #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
  #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
  #define GSS_C_EMPTY_BUFFER {0, NULL}

  /*
   * Define the default Quality of Protection for per-message
   * services.  Note that an implementation that offers multiple
   * levels of QOP may either reserve a value (for example zero,
   * as assumed here) to mean "default protection", or alternatively
   * may simply equate GSS_C_QOP_DEFAULT to a specific explicit QOP
   * value.



   */
  #define GSS_C_QOP_DEFAULT 0

  /*
   * Expiration time of 2^32-1 seconds means infinite lifetime for a
   * credential or security context
   */
  #define GSS_C_INDEFINITE 0xfffffffful

  /* Major status codes */

  #define GSS_S_COMPLETE 0

  /*
   * Some "helper" definitions to make the status code macros obvious.
   */
  #define GSS_C_CALLING_ERROR_OFFSET 24
  #define GSS_C_ROUTINE_ERROR_OFFSET 16
  #define GSS_C_SUPPLEMENTARY_OFFSET 0
  #define GSS_C_CALLING_ERROR_MASK 0377ul
  #define GSS_C_ROUTINE_ERROR_MASK 0377ul
  #define GSS_C_SUPPLEMENTARY_MASK 0177777ul

  /*
   * The macros that test status codes for error conditions
   */
  #define GSS_CALLING_ERROR(x) \
    (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
  #define GSS_ROUTINE_ERROR(x) \
    (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
  #define GSS_SUPPLEMENTARY_INFO(x) \
    (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
  #define GSS_ERROR(x) \
    ((GSS_CALLING_ERROR(x) != 0) || (GSS_ROUTINE_ERROR(x) != 0))

  /*
   * Now the actual status code definitions
   */

  /*
   * Calling errors:
   */
  #define GSS_S_CALL_INACCESSIBLE_READ \
                               (1ul << GSS_C_CALLING_ERROR_OFFSET)
  #define GSS_S_CALL_INACCESSIBLE_WRITE \
                               (2ul << GSS_C_CALLING_ERROR_OFFSET)



  #define GSS_S_CALL_BAD_STRUCTURE \
                               (3ul << GSS_C_CALLING_ERROR_OFFSET)

  /*
   * Routine errors:
   */
  #define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
  #define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET)

  /*
   * Supplementary info bits:
   */
  #define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
  #define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
  #define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
  #define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))

  /*
   * Finally, function prototypes for the GSSAPI routines.
   */

  OM_uint32 gss_acquire_cred
             (OM_uint32*,       /* minor_status */
              gss_name_t,       /* desired_name */
              OM_uint32,        /* time_req */
              gss_OID_set,      /* desired_mechs */
              int,              /* cred_usage */
              gss_cred_id_t*,   /* output_cred_handle */
              gss_OID_set*,     /* actual_mechs */
              OM_uint32*        /* time_rec */
             );

  OM_uint32 gss_release_cred,
             (OM_uint32*,       /* minor_status */
              gss_cred_id_t*    /* cred_handle */
             );



  OM_uint32 gss_init_sec_context
             (OM_uint32*,       /* minor_status */
              gss_cred_id_t,    /* claimant_cred_handle */
              gss_ctx_id_t*,    /* context_handle */
              gss_name_t,       /* target_name */
              gss_OID,          /* mech_type */
              int,              /* req_flags */
              OM_uint32,        /* time_req */
              gss_channel_bindings_t,
                                /* input_chan_bindings */
              gss_buffer_t,     /* input_token */
              gss_OID*,         /* actual_mech_type */
              gss_buffer_t,     /* output_token */
              int*,             /* ret_flags */
              OM_uint32*        /* time_rec */
             );

  OM_uint32 gss_accept_sec_context
             (OM_uint32*,       /* minor_status */
              gss_ctx_id_t*,    /* context_handle */
              gss_cred_id_t,    /* verifier_cred_handle */
              gss_buffer_t,     /* input_token_buffer */
              gss_channel_bindings_t,
                                /* input_chan_bindings */
              gss_name_t*,      /* src_name */
              gss_OID*,         /* mech_type */
              gss_buffer_t,     /* output_token */
              int*,             /* ret_flags */
              OM_uint32*,       /* time_rec */
              gss_cred_id_t*    /* delegated_cred_handle */
             );

  OM_uint32 gss_process_context_token
             (OM_uint32*,       /* minor_status */
              gss_ctx_id_t,     /* context_handle */
              gss_buffer_t      /* token_buffer */
             );

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



  OM_uint32 gss_context_time
             (OM_uint32*,       /* minor_status */
              gss_ctx_id_t,     /* context_handle */
              OM_uint32*        /* time_rec */
             );

  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_uitn32 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_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_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_display_status
             (OM_uint32*,       /* minor_status */
              OM_uint32,        /* status_value */
              int,              /* status_type */
              gss_OID,          /* mech_type */
              int*,             /* message_context */
              gss_buffer_t      /* status_string */
             );

  OM_uint32 gss_indicate_mechs
             (OM_uint32*,       /* minor_status */
              gss_OID_set*      /* mech_set */
             );

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

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

  OM_uint32 gss_import_name
             (OM_uint32*,       /* minor_status */
              gss_buffer_t,     /* input_name_buffer */
              gss_OID,          /* input_name_type */
              gss_name_t*       /* output_name */
             );

  OM_uint32 gss_release_name
             (OM_uint32*,       /* minor_status */
              gss_name_t*       /* input_name */
             );

  OM_uint32 gss_release_buffer
             (OM_uint32*,       /* minor_status */
              gss_buffer_t      /* buffer */
             );

  OM_uint32 gss_release_oid_set
             (OM_uint32*,       /* minor_status */
              gss_OID_set*      /* set */



             );

  OM_uint32 gss_inquire_cred
             (OM_uint32 *,      /* minor_status */
              gss_cred_id_t,    /* cred_handle */
              gss_name_t *,     /* name */
              OM_uint32 *,      /* lifetime */
              int *,            /* cred_usage */
              gss_OID_set *     /* mechanisms */
             );

  #endif /* GSSAPI_H_ */