PKCS11:找不到指定的模块

时间:2015-05-14 12:31:43

标签: java cryptography digital-signature pkcs#11 e-token

我使用以下代码显示数字证书信息。

String sFileName = System.getProperty("jboss.server.base.dir")+ "/properties/path.properties";
FileInputStream fis = new FileInputStream(sFileName);
PropertyResourceBundle iSignBundle = new PropertyResourceBundle(fis);
String sDll = iSignBundle.getString("DLL");

CK_C_INITIALIZE_ARGS initArgs = new CK_C_INITIALIZE_ARGS();
String functionList = "C_GetFunctionList";
initArgs.flags = 0;
PKCS11 tmpPKCS11 = null;
long[] slotList = null;
try {
    tmpPKCS11 = PKCS11.getInstance(sDll, functionList,initArgs, false);
} catch (Exception e) {
    try {
        initArgs = null;
        tmpPKCS11 = PKCS11.getInstance(sDll, functionList, initArgs, true);
    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (PKCS11Exception ex) {
        ex.printStackTrace();
    }
}

try {
     slotList = tmpPKCS11.C_GetSlotList(true);
     out.println("<b>slots</b>" + " ------"+slotList.length +"--------------" + "<b>labels</b>");
     out.newLine();
     for (long slot : slotList) {
          CK_TOKEN_INFO tokenInfo = tmpPKCS11.C_GetTokenInfo(slot);
          String.valueOf(tokenInfo.manufacturerID)+
          out.println(slot + " --------------------" + String.valueOf(tokenInfo.label));
          out.newLine();
     }  
} catch (PKCS11Exception ex) {
    ex.printStackTrace();
} catch (Throwable t) {
    t.printStackTrace();
}

我使用的证书是使用Alladin eToken的SafeScrypt,当我访问此jsp时,我收到以下错误。相同的代码与其他供应商在另一个设置中的语言协调工作正常。

 java.io.IOException: The specified module could not be found.
 C:\Windows\System32\eTPKCS11.dll
 sun.security.pkcs11.wrapper.PKCS11.connect(Native Method)
 sun.security.pkcs11.wrapper.PKCS11.<init>(PKCS11.java:137)
 sun.security.pkcs11.wrapper.PKCS11$SynchronizedPKCS11.<init>(PKCS11.java:1480)
 sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:152)
 org.apache.jsp.Tokens_jsp._jspService(Tokens_jsp.java:94)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

0 个答案:

没有答案