Я пытаюсь подключиться к серверу компании с помощью HTTPS. Сертификаты сервера хранятся у всех клиентов (Windows), и я хочу настроить мое приложение Java для использования Windows Trust Store.static CloseableHttpClient getClientWindowsTrust() throws Exception {
System.setProperty("javax.net.ssl.trustStoreType", "Windows-ROOT");
SSLContext sslContext = SSLContext.getDefault();
DefaultClientTlsStrategy strat = new DefaultClientTlsStrategy(sslContext);
var connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
.setTlsSocketStrategy(strat)
.build();
return HttpClients.custom()
.setConnectionManager(connectionManager)
.build();
}
< /code>
Требуемые сертификаты находятся в Trust Store Windows, а другие приложения (которые, как я предполагаю, используют их) работают ОК. < /p>
Сообщение об ошибке: < /p>
TransportContext.java:363|Fatal (CERTIFICATE_UNKNOWN): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
< /code>
Что мне не хватает? Как я могу определить, где именно построение пути терпит неудачу?
Подробнее здесь: https://stackoverflow.com/questions/797 ... -using-ssl