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

您没有登录

» Java开发网 » Java Security  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
话题被移动
该话题已被移动 - floater , 2003-11-03 23:34
如果您尚不清楚该话题被移动的原因,请参考论坛规则以及本版公告或者联系本版版主。
作者 非常诚恳的请教各路高人,出来帮帮忙吧
jnfnet



发贴: 0
积分: 0
于 2003-11-03 00:37 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
小弟采取3-des算法加密文本,要用自定义密钥得方式,小弟采取以下的代码,但我发现生成SecretKey后, 我解开这个SecretKey的时候,这个key不同了,这是为什么呢?
System.out.println("key:"+byte2hex);//b=key
DESedeKeySpec desKeySpec = new DESedeKeySpec;
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
byte[] desEncode=secretKey.getEncoded();
System.out.println("desEncode:"+byte2hex(desEncode));//desEncode 解开key
我第一个println出来的结果是(16进制):
A01A36F544FBE02AF4783C04E3AB4E1C0000000000000000
第二个println出来的结果是(16进制):
A11A37F445FBE02AF4793D04E3AB4F1C0101010101010101
请问这是什么回事??



作者 Re:非常诚恳的请教各路高人,出来帮帮忙吧 [Re:jnfnet]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2003-11-03 23:31 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
I don't understand your point in your code(relations between these two),
but do you generate a new key?



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:非常诚恳的请教各路高人,出来帮帮忙吧 [Re:jnfnet]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2003-11-04 00:12 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
dont cross post, I delete your duplicated post.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code

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