Pfx证书和ksoap2 - android

时间:2016-12-19 12:37:54

标签: android ssl ksoap2

我想连接到网络服务,我正在使用kso​​ap2。我正在使用pfx cert文件。

这是代码:

KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(new FileInputStream("/pathToFile/cert.pfx"), "password".toCharArray());
KeyManagerFactory kmf = KeyManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
kmf.init(ks, "password".toCharArray());
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), null, null);

HttpsTransportSE httpTransport = new HttpsTransportSE("10.10.8.221", 1246, "/WebService?singleWsdl", timeOut);
((HttpsServiceConnectionSE) httpTransport.getServiceConnection()).setSSLSocketFactory(sslContext.getSocketFactory());

当我跑步时

httpTransport.call("... 

我收到以下错误:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

有任何建议吗?

0 个答案:

没有答案
相关问题