Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem loading the Firefox PKCS11 provider

843811Mar 11 2009 — edited Apr 4 2009
I'm trying to load the Firefox PKCS11 provider (softokn3.dll), but I always get the following error:

Exception in thread "main" java.security.ProviderException: Initialization failed
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:340)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:86)
at javapkcs11test.Main.main(Main.java:24)
Caused by: java.io.IOException: The specified module could not be found.
C:\Program Files\Mozilla Firefox\softokn3.dll
at sun.security.pkcs11.wrapper.PKCS11.connect(Native Method)
at sun.security.pkcs11.wrapper.PKCS11.<init>(PKCS11.java:141)
at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:154)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:281)
... 2 more

I've already read this thread [http://forums.sun.com/thread.jspa?threadID=5298971] which handles the same problem, but there was no solution provided that helped me.

My code is the following:
String configName = "c:/pkcs11.config";
        Provider p = new sun.security.pkcs11.SunPKCS11(configName);
        Security.addProvider(p);
and my pkcs11.config looks like this:
name=NSSSoftToken
slot=2
#nssLibraryDirectory = C:\\Program Files\\Mozilla Firefox\\
#nssSecmodDirectory = "C:\\Documents and Settings\\sdm\\Application Data\\Mozilla\\Firefox\\Profiles\\tjx04kze.default"
#nssModule = fips
library=C:\Program Files\Mozilla Firefox\softokn3.dll
nssArgs="configDir='C:\\Documents and Settings\\sdm\\Application Data\\Mozilla\\Firefox\\Profiles\\tjx04kze.default' certPrefix='' keyPrefix='' secmod='secmod.db' flags=readOnly"
As you can see, I commented out a few lines I tried before but that also didn't work, I tried those after reading [http://java.sun.com/javase/6/docs/technotes/guides/security/p11guide.html#NSS]

Can anyone tell me what the problem is? And it's not that it can't find the DLL file, because when i type a wrong path on purpose it gives me another error: "file doesn't exist".

I really need to get this to work, because the eventual goal is to get it to work in C++, but as i'm not very familiar with C++, I first decided to try and make it work in Java, but even that doesn't work.

Thanks in advance to anyone who wants to help me!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2009
Added on Mar 11 2009
4 comments
2,414 views