Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java Security  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 java的RSA加密问题,请各位大侠指点!!!
chsh_xiao





发贴: 1
积分: 0
于 2005-10-02 16:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
部分源程序如下:
private void rsaEncyption() throws Exception {
FileInputStream f=new FileInputStream("C:\\temp\\key\\key_RSA_pub.dat");
ObjectInputStream ob=new ObjectInputStreamRose;
RSAPublicKey k=(RSAPublicKey)ob.readObject();
Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding");
cp.init(Cipher.ENCRYPT_MODE,k);
FileInputStream in=new FileInputStream("C:\\temp\\files\\testMD.txt");
FileOutputStream out=new FileOutputStream("C:\\temp\\files\\test_Enc_RSA.txt");
CipherOutputStream cout=new CipherOutputStream(out, cp);
while( (b=in.read())!=-1){
cout.writeBeer;
}
cout.close();
out.close();
in.close();
}
上面是我的代码,这是一个RSA的加密程序,编译能通过,但运行时出现如下错误:
com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey
请各位大侠指教!!!



作者 Re:java的RSA加密问题,请各位大侠指点!!! [Re:chsh_xiao]
menzy



版主


发贴: 754
积分: 113
于 2005-10-08 07:33 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
那个是错误信息么?太粗糙了


作者 Re:java的RSA加密问题,请各位大侠指点!!! [Re:chsh_xiao]
Deo2005





发贴: 2
积分: 0
于 2005-11-20 21:04 user profilesend a private message to usersend email to Deo2005search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这是段从《Java安全性编程实例》书上拷贝的加密程序段,你缺少先前生成的密钥,所以出错。



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923