Enzo,

Enzo Motta wrote:
I'm trying to connect to firefox's PKCS#11 implementation using the new sun PKCS#11 Provider.

My code looks like:

String configName = "c:\\pkcs11.config";
Provider p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);

My pkcs11.config is:

name = Firefox
library = C:\Mozilla\softokn3.dll

And I always got the error:

Exception in thread "main" java.security.ProviderException: Initialization failed
 at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:153)
 at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:74)
 at Main.main(Main.java:15)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ARGUMENTS_BAD
 at sun.security.pkcs11.wrapper.PKCS11.C_Initialize(Native Method)
 at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:143)
 at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:103)

Does anyone know what is wrong? Or where can I found a solution?

Thanks,

Enzo Motta.


Are you trying to do this in your own process, or from an applet running within the Mozilla browser ?

If from your own process, be aware that the NSS softoken requires some arguments to be passed in to the CK_C_INITIALIZE_ARGS structure. Check the source for softoken to see what these are.

If from within mozilla, I would currently recommend against you doing this (see bugzilla 292809 for the reasons why) .

However, if you do try, you sohuld let Mozilla initialize NSS for you, and then the SunPKCS11 provider can "load" the softoken, which is already initialized, and use it.
_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto

Reply via email to