org.mozilla.jss
Class NSSInit

java.lang.Object
  |
  +--org.mozilla.jss.NSSInit

public final class NSSInit
extends java.lang.Object

This class initializes Java NSS and sets up the password callback.


Field Summary
static java.lang.String JAR_DBM_VERSION
           
static java.lang.String JAR_JDK_VERSION
           
static java.lang.String JAR_JSS_VERSION
           
static java.lang.String JAR_NSPR_VERSION
           
static java.lang.String JAR_NSS_VERSION
           
 
Constructor Summary
NSSInit()
           
 
Method Summary
static void initialize(java.lang.String modDBName, java.lang.String keyDBName, java.lang.String certDBName)
          Initialize Java NSS.
static boolean isInitialized()
          Indicates whether Java NSS has been initialized.
static void setPasswordCallback(PasswordCallback cb)
          Sets the password callback.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAR_JSS_VERSION

public static final java.lang.String JAR_JSS_VERSION

JAR_JDK_VERSION

public static final java.lang.String JAR_JDK_VERSION

JAR_NSS_VERSION

public static final java.lang.String JAR_NSS_VERSION

JAR_DBM_VERSION

public static final java.lang.String JAR_DBM_VERSION

JAR_NSPR_VERSION

public static final java.lang.String JAR_NSPR_VERSION
Constructor Detail

NSSInit

public NSSInit()
Method Detail

initialize

public static void initialize(java.lang.String modDBName,
                              java.lang.String keyDBName,
                              java.lang.String certDBName)
                       throws KeyDatabaseException,
                              CertDatabaseException,
                              AlreadyInitializedException
Initialize Java NSS. This method opens the security module, key, and certificate databases and initializes the Random Number Generator. The certificate and key databases are opened in read-only mode.

This method also attempts to load the native implementation library. On UNIX systems, this library is named libjss.so, and it must be present in the LD_LIBRARY_PATH. On Windows systems, the library is named jss.dll and must be present in the PATH. If the library cannot be found, an UnsatisfiedLinkError is thrown.

This method should only be called once by an application, otherwise an AlreadyInitializedException will be thrown.

Parameters:
modDBName - The complete path, relative or absolute, of the security module database. If it does not exist, it will be created.
keyDBName - The complete path, relative or absolute, of the key database. It must already exist.
certDBName - The complete path, relative or absolute, of the certificate database. It must already exist.
Throws:
KeyDatabaseException - If the key database does not exist or cannot be opened.
CertDatabaseException - If the certificate database does not exist or cannot be opened.
AlreadyInitializedException - If this method has already been called.
UnsatisfiedLinkError - If the implementation dynamic library cannot be found or loaded.

isInitialized

public static boolean isInitialized()
Indicates whether Java NSS has been initialized.
Returns:
true if initialize has been called, false otherwise.

setPasswordCallback

public static void setPasswordCallback(PasswordCallback cb)
Sets the password callback. This password callback will be called when access is required to the key database, and to any PKCS #11 token. Once a token has been logged into successfully, it is not necessary to login to that token again. By default, a ConsolePasswordCallback is used to obtain passwords from the console.

This method may be called multiple times to alter the password callback.

See Also:
PasswordCallback, ConsolePasswordCallback