java 安全套接字连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7452201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 20:01:46  来源:igfitidea点击:

Secure socket connection

javasockets

提问by hogni89

I'm working on a school project with a server application that holds centralized data, and client applications that hold cached data that will be synchronized with sockets. Everything is written in Java.

我正在处理一个学校项目,其中包含一个保存集中数据的服务器应用程序和一个保存将与套接字同步的缓存数据的客户端应用程序。一切都是用Java编写的。

What is good practice? How can I stop people from listening to my traffic? Or prevent people to understand what is said?

什么是好的做法?我怎样才能阻止人们收听我的流量?或者阻止人们理解所说的内容?

采纳答案by user207421

SSL is the standard practice. See the javax.net.sslpackage, and the JSSE Reference Guide. But this may be beyond the scope of your project or your abilities at this stage. Check with your instructor.

SSL 是标准做法。请参阅javax.net.ssl包和JSSE 参考指南。但这可能超出了您的项目范围或现阶段的能力。请咨询您的导师。

回答by RHT

You simply use SSLSocketFactoryinstead of SocketFactory for your client server application. That way, the communication between the two will be totally encrypted. You can secure your client server app in less than a day, if you know basic Java. Here's a tutorial.

您只需将SSLSocketFactory而不是 SocketFactory 用于您的客户端服务器应用程序。这样,两者之间的通信将被完全加密。如果您了解基本的 Java,您可以在不到一天的时间内保护您的客户端服务器应用程序。这是一个教程