【发布时间】:2018-05-19 02:59:43
【问题描述】:
我想在客户端和服务器之间建立 tls/ssl 连接(不是相互的,一种方式)。
这是我的设置:
服务器:
Server server = ServerBuilder.forPort(8443)
// Enable TLS
.useTransportSecurity(certChainFile, privateKeyFile)
.addService(new GreetingServiceImpl())
.build();
客户
// With server authentication SSL/TLS
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8443)
.build();
GreetingServiceGrpc.GreetingServiceBlockingStub stub =
GreetingServiceGrpc.newBlockingStub(channel);
我只需要 终端命令 来生成 certChainFile 和 privateKeyFile(in .pem) 以将这些文件传递给服务器代码,如上所示.
【问题讨论】: