Search in sources :

Example 1 with CK_C_INITIALIZE_ARGS

use of org.openecard.mdlw.sal.cryptoki.CK_C_INITIALIZE_ARGS in project open-ecard by ecsec.

the class MiddleWareWrapper method initialize.

public void initialize() throws CryptokiException {
    try {
        CK_C_INITIALIZE_ARGS arg = new CK_C_INITIALIZE_ARGS();
        arg.setFlags(CryptokiLibrary.CKF_OS_LOCKING_OK);
        initialize(arg);
        return;
    } catch (CryptokiException ex) {
        LOG.warn("Failed to initialize middleware to perform locking by itself.");
    }
    try {
        CK_C_INITIALIZE_ARGS arg = new CK_C_INITIALIZE_ARGS();
        arg.setFlags(CryptokiLibrary.CKF_OS_LOCKING_OK);
        MutexStore mutexStore = new MutexStore();
        arg.setCreateMutex(mutexStore.getCreateMutexFun());
        arg.setDestroyMutex(mutexStore.getDestroyMutexFun());
        arg.setLockMutex(mutexStore.getLockMutexFun());
        arg.setUnlockMutex(mutexStore.getUnlockMutexFun());
        initialize(arg);
        return;
    } catch (CryptokiException ex) {
        LOG.warn("Failed to initialize middleware to perform locking with Java locks.");
    }
    LOG.warn("Initializing middleware without thread safety values.");
    initialize(null);
}
Also used : CryptokiException(org.openecard.mdlw.sal.exceptions.CryptokiException) CK_C_INITIALIZE_ARGS(org.openecard.mdlw.sal.cryptoki.CK_C_INITIALIZE_ARGS)

Aggregations

CK_C_INITIALIZE_ARGS (org.openecard.mdlw.sal.cryptoki.CK_C_INITIALIZE_ARGS)1 CryptokiException (org.openecard.mdlw.sal.exceptions.CryptokiException)1