<< Eclipse Demo Camp in Copenhagen | Home | Useful RnrMgr technote >>

PKCS#12 keystore to Java keystore conversion

I wrote a small program for converting a PKCS#12 keystore containing private and public key to a Java keystore suitable for signing Java extensions (plugins/features). See KeystoreUtil for download, installation, usage and of course the source code.



Avatar: Tim E. Brown

Re: PKCS#12 keystore to Java keystore conversion

Can't you use keytool.exe to do this also?  It comes with the Notes 8 client

more info here:
http://www-01.ibm.com/support/docview.wss?uid=swg21305165

-Tim E. Brown
Avatar: Mikkel Heisterberg

Re: PKCS#12 keystore to Java keystore conversion

Well the reason for using PKCS#12 is that it contains private and public key. A certificate os just a certified public key. The reason I need the private key is for signing Java extensions.
Avatar: Mikkel Heisterberg

Re: PKCS#12 keystore to Java keystore conversion

Oh - plus keytool doesn't support PKCS#12.
Avatar: Harish Jethwa

Re: PKCS#12 keystore to Java keystore conversion

I have Jdk1.6.0_24  now and can not use this KeystoreUtil. I get the ClassNotFoundException. Is there some incompatability in the version of jdk I am using? How can I make this utilty work?

I am trying to Convert our certificate from PKCS#12 to Java Keystore format, so that we can sign 3rd party plugins.

All your assistance is much appreciated.

Exception in thread "main" java.lang.NoClassDefFoundError: KeystoreUtil
Caused by: java.lang.ClassNotFoundException: KeystoreUtil
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: KeystoreUtil.  Program will exit.

Avatar: Mikkel Heisterberg

Re: PKCS#12 keystore to Java keystore conversion

Seems like the jar-file with the KeystoreUtil isn't on the classpath. How are you invoking the program?
Avatar: Harish Jethwa

Re: PKCS#12 keystore to Java keystore conversion

Indeed KeystoreUtil.jar is not found because it is not under my Java install folders. I downloaded/installed the jdk from this http://www.oracle.com/technetwork/java/javase/downloads/index.html oracle site.

Do I need to download extra jar files as well? If so, where do I get these from? I notice, there is tools.jar in the "lib" folder and not sure what would be in this jar file.

 

Avatar: Harish Jethwa

Re: PKCS#12 keystore to Java keystore conversion

I am invoking the program as follows:

java -cp KeystoreUtil.jar KeystoreUtil domino_admin.pfx password keystore.jks from the from the same directory that has my "java.exe"

Avatar: Harish Jethwa

Re: PKCS#12 keystore to Java keystore conversion

I got it work after running this command jar -cvf KeystoreUtil.jar KeystoreUtil.class to create the KeystoreUtil.jar file.

I am new to java and went away to find out how to create my jar file from the class file you had provided.

Avatar: Mikkel Heisterberg

Re: PKCS#12 keystore to Java keystore conversion

Ok :-) happy you got it to work for you

Add a comment Send a TrackBack