I was wondering if anyone knew how to assign a digital certificate at runtime.
currently my applet asks to accept the certificate before the applet starts.
I really didnt want to display the Java loading circle, so i was hoping there was a way to prompt the user at runtime.
anyway, used with the Applet Boot class (wich can check the java version before loading classes) and proper HTML this is a perfect solution for professional/smooth looking applets.
It only occured to me that it was even possible, when I saw DzzD’s 3DzzD applet switching between software/hardware renderers. I tried to see how ‘they’ (DzzD and thijs) did it, but the answer was obscured by the JOGL loader. After a few minutes I lost patience and did some trial-and-error until it worked. So credits to DzzD and thijs!
In eclipse, Im getting a few errors with this code
I can comment out the @Override.
When I do compile without errors, the applet won’t prompt to accept ther certificate before running the code.
Iv tried changing the original SecureAccess to both a class/abstract class. but the problem still remains with both uses of “run()”[quote]The method run() of type new PrivilegedAction(){} must override a superclass method
[/quote]
system: JRE6 WinXP Eclipse
If I comment out @Override the applet compiles fine and runs.
When I test it in Internet Explorer,
I sign the jar that contains the LocalSecureAccess classes.
but not the SecureAccess and TestApplet class.
I end up getting the exception
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at sun.plugin2.applet.Plugin2ClassLoader.checkPackageCerts(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$200(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at TestApplet.start(TestApplet.java:16)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I tried the pageflip example. and it works just fine. it prompts to accept a certificate.
the certificate im using works just fine, if I sign the unsigned jar. so i really cant see the difference, except that maybe its trying to execute to early in the applet (in the start method).