com.rsa.jsafe
Class JSAFE_PKCS11SessionSpec

java.lang.Object
  extended bycom.rsa.jsafe.JSAFE_SessionSpec
      extended bycom.rsa.jsafe.JSAFE_PKCS11SessionSpec

public final class JSAFE_PKCS11SessionSpec
extends JSAFE_SessionSpec

This class specifies how to instantiate a JSAFE_Session object that establishes a session with a PKCS #11-compliant device.

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

Since:
Crypto-J 3.2 Copyright © RSA Security Inc., 1997-2005. All rights reserved.
See Also:
JSAFE_Session

Constructor Summary
JSAFE_PKCS11SessionSpec(String libraryName, String tokenLabel, char[] password, int offset, int len)

Specifies how to instantiate a JSAFE_Session object that establishes a session with a token via the specified PKCS #11 library.

 
Method Summary

 void

clearSensitiveData()

This method clears sensitive data from an object.

 void

deobfuscate()

De-obfuscates sensitive data to use it.

 byte[]

getCryptokiFunctions(JSAFE_Session theSession)

Points a function list pointer to the list of Cryptoki functions.

 com.rsa.jsafe.JSAFE_DeviceBuilder[]

getDeviceBuilders()

Gets the device builder or builders associated with this specification.

 String

getLibraryName()

Gets the name of the shared library that is the PKCS #11 library for the token.

 byte[]

getPassPhrase()

Gets the passphrase as a byte array.

 byte[]

getSessionHandle(JSAFE_Session theSession)

Converts the native element session handle to a Java byte array for storage.

 String

getTokenLabel()

Gets the token label passed in at construction.

 String

getTokenLabel(JSAFE_Session theSession)

Gets the name of the token's label.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSAFE_PKCS11SessionSpec

public JSAFE_PKCS11SessionSpec(String libraryName,
                               String tokenLabel,
                               char[] password,
                               int offset,
                               int len)
Specifies how to instantiate a JSAFE_Session object that establishes a session with a token via the specified PKCS #11 library.

Parameters:
libraryName - The name of the PKCS #11 vendor-supplied shared library.
tokenLabel - The token label, at most 32 characters. If no label is specified, Crypto-J uses the first token it finds.
password - The user PIN or passphrase.
offset - The user PIN starts here.
len - The user PIN length.
Method Detail

getDeviceBuilders

public com.rsa.jsafe.JSAFE_DeviceBuilder[] getDeviceBuilders()
Gets the device builder or builders associated with this specification. The return value is an array of builders, but the return will likely be 1. The array is there in case it is needed.

Specified by:
getDeviceBuilders in class JSAFE_SessionSpec
Returns:
The DeviceBuilder array for this SessionSpec.

getSessionHandle

public byte[] getSessionHandle(JSAFE_Session theSession)
Converts the native element session handle to a Java byte array for storage. This routine returns that byte array.

Parameters:
theSession - The JSAFE_Session this specification helped build.
Returns:
The byte array holding the session handle. The return can be null if theSession is null, or is not the session associated with this specification.

getCryptokiFunctions

public byte[] getCryptokiFunctions(JSAFE_Session theSession)
Points a function list pointer to the list of Cryptoki functions. This pointer is a native element converted to a Java byte array for storage. This routine returns that byte array.

Parameters:
theSession - The JSAFE_Session this specification helped build.
Returns:
The byte array holding the function list pointer. The return can be null if theSession is null, or is not the session associated with this specification.

getLibraryName

public String getLibraryName()
Gets the name of the shared library that is the PKCS #11 library for the token.

Returns:
A String that is the name of the library.

getTokenLabel

public String getTokenLabel()
Gets the token label passed in at construction.

Returns:
A String that is the token's label.

getTokenLabel

public String getTokenLabel(JSAFE_Session theSession)
Gets the name of the token's label.

Parameters:
theSession - The JSAFE_Session this specification helped build.
Returns:
A String that is the token's label.

getPassPhrase

public byte[] getPassPhrase()
Gets the passphrase as a byte array.

Returns:
A new byte array that is the passphrase.

deobfuscate

public void deobfuscate()
De-obfuscates sensitive data to use it.


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.

Specified by:
clearSensitiveData in class JSAFE_SessionSpec


RSA BSAFE Crypto-J 3.5.2