damianofalcioni / Websocket-Smart-Card-Signer

Websocket based (NO APPLET) Smart Card Digital Signature Framework
GNU Affero General Public License v3.0
41 stars 23 forks source link

Detection issue with safenet ikey 2032 #29

Open rajathirajan opened 2 years ago

rajathirajan commented 2 years ago

Application has issues in detecting safenet ikey 2032 in windows10 64 bit pc.

damianofalcioni commented 2 years ago

Hi, by default, the application is able to automatically identified in your system the presence of the following PKCS11 libraries (in windows): "incryptoki2.dll", "bit4ipki.dll", "bit4opki.dll", "bit4xpki.dll", "OCSCryptoki.dll", "asepkcs.dll", "SI_PKCS11.dll", "cmP11.dll", "cmP11_M4.dll", "IpmPki32.dll", "IPMpkiLC.dll", "IpmPkiLU.dll", "bit4cpki.dll", "bit4p11.dll", "asepkcs.dll", "PKCS11.dll", "eTPKCS11.dll", "SSC_PKCS11.dll", "inp11lib.dll", "opensc-pkcs11.dll". Probably the "safenet ikey 2032" use its own PKCS11 dll. If you know the dll name (and installation path) you can add it via javascript using the following method before the signature:

websocket_smartcard_signer.addDll("your_dll_path");

Best regards, Damiano

rajathirajan commented 2 years ago

Thank you for your prompt reply. The Error was at line number 55 of SmartCardAccessJnaImpl.java

long[] mechLst = CE.GetMechanismList(slot);

It returns CKR exception from jacknji11 library

damianofalcioni commented 2 years ago

Did you loaded the correct DLL before?

What is the message in the exception?

rajathirajan commented 2 years ago

Yes, I loaded the correct DLL (dkck201.dll).

The error message from signer was "No smartcards found supporting signing with mechanism RSA_PKCS using library"

CKRException 0xffffffff0000002 unknown CKR constant from jacknji11

damianofalcioni commented 6 months ago

Hi, you can try to uncomment the main and debug directly here to investigate better the issue: https://github.com/damianofalcioni/Websocket-Smart-Card-Signer/blob/401bb49a54662f35de36f6f111a4bda2a52971c8/src/main/java/df/sign/pkcs11/impl/jna/SmartCardAccessJnaImpl.java#L179

and also here:

https://github.com/damianofalcioni/Websocket-Smart-Card-Signer/blob/401bb49a54662f35de36f6f111a4bda2a52971c8/src/main/java/df/sign/pkcs11/impl/iaik/SmartCardAccessIaikImpl.java#L235