IAIK PKCS#11 Wrapper
version 1.5

iaik.pkcs.pkcs11
Interface MutexHandler

All Known Implementing Classes:
DefaultMutexHandler

public interface MutexHandler

Objects that implement this interface can be used in the InitializeArgs to handle mutex functionality.

Version:
1.0
Author:
Karl Scheibelhofer

Method Summary
 java.lang.Object createMutex()
          Create a new mutex object.
 void destroyMutex(java.lang.Object mutex)
          Destroy a mutex object.
 void lockMutex(java.lang.Object mutex)
          If this method is called on with a mutex object which is not locked, the calling thread obtains a lock on that mutex object and returns.
 void unlockMutex(java.lang.Object mutex)
          If this method is called with a mutex object which is locked by the calling thread, that mutex object is unlocked and the function call returns.
 

Method Detail

createMutex

public java.lang.Object createMutex()
                             throws PKCS11Exception
Create a new mutex object.
Returns:
The new mutex object.
Throws:
PKCS11Exception - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.

destroyMutex

public void destroyMutex(java.lang.Object mutex)
                  throws PKCS11Exception
Destroy a mutex object.
Parameters:
mutex - The mutex object to destroy.
Throws:
PKCS11Exception - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.

lockMutex

public void lockMutex(java.lang.Object mutex)
               throws PKCS11Exception
If this method is called on with a mutex object which is not locked, the calling thread obtains a lock on that mutex object and returns. If this method is called with a mutex object which is locked by some thread other than the calling thread, the calling thread blocks and waits for that mutex to be unlocked. If this method is called with a a mutex object which is locked by the calling + thread, the behavior of this method call is undefined.
Parameters:
mutex - The mutex object to lock.
Throws:
PKCS11Exception - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.

unlockMutex

public void unlockMutex(java.lang.Object mutex)
                 throws PKCS11Exception
If this method is called with a mutex object which is locked by the calling thread, that mutex object is unlocked and the function call returns. Furthermore: If exactly one thread was blocking on that particular mutex object, then that thread stops blocking, obtains a lock on that mutex object, and its lockMutex(Object) call returns. If more than one thread was blocking on that particular mutex objet, then exactly one of the blocking threads is selected somehow. That lucky thread stops blocking, obtains a lock on the mutex object, and its lockMutex(Object) call returns. All other threads blocking on that particular mutex object continue to block. If this method is called with a mutex object which is not locked, then the method call throws an exception with the error code PKCS11Constants.CKR_MUTEX_NOT_LOCKED. If this method is called with a mutex object which is locked by some thread other than the calling thread, the behavior of this method call is undefined.
Parameters:
mutex - The mutex object to unlock.
Throws:
PKCS11Exception - If the wrapper should return a differnet value than CKR_OK to the library. It gets the error-code and returns it as CK_RV.

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