如何通过普通Java Sockets实现(SSL/TLS)安全通信
如何确保普通套接字通信的安全?我编写了一个只能连接到专用 SSL 端口(5223)(使用 SSLSocket)的 Jabber 客户端。正常的方法是连接到 Jabber 标准端口 5222 并请求 starttls
。我怎样才能做到这一点?
How can I secure ordinary socket communication? I wrote a Jabber client that can only connect to dedicated SSL ports(5223) (using SSLSocket). The normal way is to connect to Jabber standard port 5222 and request starttls
. How can I achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不完全确定您在问什么,但您可以使用 SSLSocketFactory.createSocket() 方法。这是使用诸如 starttls 之类的东西“升级”套接字的一种方法。但这样做是很困难的。几乎可以肯定,您的 XMPP 库将提供对此类功能的高级访问。
I'm not completely sure what you are asking, but you can layer a secure socket on an existing normal (non-secure) socket by using the SSLSocketFactory.createSocket() method. This is one way to "upgrade" a socket using something like starttls. But this is doing things the hard way. Almost certainly your XMPP library will provide high-level access to this kind of functionality.
期望管理:我还没有在 Jabber 上尝试过这个。但它适用于 GMail 的 SMTP 服务器,所以也许...
以下是将套接字升级为 SSL 套接字的方法,其中
socket
是原始(非 TLS)连接:Expectation Management: I haven't tried this with Jabber. But it works with GMail's SMTP server, so maybe...
Here's how to upgrade a socket to an SSL socket, where
socket
is the original (non-TLS) connection: