我现在对Applet数字签名有点疑惑,我在服务器端有一个Test.jar文件,它调用每一个客户端的Writer.jar文件进行对C盘写操作。注意这里Test.jar文件在服务端,Writer.jar文件是在每一个客户端都存在。代码如下
public class Test extends JApplet{
public void start()
{
new Write().write() ;
}
}public class Write
{
public void write()
{
try
{
FileWriter write = new FileWriter("C:/temp.txt") ;
write.write("abcdef") ;
write.flush() ;
write.close() ;
}
catch(Exception e)
{
e.printStackTrace() ;
}
}
}我的签名如下
keytool -genkey -keystore pepper.store -alias pepperkeytool -export -keystore pepper.store -alias pepper -file pepper.certjarsigner -keystore pepper.store Test.jar pepperjarsigner -keystore pepper.store Writer.jar pepper
(这里的Writer.jar文件是签名后在每一个客户端都存在)每一个客户端的JAVA_plugin 的JAVA RunTime参数设置如下
-classpath C:/src/Write.jar服务器端的client.policy文件内容如下keystore "file:http://10.0.0.4:8080/testsign/pepper.store", "JKS";grant signedBy "pepper"
{ permission java.security.AllPermission;
};客户端的jre/lib/java.security添加了下面一句
policy.url.3=http://10.0.0.4:8080/testsign/client.policy服务端的Test.html文件内容如下
<applet code="Test.class" archive="Test.jar" width=800,height=600></applet>但我在客户端访问时,他提示启用证书,确定后,但客户端还是报没有权限错误,但如果我将Writer.jar文件也放在服务器端Test.html文件内容如下
<applet code="Test.class" archive="Test.jar,Writer.jar" width=800,height=600></applet>这时客户端是可以写C盘文件的但我的现实情况是这样的,Writer.jar文件很大,在每一个客户端都存在,只是要对Test.jar文件进行签名,请问要如何做,非常感谢!
public class Test extends JApplet{
public void start()
{
new Write().write() ;
}
}public class Write
{
public void write()
{
try
{
FileWriter write = new FileWriter("C:/temp.txt") ;
write.write("abcdef") ;
write.flush() ;
write.close() ;
}
catch(Exception e)
{
e.printStackTrace() ;
}
}
}我的签名如下
keytool -genkey -keystore pepper.store -alias pepperkeytool -export -keystore pepper.store -alias pepper -file pepper.certjarsigner -keystore pepper.store Test.jar pepperjarsigner -keystore pepper.store Writer.jar pepper
(这里的Writer.jar文件是签名后在每一个客户端都存在)每一个客户端的JAVA_plugin 的JAVA RunTime参数设置如下
-classpath C:/src/Write.jar服务器端的client.policy文件内容如下keystore "file:http://10.0.0.4:8080/testsign/pepper.store", "JKS";grant signedBy "pepper"
{ permission java.security.AllPermission;
};客户端的jre/lib/java.security添加了下面一句
policy.url.3=http://10.0.0.4:8080/testsign/client.policy服务端的Test.html文件内容如下
<applet code="Test.class" archive="Test.jar" width=800,height=600></applet>但我在客户端访问时,他提示启用证书,确定后,但客户端还是报没有权限错误,但如果我将Writer.jar文件也放在服务器端Test.html文件内容如下
<applet code="Test.class" archive="Test.jar,Writer.jar" width=800,height=600></applet>这时客户端是可以写C盘文件的但我的现实情况是这样的,Writer.jar文件很大,在每一个客户端都存在,只是要对Test.jar文件进行签名,请问要如何做,非常感谢!
解决方案 »
- jsmooth做的java exe文件不能运行,提示错误为"could not find the main class,program will exit"
- 如何在application程序中播放声音剪辑?
- 我是个初学者,想请教一个参数问题?
- 请高手帮忙,关于如何从http包里取得数据的问题
- 小弟想做邮件开发,不知从什么地方入手,能否给点意见谢谢了,javamail服务器什么地方有呀
- 这么写可以吗 抱错!!!
- 请给一个用java写的telnet客户端原码,分数不够我再给
- java中主方法的参数作用是什么
- 急需繁体与简体的对照表!!!先谢谢了,各位
- Java反射通过setAccessible(true)真的改变了final属性值么?
- 一个不可达的错误!编译器无法解析!
- 正则表达式 大哥们帮忙
java.sun.com 的tutorial 上有用apple 在本地写一个文件的例子:
http://java.sun.com/docs/books/tutorial/security1.2/tour1/
但只能用AppletViewer 可以看:
appletviewer http://java.sun.com/docs/books/tutorial/security1.2/tour1/example-1dot2/WriteFile.html
又在[阿费]的帮助下找到可以用ie or Nescape 查看你的applet 的例子:
http://www.intelligentsearch.org/namesearch_from_java.htm#_Toc490550108大致过程如下::服务器端:
1。 Compile the java classes --写applet并编译。
javac *.class
2. Place the class files in a JAR file --打包:
jar cvf yourjarname.jar yourdir/*.class
1). Create a Keystore and Keys for signing the JAR file
keytool –genkey –keystore ist.keystore –alias IST
2). Sign the JAR file --对jar 签名
jarsigner –keystore ist.keystore ist.jar IST
3). Create the Public Key Certificate --创建公钥
keytool –export –keystore ist.keystore –alias IST –file IstPubKey.cert
客户端: 1。Import the Public Key Certificate --导入公钥
keytool –import –alias IST –file IstPubKey.cert –keystore client.store
2。Modifing a policy file --修改 policy文件
3。 Run the applet --运行applet
!!! 这还只能用Applet viewer 查看你的applet
用ie访问:
First, the <APPLET> tag will not be able to activate the Java Plug-in for use in IE. This tag should be substituted by the <OBJECT> tag
---由于IE 的java Plug-in 不能被<APPLET>标签激活。你还要将他换成<OBJECT>标签。 these changes to the HTML file can also be done with the help of HTMLConverter. You can go to download this software from http://java.sun.com/products/plugin/index.html.
---- 这样你还要去下一个HTMLConverter
---- 将经过转换的html 和 class 文件copy 到你的服务器上。
-- 好了。终于可以享受一下成果了。
用ie 访问:http://yourserver: youreport/WriteFile.html
还不行??
--IE 还要下载Plug-in 才能执行,
在1小时加26分46秒后:
kao ,终于在本地写了一个文件。
-classpath C:/src/Write.jar