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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

keytool error: java.security.ProviderException: Initialization failed

843811Jul 19 2005 — edited Jul 19 2005
hi

referring to the forum http://forum.java.sun.com/thread.jspa?threadID=506442&tstart=120

i tried to run
keytool -keystore NONE -storetype PKCS11 -list

but the error
keytool error: java.security.ProviderException: Initialization failed

comes out instead.. this is what I've done.
1) installed the JCE unrestricted policy files
2) created PKCS11.cfg files which contains
name = rainbow_token
library = c:\WINNT\system32\DKCK232.dll
slot=3
i put the file under drive c, which is c:\pkcs11.cfg
3)edited java.security files by adding the line security.provider.7=sun.security.pkcs11.SunPKCS11 C:/pkcs11.cfg which resides in the folder C:\Program Files\Java\jdk1.5.0_04\jre\lib\security and C:\Program Files\Java\jre1.5.0_04\lib\security

then i tried running the keytool program above but the error comes out. If I omit the line 'slot=3' from the PKCS11.cfg file, the error
keytool error: java.security.KeyStoreException: PKCS11 not found
would come out instead.

anyone knows where did i messed up?
any helps are greatly appreciated. thanks in advance

Comments

843811
i tried installing the provider dynamically by using the code below:
public class Encrypt{
	
	public static void main (String args[]) throws Exception {
		
				
		String configName = "C:/pkcs11.cfg";
		Provider p = new sun.security.pkcs11.SunPKCS11(configName);
		Security.addProvider(p);
		
		System.out.println("test");

	}
}
i run it and the problem below appears..
Exception in thread "main" java.security.ProviderException: Initialization faile
d
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:175)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:76)
        at Encrypt.main(Encrypt.java:22)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_SLOT_ID_INVALID
        at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
        at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:167)
        ... 2 more
anyone knows what should i do? any help is greatly appreciated..
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 16 2005
Added on Jul 19 2005
1 comment
3,914 views