kaikramer / keystore-explorer

KeyStore Explorer is a free GUI replacement for the Java command-line utilities keytool and jarsigner.
https://keystore-explorer.org/
GNU General Public License v3.0
1.7k stars 275 forks source link

Could not create an instance of KeyStore as type 'JKS' #192

Closed mstarkie closed 5 years ago

mstarkie commented 5 years ago

Describe the bug New and older versions of explorer fail to open JKS java keystore.

Something changed and I can't open *.jks files anymore with Keystore Explorer. Even older jks files with older version of Explorer won't work. I searched on Stack Overflow and elsewhere for a solution but the error may be caused by too many possibilities. I was hoping for some insight here. My guess is that it has something to do with the new versions of Java 8.

To Reproduce Steps to reproduce the behavior:

  1. Click on any *.jks file
  2. Enter passphrase when prompted

Expected behavior I could explore a jks file contents

Screenshots image

org.kse.crypto.CryptoException: Could not create an instance of KeyStore as type 'JKS'. at org.kse.crypto.keystore.KeyStoreUtil.getKeyStoreInstance(KeyStoreUtil.java:448) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:167) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:137) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:141) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:97) at org.kse.gui.actions.ExamineFileAction.openFile(ExamineFileAction.java:119) at org.kse.gui.dnd.DroppedFileHandler.openFiles(DroppedFileHandler.java:84) at org.kse.gui.CreateApplicationGui.run(CreateApplicationGui.java:113) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

java.security.KeyStoreException: JKS not found at java.security.KeyStore.getInstance(Unknown Source) at org.kse.crypto.keystore.KeyStoreUtil.getKeyStoreInstance(KeyStoreUtil.java:445) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:167) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:137) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:141) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:97) at org.kse.gui.actions.ExamineFileAction.openFile(ExamineFileAction.java:119) at org.kse.gui.dnd.DroppedFileHandler.openFiles(DroppedFileHandler.java:84) at org.kse.gui.CreateApplicationGui.run(CreateApplicationGui.java:113) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

java.security.NoSuchAlgorithmException: JKS KeyStore not available at sun.security.jca.GetInstance.getInstance(Unknown Source) at java.security.Security.getImpl(Unknown Source) at java.security.KeyStore.getInstance(Unknown Source) at org.kse.crypto.keystore.KeyStoreUtil.getKeyStoreInstance(KeyStoreUtil.java:445) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:167) at org.kse.crypto.keystore.KeyStoreUtil.load(KeyStoreUtil.java:137) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:141) at org.kse.gui.actions.OpenAction.openKeyStore(OpenAction.java:97) at org.kse.gui.actions.ExamineFileAction.openFile(ExamineFileAction.java:119) at org.kse.gui.dnd.DroppedFileHandler.openFiles(DroppedFileHandler.java:84) at org.kse.gui.CreateApplicationGui.run(CreateApplicationGui.java:113) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

Environment

kaikramer commented 5 years ago

That's indeed a problem with the Java runtime. You will get the same error with keytool.

That error should simply never happen and I have never seen it before: java.security.NoSuchAlgorithmException: JKS KeyStore not available

Is the Java runtime from Oracle or AdoptOpenJDK? Any security modifications? Maybe FIPS restrictions in place? JKS uses weak algorithms so that may be an explanation.

mstarkie commented 5 years ago

I upgraded to the latest version of Oracle Java for Windows at https://www.java.com/en/

and the problem has gone away.

This is an acceptable solution to me :)

mstarkie commented 5 years ago

java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

mstarkie commented 4 years ago

Would you be able to answer this question on stackoverflow?

https://stackoverflow.com/questions/59954100/updating-java-keystore-and-truststores-with-new-certificates