当前位置: 技术问答>java相关
请问怎么样通过数字签名使得Applet能访问本地文件系统和打印机
来源: 互联网 发布时间:2015-05-09
本文导语: 最好有例子 100分 谢谢 | http://www.csdn.net/expert/topic/476/476203.xml?temp=.8232233 http://www.csdn.net/expert/topic/489/489936.xml?temp=.4041712 | sun的教程security一章就有如何签名的。 http://java.sun.com/...
最好有例子
100分
谢谢
100分
谢谢
|
http://www.csdn.net/expert/topic/476/476203.xml?temp=.8232233
http://www.csdn.net/expert/topic/489/489936.xml?temp=.4041712
http://www.csdn.net/expert/topic/489/489936.xml?temp=.4041712
|
sun的教程security一章就有如何签名的。
http://java.sun.com/docs/books/tutorial/security1.2/toolsign/index.html
http://java.sun.com/docs/books/tutorial/security1.2/toolsign/index.html
|
那去看看:
http://www.cn-java.com/target/news.php?news_id=515
http://www.asperfect.com/netschool/PG/2002-1-28/143854.html
http://www.cn-java.com/target/news.php?news_id=515
http://www.asperfect.com/netschool/PG/2002-1-28/143854.html
|
看看底下的(能访问本机系统文件已经实现交流内容的保存):
// JMFPolicySection
// Note: Use jdk1.2.2 or later
// Due to jdk bug 4189625, when using an applet, you will get
// "SecurityException: Access denied to ThreadGroup not owned by applet"
// This bug has been fixed in jdk1.2.2
grant {
//////////////////////////////////////////////////////
// Needed to play file: protocol
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "user.home", "read";
permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "java.class.path", "read";
permission java.util.PropertyPermission "user.name", "read"; // for RTP
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
permission java.lang.RuntimePermission "accessClassInPackage.sun.audio";
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "loadLibrary.*";
permission java.io.FilePermission "", "read";
// Note: If write permission for jmf.log is not there, you can still play
// file:, but the jmf.log won't be written.
permission java.io.FilePermission "${user.dir}${/}jmf.log", "write";
permission java.io.FilePermission "${user.home}${/}.JMStudioCfg", "write";
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// For http, ftp protocol
// You need 'accept' permission for rtp
permission java.net.SocketPermission "*", "connect,accept";
// JMFPolicyCacheDir
permission java.io.FilePermission "C:\WINNT\TEMP\*", "write";
permission java.io.FilePermission "C:\WINNT\TEMP\*", "delete";
/////////////////////////////////////////////////////
permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
permission javax.sound.sampled.AudioPermission "record";
permission java.net.SocketPermission "-", "listen";
permission java.net.SocketPermission "-", "accept";
permission java.net.SocketPermission "-", "connect";
permission java.net.SocketPermission "-", "resolve";
permission java.security.AllPermission;
};
grant SignedBy "saili" {
permission java.net.SocketPermission "-", "listen";
permission java.net.SocketPermission "-", "accept";
permission java.net.SocketPermission "-", "connect";
permission java.net.SocketPermission "-", "resolve";
permission java.security.AllPermission;
};
// JMFPolicySection
// Note: Use jdk1.2.2 or later
// Due to jdk bug 4189625, when using an applet, you will get
// "SecurityException: Access denied to ThreadGroup not owned by applet"
// This bug has been fixed in jdk1.2.2
grant {
//////////////////////////////////////////////////////
// Needed to play file: protocol
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "user.home", "read";
permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "java.class.path", "read";
permission java.util.PropertyPermission "user.name", "read"; // for RTP
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
permission java.lang.RuntimePermission "accessClassInPackage.sun.audio";
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "loadLibrary.*";
permission java.io.FilePermission "", "read";
// Note: If write permission for jmf.log is not there, you can still play
// file:, but the jmf.log won't be written.
permission java.io.FilePermission "${user.dir}${/}jmf.log", "write";
permission java.io.FilePermission "${user.home}${/}.JMStudioCfg", "write";
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// For http, ftp protocol
// You need 'accept' permission for rtp
permission java.net.SocketPermission "*", "connect,accept";
// JMFPolicyCacheDir
permission java.io.FilePermission "C:\WINNT\TEMP\*", "write";
permission java.io.FilePermission "C:\WINNT\TEMP\*", "delete";
/////////////////////////////////////////////////////
permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
permission javax.sound.sampled.AudioPermission "record";
permission java.net.SocketPermission "-", "listen";
permission java.net.SocketPermission "-", "accept";
permission java.net.SocketPermission "-", "connect";
permission java.net.SocketPermission "-", "resolve";
permission java.security.AllPermission;
};
grant SignedBy "saili" {
permission java.net.SocketPermission "-", "listen";
permission java.net.SocketPermission "-", "accept";
permission java.net.SocketPermission "-", "connect";
permission java.net.SocketPermission "-", "resolve";
permission java.security.AllPermission;
};