Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Signing and Digital Certificates  (Read 8284 times)
0 Members and 1 Guest are viewing this topic.
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline ryanm

Senior Member


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #1 - Posted 2010-02-26 13:27:40 »

Something like this?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2010-02-26 17:04:21 »

 persecutioncomplex

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!
Legends of Yore - The Casual Retro Roguelike
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #3 - Posted 2010-02-26 17:46:42 »

haha, this is awesome. I have been wanting ot do this for a while Smiley
Offline DzzD
« Reply #4 - Posted 2010-02-26 17:58:34 »

haha, this is awesome. I have been wanting ot do this for a while Smiley
so you should have looked to 3DzzD before ! Tongue


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.

Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2010-02-26 18:04:02 »

so you should have looked to 3DzzD before ! Tongue
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
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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  persecutioncomplex

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline Momoko_Fan

Junior Member


Medals: 2



« 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.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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! Wink

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #9 - Posted 2010-02-26 23:58:49 »

1  
PrivilegedAction>Object<()

I think the '<' '>' characters are ment to be flipped around?

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ryanm

Senior Member


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #10 - Posted 2010-02-26 23:59:52 »

SWEEEET! thanx bleb and Riven.
Haha! Gratitude successfully stolen! Grin

All props to Riven, I only spotted the post while nicking his LUT-based trig functions.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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 &gt; and &lt;

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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()"
Quote
The method run() of type new PrivilegedAction<Object>(){} must override a superclass method

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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)

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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. Roll Eyes

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
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #16 - Posted 2010-02-27 23:10:45 »

Could you test it here?

http://pageflip.betaproject.nl/html/applet/pageflip_applet.html


Click the [full system access] button in the bottom-right corner

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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:
Quote
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();
      }
   }
}

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« 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.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline Momoko_Fan

Junior Member


Medals: 2



« 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.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #25 - Posted 2010-02-28 00:24:20 »

yeah, its actually the sockets that were my main concern.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #26 - Posted 2010-04-06 09:44:22 »

As of Java 6u19, Oracle effectively destroyed this technique Angry

http://riven8192.blogspot.com/2010/02/delaying-security-dialogs-in-java-until.html
http://java.sun.com/javase/6/docs/technotes/guides/jweb/mixed_code.html

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline DzzD
« Reply #27 - Posted 2010-04-06 10:46:53 »

 Undecided this is soooo stupid... it was still a secured solution and was enabling a better user experiences.... let see how it look ...

Offline 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 ....

Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #29 - Posted 2010-04-06 11:56:14 »

Anybody got time to roll our own plugin? Lips Sealed Roll Eyes

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (20 views)
2014-09-21 02:42:18

BurntPizza (14 views)
2014-09-21 01:30:30

moogie (14 views)
2014-09-21 00:26:15

UprightPath (25 views)
2014-09-20 20:14:06

BurntPizza (27 views)
2014-09-19 03:14:18

Dwinin (42 views)
2014-09-12 09:08:26

Norakomi (73 views)
2014-09-10 13:57:51

TehJavaDev (97 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56

mitcheeb (70 views)
2014-09-08 06:06:29
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!