是否可以附加证书而不在sslcontext的信任存储中存储
这是我的代码,而运行我的代码它不是x509格式的例外,我得到
@Bean(name="custRest")
@Primary
public RestTemplate restTemplate() throws Exception {
char[] password = "password".toCharArray();
SSLContext sslContext = SSLContextBuilder
.create()
.loadTrustMaterial(ResourceUtils.getFile("C:\\test\\test.der"), password,
new TrustSelfSignedStrategy())
.build();
HttpClient client = HttpClients.custom().setSSLContext(sslContext).build();
return new RestTemplateBuilder().requestFactory(new HttpComponentsClientHttpRequestFactory(client))
.build();
}
暂无答案!
目前还没有任何答案,快来回答吧!