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.
9 thoughts on “PKCS#12 keystore to Java keystore conversion”
Comments are closed.
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
LikeLike
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.
LikeLike
Oh – plus keytool doesn’t support PKCS#12.
LikeLike
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.
LikeLike
Seems like the jar-file with the KeystoreUtil isn’t on the classpath. How are you invoking the program?
LikeLike
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.
LikeLike
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"
LikeLike
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.
LikeLike
Ok 🙂 happy you got it to work for you
LikeLike