bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
on:
2010-02-26 07:51:30 » |
|
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.
|
|
|
|
ryanm
« League of Dukes » JGO Strike Force      Posts: 788 Medals: 4
Used to be bleb
|
 |
«
Reply #1 on:
2010-02-26 08:27:40 » |
|
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #2 on:
2010-02-26 12:04:21 » |
|
 Was just about to make a shameless plug, but you beat me to it!
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Games published by our own members! Go get 'em!
|
|
h3ckboy
JGO Kernel      Posts: 1645 Medals: 4
|
 |
«
Reply #3 on:
2010-02-26 12:46:42 » |
|
haha, this is awesome. I have been wanting ot do this for a while 
|
|
|
|
|
DzzD
|
 |
«
Reply #4 on:
2010-02-26 12:58:34 » |
|
haha, this is awesome. I have been wanting ot do this for a while  so you should have looked to 3DzzD before !  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.
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #5 on:
2010-02-26 13:04:02 » |
|
so you should have looked to 3DzzD before !  Indeed. 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!
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #6 on:
2010-02-26 17:01:14 » |
|
SWEEEET! thanx bleb and Riven.  Riven: I didnt know so many people were interested in my code edit: i just relised it was a script, I feel dumb 
|
|
|
|
Momoko_Fan
Full Member   Posts: 101 Medals: 3
|
 |
«
Reply #7 on:
2010-02-26 18:11:50 » |
|
SWEEEET! thanx bleb and Riven.  Riven: I didnt know so many people were interested in my code What!? How does this foreign site is able to access my javagaming cookies? I thought there's a restriction for that.
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #8 on:
2010-02-26 18:25:13 » |
|
Please use the forum search to find numerous other derailed threads discussing this. Let's not ruin this thread! 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #9 on:
2010-02-26 18:58:49 » |
|
1
| PrivilegedAction>Object<() |
I think the '<' '>' characters are ment to be flipped around?
|
|
|
|
Games published by our own members! Go get 'em!
|
|
ryanm
« League of Dukes » JGO Strike Force      Posts: 788 Medals: 4
Used to be bleb
|
 |
