简体   繁体   English

java netty(客户端/服务器)设置中的 TLS 服务器和普通 TCP 客户端(通过本地 LAN)

[英]TLS server and normal TCP client in java netty (Client/Server) setup (over local LAN)

I have a peer to peer (Client/Server) setup (over local LAN) , this is using Netty ,a java networking framework.我有一个peer to peer (Client/Server) setup (over local LAN) ,这是使用Netty ,一个 Java 网络框架。 I use raw TCP /IP (as in, no HTTP) for communication and transfers.我使用原始TCP /IP (如无 HTTP)进行通信和传输。 Now as per requirement we want to shift on TLS communication.现在根据要求,我们希望转向TLS通信。

(client using TLS) <-----> (TLS server) it works (使用 TLS 的客户端)<----->(TLS 服务器)它可以工作

(simple tcp client) <-----> (TLS server) doesn't work (简单的 tcp 客户端)<----->(TLS 服务器)不起作用

Please let me know how it will work请让我知道它将如何运作

Basically all you need to do is to add the SslHandler to the pipeline of both and configure it with the correct keys / certs.基本上,您需要做的就是将SslHandler添加到SslHandler的管道中,并使用正确的密钥/证书对其进行配置。

Something like:就像是:

SslContextBuilder builder = ...;
SslContext ctx = builder.build();
pipeline.addLast(ctx.newHandler(channel.alloc()));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM