Android的SSL:javax.net.ssl.SSLPeerUnverifiedException:没有对等证书(再次)

我有一个网站,我启用SSL的RESTful服务。 我们已经在RapidSSL注册,安装了证书,并且通过了RapidSSL检查器 。 我能够访问网站与各种浏览器,包括Android浏览器(内置,火狐和歌剧)没有问题,没有任何警告。

但是,当我尝试访问它与我的Android应用程序,我得到以下exception:

08-11 20:04:05.586 363 381 E HttpProvider: Error executing request: No peer certificate 08-11 20:04:05.586 363 381 E HttpProvider: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:259) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:164) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 08-11 20:04:05.586 363 381 E HttpProvider: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 08-11 20:04:05.586 363 381 E HttpProvider: at com.xxxxx.netlib.http.HttpProvider.executeRequest(HttpProvider.java:75) 

这发生在模拟器和3.2平板上的android 2.3.3上。 我已经看到了很多点击,但没有find帮助我解决这个问题。

更多数据:

 $ openssl s_client -CAfile www.xxxxx.com.pem -connect www.xxxxx.com:443 CONNECTED(00000003) depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority verify return:1 depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA verify return:1 depth=1 C = US, O = "GeoTrust, Inc.", CN = RapidSSL CA verify return:1 depth=0 serialNumber = 1-7wArtEjdTwJ94d5iVDooDmmC4mXyVj, OU = GT82425783, OU = See www.rapidssl.com/resources/cps (c)12, OU = Domain Control Validated - RapidSSL(R), CN = www.xxxxx.com verify return:1 --- Certificate chain 0 s:/serialNumber=1-7wArtEjdTwJ94d5iVDooDmmC4mXyVj/OU=GT82425783/OU=See www.rapidssl.com/resources/cps (c)12/OU=Domain Control Validated - RapidSSL(R)/CN=www.xxxxx.com i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA 1 s:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority --- [snip] 

我正在运行的代码来设置客户端:

 public class HttpProvider implements INetworkProvider { private static final String LOG = "HttpProvider"; protected DefaultHttpClient client; public HttpProvider() { SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); final SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory(); sslSocketFactory.setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); registry.register(new Scheme("https", sslSocketFactory, 443)); client = new DefaultHttpClient( new ThreadSafeClientConnManager((new BasicHttpParams()), registry), new BasicHttpParams() ); } [snip] 

我也尝试了STRICT_HOSTNAME_VERIFIER,仍然没有喜悦。

从我所了解的情况来看,我不需要设置任何自定义的信任库或密钥库,因为我已经在公认的证书提供者处进行了注册。

我用ssl很新,发现我在三字缩写的海洋中游泳,我希望这里有人能够向正确的方向推动我。

Solutions Collecting From Web of "Android的SSL:javax.net.ssl.SSLPeerUnverifiedException:没有对等证书(再次)"