Search code examples
javadokuwiki

Java applet with expired signatures not working after selfsigning


I am trying to re-sign a java applet that has expired signatures.

The applet is Jdraw, a plugin for Dokuwiki.

I have followed the instructions from other posts, and have created a keystore with my own keys, then I have unpacked the jars, I have repacked them and signed with my own signatures.

Now, the plugin installs fine but when I run it I get the following error:

java.lang.NoClassDefFoundError: com/mxgraph/swing/util/mxSwingConstants
    at com.hammurapi.jdraw.JDrawApplet.start(JDrawApplet.java:42)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.mxgraph.swing.util.mxSwingConstants
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 4 more

com/mxgraph/swing/util/mxSwingConstants exists, in jgraphx.jar.

EDIT: I have tried adding CLASSPATH to manifest, but I still get the same error.

EDIT2:

This is what I added to manifest:

Permissions: all-permissions
Codebase: *
Application-Name: jdraw
Class-Path: jgraphx.jar

Solution

  • I think you should take all the original jars(all the jars in the applet classpath before you singned the applet), fix the exception and then sign them with the new cert; note that files already signed will not work, you need to use the jars without any signature. Fix the exception ClassNotFoundException by adding jgraphx.jar to the classpath of your applet.