Pfx certificate and ksoap2 - android

128 views Asked by At

i want to connect to web service and i'm using ksoap2. I'm using pfx cert file.

Here is code:

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());

And when i'm running

httpTransport.call("... 

I get following error:

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

Any advise?

0

There are 0 answers