Error Failed To Load Pkcs#11 Module
Sign in Pricing Blog Support Search GitHub This repository Watch 99 Star 527 Fork 272 OpenSC/OpenSC Code Issues failed to load pkcs#11 library please check your installation 20 Pull requests 7 Projects 0 Wiki Pulse Graphs New issue pkcs#11 library download windows pkcs11-tool fails to load default module (opensc-pkcs11.dylib on Mac) #741 Closed mouse07410 opened this Issue Apr opensc 21, 2016 · 11 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 4 participants mouse07410 commented Apr 21, 2016 • edited Platform Mac OS X 10.11.4, Xcode-7.3. OpenSC - current (as of 2016-04-21) GitHub master branch. Expected behaviour Should work as shown below but without module explicitly specified: $ pkcs11-tool --module /Library/OpenSC/lib/opensc-pkcs11.dylib -I Cryptoki version 2.20 Manufacturer OpenSC Project Library OpenSC smartcard framework (ver 0.15) Using slot 1 with a present token (0x4) $ Actual behaviour $ pkcs11-tool -I sc_dlopen failed: dlopen(opensc-pkcs11.dylib, 1): image not found error: Failed to load pkcs11 module Aborting. $ The culprit is line 14 in config.h: #define DEFAULT_PKCS11_PROVIDER "opensc-pkcs11.dylib" that does not specify the complete path to /Library/OpenSC/lib/opensc-pkcs11.dylib. I could only track it back to commit c3527f4 of 2015-11-12 which did not go far enough (did not add the actual path). A fix would be to prepend the complete path (LIBDIR/LIB_PRE) to opensc-pkcs11${DYN_LIB_EXT}. A work-around would be to add /Library/OpenSC/lib to the default search path, or to sym-link opensc-pkcs11.dylib into a directory that already is on that path. But since by the time config.h is written to disk, LIBDDIR is known - it makes sense to just include it in the DEFAULT_PKCS11_PROVIDER. Steps to reproduce Insert your hardware token and type pkcs11-tool -I or pkcs11-tool -M. Logs Nothing gets logged because loading of the PKCS11 module fails (prior to any interactions with the token). OpenSC team member frankmorgner co
to load pkcs11 module Newsgroups: gmane.comp.encryption.opensc.devel Date: Monday 21st March 2011 15:09:55 UTC (over 5 years ago) Hello, On Mar 14, 2011, at 12:18 AM, Juan Antonio Martinez wrote: > Using opensc from svn: > > [[emailprotected] opensc]$ src/tools/pkcs11-tool -lO > error: Failed to load pkcs11 module > Aborting. > > Looking https://github.com/OpenSC/OpenSC/issues/741 at src/pkcs11/pkcs11-tool.c seems that "opt_module" > variable is not properly initialized thus C_LoadModule > is called with "NULL" as module name... I don't think it is a good idea to have a hardcoded module path in pkcs11-tool, see #307 [1] pkcs11-tool http://permalink.gmane.org/gmane.comp.encryption.opensc.devel/12237 could be a general PKCS#11 tool as the name implies, at the moment it has a lot of OpenSC specific trickery in it. Typing the full module path is a bit more work but makes it very explicit which module is intended to be used. There have been issues when somebody installs from source to /usr/local and then doesn't know which module actually gets loaded by pkcs11-tool and that the module he explicitly loaded into Firefox are different. I'd suggest requiring the path to the module as the first argument to pkcs11-tool (without --module) > Is a bug so strange.... no one has noticed it before? This was introduced by me lately [2] [1] http://www.opensc-project.org/opensc/ticket/307 [2] http://www.opensc-project.org/opensc/ticket/323#comment:7 CD: 3ms
by: "Jeffrey W. Baker"
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Unable to load PKCS11 driver using IAIK PKCS11 Wrapper up vote 1 down vote favorite 1 I'm using the following: Windows 7 64bit JDK 7 64bit JRE 7 64bit The new funny JRE 7 64bit doesn't support Sun PKCS11 anymore (which is inside package 'sun.security.pkcs11'). And the big problem is that the end-users of the product by our company may have installed whatever version of JRE. So I have to swap up the existing to code in 'Sun PKCS11' to 'IAIK PKCS11 Wrapper'. The wrapper by IAIK works simply this way: (iaik-wrapper.jar)->(iaik-pkcs11-jni.dll)->(pki-token-driver.dll) The PKI token driver dynamic link library is provided by the manufacturer of PKI USB token, it has the actual name of 'ca2-v34.dll'. The method to load this native driver is described in programmer's manual as below: import iaik.pkcs.pkcs11.*; ... Module pkcs11Driver; try { pkcs11Driver = Module.getInstance("ca2-v34.dll"); //<--exception! pkcs11Driver.initialize(null); //test System.out.println(pkcs11Driver.getInfo()); } catch (Exception ex) { System.out.println(ex); } The exception is raised at the line marked in the code above, with this detail: java.io.IOException: %1 is not a valid Win32 application. ca2-v34.dll This exception surely means the IAIK library has found the .dll file, but it is not compatible somehow. I'm being stuck at this bottleneck. java jni pki pkcs#11 iaik-jce share|improve this question edited Jan 8 '13 at