IAIK PKCS#11 Wrapper
version 1.5

iaik.pkcs.pkcs11.wrapper
Class PKCS11Connector

java.lang.Object
  |
  +--iaik.pkcs.pkcs11.wrapper.PKCS11Connector

public class PKCS11Connector
extends java.lang.Object

This class is a sort of factory to get a implementation of the PKCS11 interface. By now, this method simply instanciates PKCS11Implementation. For future version, it can be extended to support different implementations for different versions of PKCS#11.

Author:
Karl Scheibelhofer, Martin Schläffer

Constructor Summary
protected PKCS11Connector()
          Empty constructor for internal use only.
 
Method Summary
static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath)
          Connect to a PKCS#11 module and get an interface to it.
static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath, boolean wrapperDebugVersion)
          Connect to a PKCS#11 module and get an interface to it.
static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath, java.lang.String pkcs11WrapperPath)
          Connect to a PKCS#11 module with the specified PKCS#11-wrapper native library and get an interface to it.
static void loadWrapperFromJar(boolean wrapperDebugVersion)
          Tries to load the PKCS#11 wrapper native library included in the class path (jar file).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS11Connector

protected PKCS11Connector()
Empty constructor for internal use only.
Method Detail

connectToPKCS11Module

public static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath)
                                    throws java.io.IOException
Connect to a PKCS#11 module and get an interface to it. Tries to load the PKCS#11 wrapper native library from the library path or the class path (jar file).
Parameters:
pkcs11ModulePath - The path to the PKCS#11 library.
Returns:
The interface object to access the PKCS#11 module.
Throws:
java.io.IOException - If finding the module or connecting to it fails.

connectToPKCS11Module

public static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath,
                                           boolean wrapperDebugVersion)
                                    throws java.io.IOException
Connect to a PKCS#11 module and get an interface to it. Tries to load the PKCS#11 wrapper native library from the library path or the class path (jar file). If loaded from the jar file, uses the debug version if wrapperDebugVersion is true.
Parameters:
pkcs11ModulePath - The path to the PKCS#11 library.
wrapperDebugVersion - true, if the PKCS#11 wrapper library's debug version shall be loaded
Returns:
The interface object to access the PKCS#11 module.
Throws:
java.io.IOException - If finding the module or connecting to it fails.

connectToPKCS11Module

public static PKCS11 connectToPKCS11Module(java.lang.String pkcs11ModulePath,
                                           java.lang.String pkcs11WrapperPath)
                                    throws java.io.IOException
Connect to a PKCS#11 module with the specified PKCS#11-wrapper native library and get an interface to it.
Parameters:
pkcs11ModulePath - The path to the PKCS#11 library.
pkcs11WrapperPath - The absolute path to the PKCS#11-wrapper native library including the filename
Returns:
The interface object to access the PKCS#11 module.
Throws:
java.io.IOException - If finding the module or connecting to it fails.

loadWrapperFromJar

public static void loadWrapperFromJar(boolean wrapperDebugVersion)
                               throws java.io.IOException
Tries to load the PKCS#11 wrapper native library included in the class path (jar file). If loaded from the jar file and wrapperDebugVersion is true, uses the included debug version. The found native library is copied to the temporary-file directory and loaded from there.
Parameters:
wrapperDebugVersion - true, if the PKCS#11 wrapper library's debug version shall be loaded
Throws:
java.io.IOException - if the wrapper native library for the system's architecture can't be found in the jar file or if corresponding native library can't be written to temporary directory

IAIK PKCS#11 Wrapper
version 1.5

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/

IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.5