签名的小程序可以与它们所源自的不同主机连接吗?

发布于 2024-07-14 07:20:45 字数 607 浏览 10 评论 0原文

我需要一个小程序来打开套接字并与侦听的服务器进行通信 小程序下载到的本地主机(最终用户计算机)。

与我读到的有关小程序安全性的内容相反,似乎甚至签名的小程序 无法打开到下载它们的不同主机的套接字(在同一台机器上它工作完美)

我已经使用 -selfcert 认证了小程序,使用 jarsigner 对其进行了签名,并且仍然,每当 它尝试打开到不同主机的套接字,我得到:

Java.lang.Exception:java.security.AccessControlException:访问被拒绝(java.net.SocketPermission 127.0.0.1:9999 connect,resolve)

我什至尝试更改 Java 策略文件,尽管使用签名的小程序不需要这样做:

grant codeBase "http://applethost:8080/socket" { 权限 java.security.AllPermission; 权限 java.lang.RuntimePermission "usePolicy"; sigend小

程序有什么用,它们可以连接到不同的主机吗?

I need an applet to open a socket and communicate with a server listening on
the local host to which the applet downloaded (the end user machine).

contrary to what I have read about applet security, it seems that even signed applets
cannot open a socket to a different host from which they were downloaded (on the same machine it works perfectly)

I have certified the applet using -selfcert, signed it using jarsigner, and still, whenever
it tries to open a socket to a different host, I get:

Java.lang.Exception: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:9999 connect,resolve)

I even tried changing the Java policy file, although with signed applets it is not required to do so:

grant codeBase "http://applethost:8080/socket" {
permission java.security.AllPermission;
permission java.lang.RuntimePermission "usePolicy";
};

What is the deal with sigend applets, can they connet to a different host or not?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜巴黎 2024-07-21 07:20:45

是的,当你加载你的小程序时,如果你选择接受它的证书并信任它,它就会被授予AllPermission,其中包括SocketPermission。 我之前编写了一个签名的小程序,它连接到加载它的主机以外的主机。 您可以尝试暂时更改您的 java 策略文件,以便

grant {
  permission java.security.AllPermission;
};
  • 在您的策略文件中查看它是否定义了任何其他policy.url 位置,也许它们正在干扰。
  • 也许检查你的浏览器设置是否有 JavaScript。
  • 确保您接受该小程序的证书并将其安装到您的站点证书列表中。
  • 确保您拥有的 grant codeBase 行与小程序清单中的代码库相同。
  • 在尝试连接之前,您可以尝试打印出您的小程序拥有的权限列表。
  • 您可以尝试从小程序内以编程方式授予 AllPermission。

Yes, when you load your applet, if you choose to accept its certificate and trust it, it is granted AllPermission, which includes SocketPermission. I have written a signed applet before that connects to a host other than the one from which it was loaded. You could try temporarily changing your java policy file to just have

grant {
  permission java.security.AllPermission;
};
  • Look in your policy file to see if it defines any other policy.url locations, perhaps they are interfering.
  • Check your browser settings for javascript maybe.
  • Make sure that you accepted the certificate for the applet and that it gets installed to your list of site certificates.
  • Make sure the grant codeBase line you have is the same as the codebase in your applet's manifest.
  • You could try printing out the list of permissions that your applet has before you try the connect.
  • You could try to programatically grant AllPermission from within the applet.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文