访问HTTPS URL时,Android中没有对等证书

时间:2013-06-19 07:14:56

标签: android androidhttpclient

我正在使用HTTPClient访问HTTPS URL。我得到了一些SSL错误,如无对等证书。我在这里粘贴了我的代码。

HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("https://myURL.com");
HttpResponse httpResponse = client.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
String response = EntityUtils.toString(httpEntity);

错误:

javax.net.ssl.SSLPeerUnverifiedException: No peer certificate at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:137)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93)
at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)

0 个答案:

没有答案