0

Getting:

javax.net.ssl.SSLPeerUnverifiedException: No peer certificate error in Android for a web service.

I analyse the issue its about an certificate missing in my keyStore. This "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" web service is on my salesforce org but, how do I get an certificate from Salesforce which I can add to my KeyStore in android?

Below is my catlog if someone find it helpful.

I have checked this link "'No peer certificate' error in Android 2.3 but NOT in 4" but before that I need a certificate in my raw folder how do I do that without any certificate. I need Salesforce client certificate in my app.

`08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕
 javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ 
 at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSesionImpl.java:146)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at  org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at  org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:387)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
 08-13 10:53:04.150    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at scrapos.techila.com.scrapos.MainActivity$RequestDate.doInBackground(MainActivity.java:342)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at scrapos.techila.com.scrapos.MainActivity$RequestDate.doInBackground(MainActivity.java:311)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:137)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
 08-13 10:53:04.160    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
 08-13 10:53:04.170    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
 08-13 10:53:04.170    9152-9931/scrapos.techila.com.scrapos W/System.err﹕ at java.lang.Thread.run(Thread.java:856)
 08-13 10:53:27.240    9152-9152/scrapos.techila.com.scrapos W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
 08-13 10:53:27.240    9152-9152/scrapos.techila.com.scrapos W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
 08-13 10:53:27.240    9152-9152/scrapos.techila.com.scrapos W/IInputConnectionWrapper﹕ getExtractedText on inactive InputConnection` 
Community
  • 1
  • 1

1 Answers1

0

Android has set of trusted CA certificates list and you can see it under setting -> security -> trusted credentials. Older version of android does not have some set of CA certificates and became cause of such error. You could modify your code based on android version. If version less than 2.3 than by pass the certificate using own truststore [ example available on net] else use the your CA certificate.

Naveen Ramawat
  • 1,425
  • 1
  • 15
  • 27
  • I am working on v 4.1.2, and I know I am missing that certificate but my question is how can I get that ssl client certificate from salesforce. so that I can add that to my trusted keystore. – Dheeraj_Vashist Aug 13 '15 at 06:43