«
Reply #10 on:
2010-02-26 18:59:52 » |
|
SWEEEET! thanx bleb and Riven.
Haha! Gratitude successfully stolen!  All props to Riven, I only spotted the post while nicking his LUT-based trig functions.
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #11 on:
2010-02-26 19:01:29 » |
|
1
| PrivilegedAction>Object<() |
I think the '<' '>' characters are ment to be flipped around? Oh thanks, I screwed up on my > and <
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #12 on:
2010-02-27 16:36:12 » |
|
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()" The method run() of type new PrivilegedAction<Object>(){} must override a superclass method
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #13 on:
2010-02-27 16:54:11 » |
|
If the compiler -source is 1.5, you cannot @Override *interface methods* yet, that is allowed since 1.6.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #14 on:
2010-02-27 17:35:18 » |
|
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 1 2 3 4 5 6 7 8 9 10 11 12 13 14
| 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) |
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #15 on:
2010-02-27 17:59:50 » |
|
system: JRE6 WinXP Eclipse If I comment out @Override the applet compiles fine and runs.
I can only repeat what I said: either you have Eclipse's compiler setup with -source 1.5 or you are compiling with a 1.5 compiler. 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14
| 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) |
.... so what's the 'cause' stracktrace + message.  Which MSIE version? 6? 7? 8? Maybe put some files online so I can check for myself, to prevent this from me debugging your code, and wasting a lot of time. For the sake of sweet fluffy things, provide all info you have.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #17 on:
2010-02-27 18:13:30 » |
|
If the compiler -source is 1.5, you cannot @Override *interface methods* yet, that is allowed since 1.6.
thanx that fixed the compiling problem. test case: http://users.on.net/~bobjob/testcer.html The classes are a copy and paste of your code. as for the applet: import java.io.*; import javax.swing.JApplet;
public class TestApplet extends JApplet { public void start() { try // Usage: { File file = new File("image.jpg"); Class< ? > clazz = Class.forName("LocalSecureAccess"); SecureAccess access = (SecureAccess) clazz.newInstance(); byte[] data = access.loadFile(file); System.out.println(data.length); } catch (Exception e) { e.printStackTrace(); } } }
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #18 on:
2010-02-27 18:16:38 » |
|
I can reproduce your problem in *your* applet -- it works in mine.
I have the interface and the implementation in different packages, maybe try that.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #19 on:
2010-02-27 18:18:54 » |
|
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).
ill try the package idea
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #20 on:
2010-02-27 18:24:27 » |
|
One more thing that's different, although it really shouldn't matter...:
mine => archive="unsigned.jar,signed.jar" yours => archive="signed.jar,unsigned.jar"
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #21 on:
2010-02-27 18:25:46 » |
|
It was the package names.
Thank you it works
ps. Riven, I love you. Im thinking a wedding in the fall.
|
|
|
|
Momoko_Fan
Full Member   Posts: 101 Medals: 3
|
 |
«
Reply #22 on:
2010-02-27 18:26:25 » |
|
Pageflip applet works for me. (Windows 7 64 bit Java 1.6). Shows certificate warning when I press button.
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #23 on:
2010-02-27 18:27:23 » |
|
ps. Riven, I love you. Im thinking a wedding in the fall.
Don't take me down in the fall!
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #24 on:
2010-02-27 19:00:15 » |
|
You might fancy this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| @Override public File browse(final File dir, final String title, final int mode) { return AccessController.doPrivileged(new PrivilegedAction<File>() { @Override public File run() { return browseImpl(dir, title, mode); } }); }
@Override public Socket connect(final String host, final int port) throws IOException { try { return AccessController.doPrivileged(new PrivilegedAction<Socket>() { @Override public Socket run() { try { return new Socket(host, port); } catch (IOException exc) { throw new RuntimeException(exc); } } }); } catch (RuntimeException exc) { throw (IOException) exc.getCause(); } }
File browseImpl(final File dir, String title, int mode) { final FileDialog dialog = new FileDialog((Dialog) null, title, mode);
Runnable task = new Runnable() { @Override public void run() { String path = dir.getAbsolutePath(); dialog.setDirectory(path); dialog.setVisible(true); } };
try { if (SwingUtilities.isEventDispatchThread()) task.run(); else SwingUtilities.invokeAndWait(task); } catch (Exception exc) { exc.printStackTrace(); }
if (dialog.getFile() == null) return null; return new File(dialog.getDirectory(), dialog.getFile()); } |
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
bobjob
JGO Ninja    Posts: 646 Medals: 14
David Aaron Muhar
|
 |
«
Reply #25 on:
2010-02-27 19:24:20 » |
|
yeah, its actually the sockets that were my main concern.
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #26 on:
2010-04-06 05:44:22 » |
|
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
DzzD
|
 |
«
Reply #27 on:
2010-04-06 06:46:53 » |
|
 this is soooo stupid... it was still a secured solution and was enabling a better user experiences.... let see how it look ...
|
|
|
|
DzzD
|
 |
«
Reply #28 on:
2010-04-06 07:20:26 » |
|
Sun/Oracle have really a problem, why does they try to make user experience so poor when they cannot reach more than 60% computer after java 1.6 has been out for severals monthes ? I just update to 1.6-19-b4 ... and I got :
1 - do you want to install google toolbar (checked)? and 2 - do you know about openoffice ? and 3 - you now need to reboot your computer to apply change and 4 - after reboot ? java do not work anymore ! => need to install again from the website
and finally yes signed/unsigned does not work anymore ( after 3 years of using it... this is just ununderstandable & STUPID ! ) and always show a security dialog... bravo... clap clap to Sun to always bring to its users new Java versions always more broken and hard to install and always modifying the way old Applet run ensuring hyper-incompatibility between version, this way you are sure that java will always be stamped : Java programme once run nowhere the same or break after some monthes (when java is updated...), nice...
@Sun : you know what ? call Microsoft and ask them how you should do to maintain retro-compatibilty ? no ? because they are fareaway better for such things, even the very old 1.1 still work nearly as nice as the lastest sun release
Java has been the best language ever thinked but the lack of effort into the plugin/JRE to maintain retro-compatibility and even compatibility make it become useless for anything that requiere compatibility and especially over long periods
each plugin release Sun demonstrate the Murphy law ....
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5870 Medals: 255
Hand over your head.
|
 |
«
Reply #29 on:
2010-04-06 07:56:14 » |
|
Anybody got time to roll our own plugin? 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
|