Using j2pkcs11.dll with java 8 (64-bit) on Windows 7 (64-bit)

I am trying to use j2pkcs11.dll (bundled with jdk1.8.0 - 64bit) to access certificates stored on a smart card but unable to make them work.

--- Sample code to dynamically add a SunPKCS11 provider ---

    String pkcs11ConfigSettings = "name = " + "TestSmartCard" + "\n" + "library = " + "C:/jdk1.8.0_11/jre/bin/j2pkcs11.dll";
    byte[] pkcs11ConfigBytes = pkcs11ConfigSettings.getBytes();
    ByteArrayInputStream confStream = new ByteArrayInputStream(pkcs11ConfigBytes);            
    Provider p = new sun.security.pkcs11.SunPKCS11(confStream);

---- the exception I get is ---

java.security.ProviderException: Initialization failed
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:376)
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)
    at scpoc.SmartCard.main(SmartCard.java:28)

Caused by: java.io.IOException: The specified procedure could not be found.
    at sun.security.pkcs11.wrapper.PKCS11.connect(Native Method)
    at sun.security.pkcs11.wrapper.PKCS11.<init>(PKCS11.java:138)
    at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:151)
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:313)

JEP 131 claims to support PKCS11 in Java 8 ( http://openjdk.java.net/jeps/131 ), but I was not able to get it working with windows 7 using the 64-bit version of java8. Note. I also tried java 8 32-bit on Windows 7, but no luck.

Has anyone had success using the SunPKCS11 provider with java 8 (Windows 7)?

+4
source share
1 answer

SunPKCS11 32- Windows JRE JRE7. JRE8 64- Windows JRE. , JEP131.

API PKCS # 11 64- JRE JRE JRE8, - , IAIK-JCE.

, "j2pkcs11.dll" PKCS # 11, , JNI, JRE , PKCS # 11, "j2pkcs11.dll" PKCS # 11, - HSM.

+4

All Articles