java实现的简易版网络聊天加密通信程序

上传者: 36944952 | 上传时间: 2021-05-19 16:29:10 | 文件大小: 49KB | 文件类型: ZIP
先运行safechat包里的greetigserver.class,之后运行greetingclient.class即可。 如遇报错,请参考:https://blog.csdn.net/fengzun_yi/article/details/104497160 实现过程: 1. 采用TCP通信协议完成接收者发送者双方的消息传递。 2. 利用Diffie-Hellman密钥交换协议生成对称加密通信的通信密钥。 3. 为防止中间人攻击,采用RSA非对称加密算法协助DH算法完成密钥交换。具体过程如下: a. 接收者与发送者双方各自利用RSA算法生成自己的公私钥,并生成数字证书,并在一个CA进行认证。 b. 在DH密钥交换阶段,A生成A的DH协商密钥用于发送给B,该密钥与接收方私钥生成最终通信密钥。发送DH密钥时,A先用自己的私钥加密DH协商密钥,再去CA获得一个真实的B的公钥,用B的公钥对加密过的协商密钥再做一次加密,发送给B。(因为是用B的公钥加密过,只有B有B的私钥,所以接收信息只有B自己可以解密查看,又因为是用A的私钥加密过的,只有A有A的私钥,所以只有用A的公钥可以进行解密,所以可以保证协商密钥确实是A发送过来的,而且发送的信息也无法被中间人解密。)B收到信息之后,先用自己的私钥解密,然后去CA获得A的公钥再对消息解密一次,获得A的DH密钥。B发给A的过程同上。 c. 之后双方执行DH生成本地密钥的过程。A利用B发送过来的密钥和A的DH私钥生成通信密钥。B利用A发送过来的密钥和B的DH私钥生成通信密钥。根据DH原理,两者生成的通信密钥是相同的。 4. 利用上一步生成的通信密钥,采用AES对称加密算法进行加密通信。 为了方便起见,并没用对A和B双方进行颁发证书的操作,A的公钥默认B已经从CA获得,B的公钥默认A已经从CA获得。并且采用java控制台交互,仅仅为演示原理及简单效果。

文件下载

资源详情

[{"title":"( 33 个子文件 49KB ) java实现的简易版网络聊天加密通信程序","children":[{"title":"InternetSecurity","children":[{"title":"src","children":[{"title":"Safechat","children":[{"title":"GreetingClient.java <span style='color:#111;'> 4.67KB </span>","children":null,"spread":false},{"title":"MyJScrollPaneright.java <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"GreetingServer.java <span style='color:#111;'> 5.74KB </span>","children":null,"spread":false},{"title":"ChatWindow.java <span style='color:#111;'> 3.80KB </span>","children":null,"spread":false},{"title":"MyJScrollPaneleft.java <span style='color:#111;'> 1.09KB </span>","children":null,"spread":false}],"spread":true},{"title":"EncryptionAlgorithm","children":[{"title":"BDH.java <span style='color:#111;'> 4.67KB </span>","children":null,"spread":false},{"title":"AESUtil.java <span style='color:#111;'> 3.33KB </span>","children":null,"spread":false},{"title":"ADH.java <span style='color:#111;'> 4.28KB </span>","children":null,"spread":false},{"title":"RSAUtil.java <span style='color:#111;'> 3.88KB </span>","children":null,"spread":false},{"title":"ByteTohexString.java <span style='color:#111;'> 1.44KB </span>","children":null,"spread":false},{"title":"DESEncryptUtil.java <span style='color:#111;'> 2.74KB </span>","children":null,"spread":false},{"title":"DHUtil.java <span style='color:#111;'> 5.92KB </span>","children":null,"spread":false}],"spread":true},{"title":"RC4","children":[{"title":"RC4.java <span style='color:#111;'> 1.83KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"bin","children":[{"title":"Safechat","children":[{"title":"MyJScrollPaneleft$1.class <span style='color:#111;'> 851B </span>","children":null,"spread":false},{"title":"ChatWindow$2.class <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"ChatWindow$1.class <span style='color:#111;'> 737B </span>","children":null,"spread":false},{"title":"GreetingClient.class <span style='color:#111;'> 5.31KB </span>","children":null,"spread":false},{"title":"MyJScrollPaneright.class <span style='color:#111;'> 1.42KB </span>","children":null,"spread":false},{"title":"ChatWindow.class <span style='color:#111;'> 2.92KB </span>","children":null,"spread":false},{"title":"MyJScrollPaneleft.class <span style='color:#111;'> 1.48KB </span>","children":null,"spread":false},{"title":"MyJScrollPaneright$1.class <span style='color:#111;'> 855B </span>","children":null,"spread":false},{"title":"GreetingServer.class <span style='color:#111;'> 5.60KB </span>","children":null,"spread":false}],"spread":true},{"title":"EncryptionAlgorithm","children":[{"title":"RSAUtil.class <span style='color:#111;'> 4.60KB </span>","children":null,"spread":false},{"title":"ByteTohexString.class <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"DESEncryptUtil.class <span style='color:#111;'> 3.10KB </span>","children":null,"spread":false},{"title":"BDH.class <span style='color:#111;'> 4.94KB </span>","children":null,"spread":false},{"title":"ADH.class <span style='color:#111;'> 4.63KB </span>","children":null,"spread":false},{"title":"DHUtil.class <span style='color:#111;'> 5.50KB </span>","children":null,"spread":false},{"title":"AESUtil.class <span style='color:#111;'> 3.37KB </span>","children":null,"spread":false}],"spread":true},{"title":"RC4","children":[{"title":"RC4.class <span style='color:#111;'> 2.60KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".classpath <span style='color:#111;'> 458B </span>","children":null,"spread":false},{"title":".settings","children":[{"title":"org.eclipse.jdt.core.prefs <span style='color:#111;'> 598B </span>","children":null,"spread":false}],"spread":true},{"title":".project <span style='color:#111;'> 392B </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明