All, I am trying to access opensc dll
(latest version) on windows 7 64 bit. I am trying to access a ePass2003
token. The opensc-tool
is able to detect the token and can get name and other information. So the token is found by OpenSC
. Then I am loading the opensc dll
from another program and call standard PKCS#11 functions
. C_GetSlotList
is returning slot 0 ID as -1 and slot 1 ID as 1. The C_GetFunctionList
is returning me pointers to functions. The problem is when I call C_GetMechanismList
I am getting a crash with c0000005 error
.
I also have accessed the token through the ePass dll
provided with the token, it works perfectly.
I am unable to track this problem as it is looking like through the opensc dll
, opensc
is unable to interface with the card but then opensc-tool also should have the same problem but it does not.
If someone can help it would be great.
TRACE : pkcs11-tool
Trace #1:
C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --module opensc-pkcs11.dll -I
Cryptoki version 2.20
Manufacturer OpenSC (www.opensc-project.org)
Library Smart card PKCS#11 API (ver 0.0)
Using slot 1 with a present token (0x1)
Trace #2:
C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --module opensc-pkcs11.dll -L
Available slots:
Slot 0 (0xffffffff): Virtual hotplug slot
(empty)
Slot 1 (0x1): FS USB Token 0
token state: uninitialized
Trace #3:
C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --module opensc-pkcs11.dll -T
Available slots:
No slots.
Trace #4:
C:\Program Files\OpenSC Project\OpenSC\tools>pkcs11-tool.exe --module opensc-pkcs11.dll -M
Using slot 1 with a present token (0x1)
Same result crash with c0000005
OpenSC PKCS#11 library sees your token as "uninitialized". If I remember correctly ePass token initialized with Feitian middleware cannot be used with OpenSC, and vice versa. So if you want to use ePass with
opensc-pkcs11.dll
then you will need to usepkcs15-init.exe
application shipped with OpenSC to initialize your token.Documentation references:
OpenSC wiki mentions requirement for reinitialization on ePass3000 page but not on ePass2003 page. European distributor gooze.eu also states that reinitialization is required:
Practical examples:
I have initialized my ePass2003 token with Feitian middleware and tested with proprietary
eps2003csp11.dll
library - it was working fine:Then I have tested with
opensc-pkcs11.dll
and got the same crash you are describing:So I have erased the card..
..initialized with OpenSC
pkcs15-init
application....and then
opensc-pkcs11.dll
started working:However
eps2003csp11.dll
distributed by Feitian stopped working as expected: