views:

79

answers:

1

Hi all, I have a application that running ok over tomcat 6.20, I use in my app a token A3 smart card reader. Everthing looks fine. Now, I want migrate my application to Glassfish v2.1, then, my nightmare begins! Can I use de same code to load the Provider? In Tomcat works good, but not luck with glassfish v2.

String configName = "C:\\pkcs11.config";
Provider provider = new SunPKCS11(configName);

configName is a file in with this content:

name = Safesign
library = C:\windows\system32\aetpkss1.dll

I use this to get KeySotore

char[] pin = { '1', '2', '3', '4' };
   String configName = "C:\\pkcs11.config";
   Provider p = new SunPKCS11(configName);
   KeyStore.Builder builder = KeyStore.Builder.newInstance("pkcs11",
     p, new KeyStore.PasswordProtection(pin));
   ks = builder.getKeyStore();

Its seems like glassfish is not loading the DLL, and don't find the slots of my usb card reader. Please, someone know how can I fix my problem? Help!!! *sorry for the "Tarzan English".

A: 

Reuse your instance of SunPKCS11, and don't forget to call Security.addProvider

Jason