我正在使用glassfish.jersey和io.netty库创建HTTP / HTTPS服务器。
这是我的代码段:
SslContext sslCtx = null;
ResourceConfig resourceConfig = new ResourceConfig(RestController.class);
// this is a self signed certificate generated with openssl
File tlsCert = new File(path_tls_cert);
File tlsKey = new File(path_tls_key);
SslContextBuilder builder = SslContextBuilder.forServer(tlsCert, tlsKey);
sslCtx = builder.build();
Channel server =
NettyHttpContainerProvider.createHttp2Server(URI.create(base_uri + ":" +
port + "/"),
resourceConfig, sslCtx);
实际上,我使用的是由openssl生成的自签名证书。
如何为io.netty服务器获取受信任的SSL证书?