我的PKCS#11提供商遇到了麻烦。这是我的代码:
String pkcs11ConfigFile = "C:\\pkcs11.cfg";
Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(pkcs11ConfigFile);
Security.addProvider(pkcs11Provider);
pkcs11.cfg
档案:
name = SmartCard
library = C:\Program Files\CryptoTech\CryptoCard\CCPkiP11.dll
slot = 3
运行代码后,我得到了例外:
java.security.ProviderException: Initialization failed at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:340) at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:86) at signature.NewClass.main(NewClass.java:15) Caused by: java.io.IOException: Invalid access to memory location. C:\Program Files\CryptoTech\CryptoCard\CCPkiP11.dll
PS。读卡器已连接,卡已插入,插槽具有适当的值..
感谢您的帮助!
答案 0 :(得分:0)
听起来像一个错误的PKCS#11模块?
尝试通过PKCS#11间谍http://www.opensc-project.org/opensc/wiki/UsingOpensc
使用它