bobjob
|
 |
«
Posted
2010-02-26 12: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
|
 |
«
Reply #1 - Posted
2010-02-26 13:27:40 » |
|
|
|
|
|
Riven
|
 |
«
Reply #2 - Posted
2010-02-26 17: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! Check 'em out!
|
|
h3ckboy
|
 |
«
Reply #3 - Posted
2010-02-26 17:46:42 » |
|
haha, this is awesome. I have been wanting ot do this for a while 
|
|
|
|
DzzD
|
 |
«
Reply #4 - Posted
2010-02-26 17: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
|
 |
«
Reply #5 - Posted
2010-02-26 18: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
|
 |
«
Reply #6 - Posted
2010-02-26 22: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
|
 |
«
Reply #7 - Posted
2010-02-26 23: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
|
 |
«
Reply #8 - Posted
2010-02-26 23: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
|
 |
«
Reply #9 - Posted
2010-02-26 23:58:49 » |
|
1
| PrivilegedAction>Object<() |
I think the '<' '>' characters are ment to be flipped around?
|
|
|
|
Games published by our own members! Check 'em out!
|
|
ryanm
|
 |
«
Reply #10 - Posted
2010-02-26 23: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
|
 |
«
Reply #11 - Posted
2010-02-27 00: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
|
 |
«
Reply #12 - Posted
2010-02-27 21: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
|
 |
«
Reply #13 - Posted
2010-02-27 21: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
|
 |
«
Reply #14 - Posted
2010-02-27 22: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
|
 |
«
Reply #15 - Posted
2010-02-27 22: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
|
 |
«
Reply #17 - Posted
2010-02-27 23: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
|
 |
«
Reply #18 - Posted
2010-02-27 23: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
|
 |
«
Reply #19 - Posted
2010-02-27 23: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
|
 |
«
Reply #20 - Posted
2010-02-27 23: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
|
 |
«
Reply #21 - Posted
2010-02-27 23: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
|
 |
«
Reply #22 - Posted
2010-02-27 23:26:25 » |
|
Pageflip applet works for me. (Windows 7 64 bit Java 1.6). Shows certificate warning when I press button.
|
|
|
|
Riven
|
 |
«
Reply #23 - Posted
2010-02-27 23: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
|
 |
«
Reply #24 - Posted
2010-02-28 00: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
|
 |
«
Reply #25 - Posted
2010-02-28 00:24:20 » |
|
yeah, its actually the sockets that were my main concern.
|
|
|
|
Riven
|
 |
«
Reply #26 - Posted
2010-04-06 09:44:22 » |
|
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
DzzD
|
 |
«
Reply #27 - Posted
2010-04-06 10: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 - Posted
2010-04-06 11: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
|
 |
«
Reply #29 - Posted
2010-04-06 11: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!
|
|
|
|