com.rsa.jsafe
Class JSAFE_Session

java.lang.Object
  extended bycom.rsa.jsafe.JSAFE_Object
      extended bycom.rsa.jsafe.JSAFE_Session
All Implemented Interfaces:
Cloneable, Serializable

public abstract class JSAFE_Session
extends JSAFE_Object

This class establishes a session with a token present in a hardware device. Use it in conjunction with subclasses of JSAFE_SessionSpec.

The JSAFE_Session class describes how to connect to a PKCS #11 device. An instance of this class sets up one of the JSAFE cryptographic transformation objects (RSA and DSA signers, verifiers, key-pair generators, etc.). It then calls on a PKCS #11 device to perform the functionality specified when the object is created. Using an object of this class enables Crypto-J to initialize the PKCS #11 device and create a new session to perform the desired functionality on the device.

Creates and returns an object that encapsulates the information needed to open a session with a token in a device that supports the Cryptoki (PKCS #11) interface.

See Overview of Crypto-J for background and reference material on using and understanding Crypto-J.

Copyright © RSA Security Inc., 1999-2005. All rights reserved.

See Also:
JSAFE_SessionSpec, JSAFE_PKCS11SessionSpec, Serialized Form

Method Summary

 void

clearSensitiveData()

This method clears sensitive data from an object.

 Object

clone()

Duplicates the existing object.

abstract  void

closeSession()

Closes the PKCS #11 session.

abstract  String

getDevice()

Returns the name of the device (such as "PKCS11") for which this session is instantiated.

 Object

getElement(String format)

 

static JSAFE_Session

getInstance(JSAFE_SessionSpec spec)

Builds an object that establishes a session with a hardware token via the specified vendor-supplied shared library, or reuses a previously established session.

 JSAFE_SessionSpec

getSessionSpec()

Gets a reference to the JSAFE_SessionSpec used by this JSAFE_Session object.

 
Methods inherited from class com.rsa.jsafe.JSAFE_Object
overwrite, overwrite
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JSAFE_Session getInstance(JSAFE_SessionSpec spec)
                                 throws JSAFE_UnimplementedException,
                                        JSAFE_InvalidParameterException,
                                        JSAFE_InvalidUseException
Builds an object that establishes a session with a hardware token via the specified vendor-supplied shared library, or reuses a previously established session.

Parameters:
spec - An instance of JSAFE_SessionSpec that specifies how and with which device the connection is established.
Returns:
A JSAFE_Session object that represents a session with a hardware token.
Throws:
JSAFE_UnimplementedException - If a device cannot be found, or the specified token that meets the conditions in the JSAFE_SessionSpec is not available.
JSAFE_InvalidParameterException - If the specified session is null.
JSAFE_InvalidUseException - If no device builders exist for the specified session.
See Also:
JSAFE_SessionSpec, JSAFE_PKCS11SessionSpec

closeSession

public abstract void closeSession()
Closes the PKCS #11 session. Before terminating the program, all sessions must be closed. If the session is already closed, this method does nothing. The method clearSensitiveData() calls this method. The JSAFE_Session objects should be closed in the reverse of the order they were created in.


getDevice

public abstract String getDevice()
Returns the name of the device (such as "PKCS11") for which this session is instantiated.

Returns:
the device name

getSessionSpec

public JSAFE_SessionSpec getSessionSpec()
Gets a reference to the JSAFE_SessionSpec used by this JSAFE_Session object. This is a reference to the JSAFE_SessionSpec passed in during the call to getInstance().

Returns the session specification used to build the system. The session specification may have new information inserted by the session.

Returns:
A reference (not a copy or clone) to the JSAFE_SessionSpec used by this object, the specification passed in during getInstance().

getElement

public Object getElement(String format)

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: JSAFE_Object
Duplicates the existing object.

Overrides:
clone in class JSAFE_Object
Returns:
Return value from superclass clone() method.
Throws:
CloneNotSupportedException

clearSensitiveData

public void clearSensitiveData()
This method clears sensitive data from an object. Although the finalizer clears the data, there is no guarantee the garbage collector will quickly call the finalizer. Allows a user to clear data as soon as possible. After calling clearSensitiveData(), an Init (not a ReInit) method is called to perform other operations with the object.



RSA BSAFE Crypto-J 3.5.2