public class Cryptoki
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
CKF_DONT_BLOCK
Flags uses in WaitForSlotEvent to specify that the function shouldn't block.
|
static java.lang.String |
licensee
Gets or sets the name of the licensee supplied in the license file
|
static java.lang.String |
productKey
Gets or sets the product key supplied in the license file
|
Constructor and Description |
---|
Cryptoki()
Creates an instance of Cryptoki
|
Cryptoki(java.lang.String cryptokilib)
Creates an instance of Cryptoki attached to the given native cryptoki library
|
Modifier and Type | Method and Description |
---|---|
void |
attach(java.lang.String cryptokilib)
Attaches this Cryptoki object to the given native cryptoki library .
|
void |
detach()
Detaches this object from the native cryptoki library.
|
int |
finalize(java.lang.Object reserved)
Finalize this cryptoki object and native cryptoki
Finalize is called to indicate that an application is finished with the Cryptoki library.
|
SlotList |
getActiveSlots()
The list of plugged slots with a token inserted.
|
java.lang.String |
getAttachedCryptokiLib()
Gets the attached native cryptoki library
|
CryptokiInfo |
getInfo()
Info related to the underlying native PKCS# Module.
|
SlotList |
getSlots()
The list of plugged slots.
|
static java.lang.String |
getVersion()
Gets the JCryptoki Version
|
int |
initialize()
Inizialize this cryptoki object and native cryptoki
Initialize should be the first Cryptoki call made by an application, except for calls to
What this function actually does is implementation-dependent;
typically, it might cause Cryptoki to initialize its internal memory buffers, or any other
resources it requires.
|
int |
initialize(boolean multithreading)
Inizialize this cryptoki object and native cryptoki
Initialize should be the first Cryptoki call made by an application, except for calls to
What this function actually does is implementation-dependent;
typically, it might cause Cryptoki to initialize its internal memory buffers, or any other
resources it requires.
|
Slot |
waitForSlotEvent(int flags)
Wait for a slot event like smart card insertion or removal
WaitForSlotEvent waits for a slot event, such as token insertion or token removal, to
occur. flags determines whether or not the WaitForSlotEvent call blocks (i.e., waits
for a slot event to occur);
At present, the only flag defined for use in the flags argument is CKF_DONT_BLOCK:
Internally, each Cryptoki application has a flag for each slot which is used to track
whether or not any unrecognized events involving that slot have occurred.
|
public static final int CKF_DONT_BLOCK
public static java.lang.String licensee
public static java.lang.String productKey
public Cryptoki()
public Cryptoki(java.lang.String cryptokilib)
cryptokilib
- Path of the native cryptoki library (without .dll or .so suffix)CryptokiException
- CryptokiException if a native error occurspublic static java.lang.String getVersion()
public void attach(java.lang.String cryptokilib)
cryptokilib
- Path of the native cryptoki library (without .dll or .so suffix)public void detach()
public java.lang.String getAttachedCryptokiLib()
public CryptokiInfo getInfo()
CryptokiException
- CryptokiException if a native error occurspublic SlotList getSlots()
CryptokiException
- CryptokiException if a native error occurspublic SlotList getActiveSlots()
CryptokiException
- CryptokiException if a native error occurspublic int initialize()
CryptokiException
public int initialize(boolean multithreading)
multithreading
- Specifies whether the caller will call NCryptoki functions in more threads or not, as specified in PKCS#11 v.2.20 specifications.public int finalize(java.lang.Object reserved)
reserved
- Reserved paramterspublic Slot waitForSlotEvent(int flags)
flags
- Flags specifing behaviour: CKF_DONT_BLOCK returns without waiting for a slot eventCryptokiException
- CryptokiException if a native error occurs