portecle icon indicating copy to clipboard operation
portecle copied to clipboard

Exception opening .ks

Open scop opened this issue 13 years ago • 3 comments

Hello,

don't know if this is exactly a bug, anyway: I'm trying to open a keystore file (.ks) generated by a previous java version (probably 1.5 or earlier) in order to convert it into a .pfx certfile. I select the keystore.ks on filechooser opened by pressing Ctrl-O, then the password prompt is shown but when I type the password (the right password...) an exception is thrown (I appendend to this message the details). I know this is probably a keystore file problem because I imagine you tested your software with a lot of keystore files. Anyway I'm hoping you can help me to solve my problem.

Thanks in advance. Giacomo Galletto

java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence cannot be cast to org.bouncycastle.asn1.DERInteger org.bouncycastle.asn1.pkcs.Pfx.<init>(Unknown Source) org.bouncycastle.jce.provider.JDKPKCS12KeyStore.engineLoad(Unknown Source) java.security.KeyStore.load(Unknown Source) net.sf.portecle.crypto.KeyStoreUtil.loadKeyStore(KeyStoreUtil.java:303) net.sf.portecle.FPortecle.openKeyStoreFile(FPortecle.java:1929) net.sf.portecle.FPortecle.openKeyStoreFile(FPortecle.java:1834) net.sf.portecle.FPortecle.access$4200(FPortecle.java:150) net.sf.portecle.FPortecle$OpenKeyStoreFileAction.act(FPortecle.java:6180) net.sf.portecle.FPortecle$AbstractAction.actionPerformed(FPortecle.java:6551) javax.swing.AbstractButton.fireActionPerformed(Unknown Source) javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) javax.swing.DefaultButtonModel.setPressed(Unknown Source) javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) java.awt.Component.processMouseEvent(Unknown Source) javax.swing.JComponent.processMouseEvent(Unknown Source) java.awt.Component.processEvent(Unknown Source) java.awt.Container.processEvent(Unknown Source) java.awt.Component.dispatchEventImpl(Unknown Source) java.awt.Container.dispatchEventImpl(Unknown Source) java.awt.Component.dispatchEvent(Unknown Source) java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) java.awt.Container.dispatchEventImpl(Unknown Source) java.awt.Window.dispatchEventImpl(Unknown Source) java.awt.Component.dispatchEvent(Unknown Source) java.awt.EventQueue.dispatchEventImpl(Unknown Source) java.awt.EventQueue.access$000(Unknown Source) java.awt.EventQueue$1.run(Unknown Source) java.awt.EventQueue$1.run(Unknown Source) java.security.AccessController.doPrivileged(Native Method) java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) java.awt.EventQueue$2.run(Unknown Source) java.awt.EventQueue$2.run(Unknown Source) java.security.AccessController.doPrivileged(Native Method) java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) java.awt.EventQueue.dispatchEvent(Unknown Source) java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) java.awt.EventDispatchThread.pumpEvents(Unknown Source) java.awt.EventDispatchThread.pumpEvents(Unknown Source) java.awt.EventDispatchThread.run(Unknown Source)

Reported by: galletto

scop avatar Apr 11 '11 08:04 scop

Based on the stack trace it seems to me that this might be a bug in the Bouncy Castle provider. At the point where the problem occurs, Portecle just asks the provider to load the keystore.

What version of Portecle is this (Help->About Portecle)?

What is the Bouncy Castle provider version (Help->JARs->bcprov.jar)?

Original comment by: scop

scop avatar Apr 11 '11 20:04 scop

Hello,

Portecle version is 1.7 Bouncy Castle provider specification version is 1.1 and implementation version is 1.45.0

Best regards

Original comment by: galletto

scop avatar Apr 12 '11 06:04 scop

I suggest trying with Bouncy Castle versions 1.43, 1.44, and 1.46 to see if it makes a difference - replace the bcprov.jar that comes with Portecle with each of these in turn, restart Portecle everytime in between, and try opening again:

http://www.bouncycastle.org/download/bcprov-jdk16-143.jar http://www.bouncycastle.org/download/bcprov-jdk16-144.jar http://www.bouncycastle.org/download/bcprov-jdk16-146.jar

Let me know how it goes. If it doesn't work with any of the above, or if it works with 1.43 or 1.44 but not with later versions I'm afraid the problem needs to be reported to Bouncy Castle developers at http://www.bouncycastle.org/jira/browse/BJA

Original comment by: scop

scop avatar Apr 12 '11 17:04 scop