Signed Java applet doesnt get permissions in Safari

喜欢而已 提交于 2019-12-06 14:45:47

Once you have your jar compiled and signed you should run the -verify option to ensure its signed properly.

If the verification is ok look at the installed certificates on your browsers. I haven't done anything in Safari only IE, but I imagine there is a place similar to I.E. where you can at least view the installed certificates. I would verify the certificate is installed.

Also make sure your code is running in a privileged block.

 String home = System.getProperty("user.home");

will always throw an error in 1.4 or higher. Unless you have edited the java.policy file for All Permissions

Try using this in combination with your signed jar.

 String home = (String) AccessController.doPrivileged(new PrivilegedAction() 
 {
      public Object run() 
      {
     return System.getProperty("user.home");
      }
 });

Has the user accepted full access for your applet in Safari? Sounds like the security manager kicking in.

I remember having a similar problem in an older version of Safari (this was years ago), and the solution I found was adding a delay to the applet. It seemed Safari for some reason was allowing the applet to run before the user was given the "trust this applet" dialogue (other browsers would not start the applet until after the user granted or denied access). At that point the applet was not trusted and a security exception would occur. Even though the user would then allow trust, it was too late as the applet had already run and failed. I had to add a delay for safari, so it would not try doing anything that needed secure access until a period of time had passed, allowing the user to give access before the applet tried doing anything needing security access.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!