oracleruiz oracleruiz - 2 years ago 624
Java Question

Java Access Token PKCS11 Not found Provider

Hello I'm trying to access the keystore from my smartcard in Java. And I'm using the following code..

I'm using the Pkcs11 implementation of OpenSc

File windows.cnf =


Java Code =

String configName = "windows.cnf"
String PIN = "####";
Provider p = new;
KeyStore keyStore = KeyStore.getInstance("PKCS11", "SunPKCS11-dnie"); =)(=
char[] pin = PIN.toCharArray();
keyStore.load(null, pin);

When the execution goes by the line with =)(= throws me the following exception PKCS11 not found

at ObtenerDatos.LeerDatos(
at ObtenerDatos.obtenerNombre(
at main.main(
Caused by: no such algorithm: PKCS11 for provider SunPKCS11-dnie

I think the problem is "SunPKCS11-dnie", but I don't know to put there. I had tried with a lot of combinations...

Anyone can help me...

Answer Source

I am not sure the problem is the name. It looks correct. ColinD's suggestion to pass the Provider instance should rule it out as a problem.

I am guessing that the problem is with the PKCS11 support. Like, you don't have a card in your reader, or the native code cannot access the reader. Have you tried using this driver in conjunction with some "known good" software, like Firefox or Thunderbird's security modules?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download