0

得到:

javax.net.ssl.SSLPeerUnverifiedException:Web 服务在 Android 中没有对等证书错误。

我分析了关于我的 keyStore 中缺少证书的问题。这个“ https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8 ” Web 服务在我的 salesforce 组织上,但是,我如何从 Salesforce 获取证书,我可以将其添加到我在 android 中的 KeyStore ?

如果有人觉得有帮助,下面是我的目录。

我已经检查了这个链接“ 'No peer certificate' error in Android 2.3 but NOT in 4 ”,但在此之前我需要一个证书在我的原始文件夹中,我如何在没有任何证书的情况下做到这一点。我需要在我的应用程序中使用 Salesforce 客户端证书。

`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` 
4

1 回答 1

0

Android 有一组受信任的 CA 证书列表,您可以在设置 -> 安全 -> 受信任的凭据下看到它。旧版本的 android 没有一些 CA 证书,并成为此类错误的原因。您可以根据 android 版本修改您的代码。如果版本低于 2.3,则使用自己的信任库 [example available on net] 传递证书,否则使用您的 CA 证书。

于 2015-08-13T06:00:58.680 回答