如何使用CXF webClient配置SSLv2Hello?

时间:2015-05-26 15:37:27

标签: java ssl cxf webclient sslv2

我正在使用CXF开发REST Web服务。我有一个使用证书接受SSL连接的apache。

我想用org.apache.cxf.jaxrs.client.WebClient类测试我的代码,但由于以下原因我无法与apache通信:

javax.net.ssl.SSLException: java.lang.IllegalArgumentException:
SSLv2Hello   cannot be enabled unless at least one other supported
version is also enabled.

我尝试像这样配置HttpConduit:

TLSClientParameters tlsParams = new TLSClientParameters();
KeyStore trustStore = KeyStore.getInstance(KEYSTORE_TYPE);
InputStream inputStream = WesRctAbstractTestcase.class.getClassLoader().getResourceAsStream(KEYSTORE_PATH);
trustStore.load(inputStream, KEYSTORE_PASSWORD.toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(trustStore);
TrustManager[] tms = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tms);
tlsParams.setSecureSocketProtocol("SSL");
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);

我不明白缺少什么。

0 个答案:

没有答案