可以不给客户端提供public证书吗?
Is it possible to do not provide public certificate to client?
我正在尝试用码头制作一个 ssl 网络服务器,但如果任何客户端尝试连接,我不想提供服务器证书。在正常情况下,任何人都可以下载服务器证书,信任并连接到服务器。但是我想在我的客户端上手动安装服务器证书,以确保只有我的客户端拥有该证书并且可以连接到我的服务器。
这可能吗?我在网上找不到任何与 Jetty 相关的内容。
我正在玩一些示例代码和我的信任库。没什么特别的。
final Server server = new Server();
server.setHandler(new HelloWorld());
final HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSecureScheme("https");
httpConfiguration.setSecurePort(8085);
final ServerConnector http = new ServerConnector(server,
new HttpConnectionFactory(httpConfiguration));
http.setPort(8081);
server.addConnector(http);
final SslContextFactory sslContextFactory = new SslContextFactory("mykey.jks");
sslContextFactory.setKeyStorePassword("tester");
sslContextFactory.setNeedClientAuth(true);
final HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
final ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfiguration));
httpsConnector.setPort(8085);
server.addConnector(httpsConnector);
server.start();
server.join();
我知道,这是一个特殊的用例。如果有更好的解决方案,请告诉我(不,登录会话不适合我)。它必须尽可能简单。
而不是尝试 security though obscurity you should implement Two Way SSL. You can take a look at 2-Way SSL with Java: The Keystore Strikes Back 文章。
客户端总是可以盲目地信任或忽略服务器提供的任何证书。只要有人知道服务器地址,他们就可以发出请求。
我正在尝试用码头制作一个 ssl 网络服务器,但如果任何客户端尝试连接,我不想提供服务器证书。在正常情况下,任何人都可以下载服务器证书,信任并连接到服务器。但是我想在我的客户端上手动安装服务器证书,以确保只有我的客户端拥有该证书并且可以连接到我的服务器。
这可能吗?我在网上找不到任何与 Jetty 相关的内容。
我正在玩一些示例代码和我的信任库。没什么特别的。
final Server server = new Server();
server.setHandler(new HelloWorld());
final HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSecureScheme("https");
httpConfiguration.setSecurePort(8085);
final ServerConnector http = new ServerConnector(server,
new HttpConnectionFactory(httpConfiguration));
http.setPort(8081);
server.addConnector(http);
final SslContextFactory sslContextFactory = new SslContextFactory("mykey.jks");
sslContextFactory.setKeyStorePassword("tester");
sslContextFactory.setNeedClientAuth(true);
final HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
final ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfiguration));
httpsConnector.setPort(8085);
server.addConnector(httpsConnector);
server.start();
server.join();
我知道,这是一个特殊的用例。如果有更好的解决方案,请告诉我(不,登录会话不适合我)。它必须尽可能简单。
而不是尝试 security though obscurity you should implement Two Way SSL. You can take a look at 2-Way SSL with Java: The Keystore Strikes Back 文章。
客户端总是可以盲目地信任或忽略服务器提供的任何证书。只要有人知道服务器地址,他们就可以发出请求。