Package pyGlobus :: Module security :: Class GSSContext
[show private | hide private]
[frames | no frames]

Class GSSContext


A class for the underlying gss_ctx_id_t object.
Method Summary
  __init__(self, handle, free)
Constructs an instance.
  __del__(self)
Destroys an instance.
  accept_context(self, acceptor_cred, inputTokenString)
Return major and minor status error codes from the GSSAPI.
  get_handle(self)
  get_mic(self, messageString)
A context must be created with init_context or accept_context before this call is made.
  init_context(self, init_cred, target_name, inputTokenString, requests)
Tries to establish a security context with a server
  inquire(self)
Obtain information about the context.
  unwrap(self, messageString)
A context must be created with init_context or accept_context before this call is made
  verify_mic(self, messageString, micString)
A context must be created with init_context or accept_context before this call is made
  wrap(self, messageString)
A context must be created with init_context or accept_context before this call is made

Method Details

__init__(self, handle=None, free=1)
(Constructor)

Constructs an instance.

Each instance wraps a gss_ctx_id_t object. Defaults to a GSS_C_NO_CONTEXT
Parameters:
handle - An optional argument that, if present, should contain a SWIG'ized pointer to a gss_ctx_id_t object.
free - Should the underlying gss_ctx_id_t object be freed when an instance is destroyed.

__del__(self)
(Destructor)

Destroys an instance.

Deletes the underlying gss_ctx_id_t object, and free's the memory if the instance owns the underlying handle.

accept_context(self, acceptor_cred, inputTokenString)

Parameters:
acceptor_cred - is a GSSCred object which contains the credential that the acceptor will use to authenticate itself
inputTokenString - is a token received from the corresponding init_sec call
Returns:
major and minor status error codes from the GSSAPI. A string of tokens which represent credentials from the client who is initiating the context.
Raises:
GSSContextException - A GSSContextException is raised if an error occurs in the underlying gss-api call.

get_mic(self, messageString)

A context must be created with init_context or accept_context before this call is made.
Parameters:
messageString - - A Python string of the message you want to create a MIC (message integrity code) for.
Returns:
A Python string of a MIC that was created is returned
Raises:
GSSContextException - A GSSContextException is raised if the mic cannot be created

init_context(self, init_cred, target_name, inputTokenString='', requests=None)

Tries to establish a security context with a server
Parameters:
init_cred - is a GSSCred object which contains the client's credential handle
target_name - is a GSSName object
inputTokenString - is a string of tokens, received from the server or "", if this is the first time init_context has been called.
requests - is a ContextRequests object
Returns:
major and minor status error codes from the GSSAPI. A string of tokens which represent credentials from the client who is initiating the context.
Raises:
GSSContextException - A GSSContextException is raised if an error occurs in the underlying gss-api call.

inquire(self)

Obtain information about the context.
Returns:
A 7-tuple containing: A GSSName object containing the initiators name, A GSSName object with the acceptors name. An int containing the number of seconds the context will remain valid for. A string containing a SWIG'ized pointer to a static gss_OID struct containing the mechanism type. An int containing the context flags. A bool indicating if the connection was initiated locally. A bool indicating if the connection is currently open.
Raises:
GSSContextException - A GSSContextException is raised if an error occurs in the underlying gss-api call.

unwrap(self, messageString)

A context must be created with init_context or accept_context before this call is made
  • *messageString* - A Python str of a message that will be unwrapped
Returns:
A Python string which is the unwrapped message
Raises:
GSSContextException - A GSSContextException is raised if there is a problem unwrapping the message

verify_mic(self, messageString, micString)

A context must be created with init_context or accept_context before this call is made
Parameters:
messageString - - A Python string of the message you want verified
micString - - A Python string that contains the cryptographic mic of the message
Returns:
A Python int 1 if the mic has been verified, returns 0 if the MIC was incorrect
Raises:
GSSContextException - A GSSContextException is raised if the mic cannot be verified

wrap(self, messageString)

A context must be created with init_context or accept_context before this call is made
Parameters:
messageString - - A Python str of a message that will be wrapped
Returns:
A Python string which is the wrapped message
Raises:
GSSContextException - A GSSContextException is raised if there is a problem wrapping the message

Generated by Epydoc 2.1 on Tue Apr 4 14:32:56 2006 http://epydoc.sf.net