javax.net.ssl.SSLException:证书中的主机名并不匹配:在android中

时间:2014-09-29 09:04:45

标签: android

我已获得域名的SSL证书。此外,我还在SSL认证的子域下创建了子域,以承载此域中的多个项目。所以,我创建了Web服务,然后我试图从该服务器获取详细信息。坚果如下所示抛出异常。

09-29 15:03:59.311: W/System.err(26845): javax.net.ssl.SSLException: hostname in certificate didn't match: != <.ipage.com> OR <.ipage.com> OR 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:185) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:114) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:95) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:388) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:214) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:167) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:125) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1227) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:677) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:570) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:491) 
09-29 15:03:59.321: W/System.err(26845): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:469) 
09-29 15:03:59.321: W/System.err(26845): at com.tdzinfo.gamecom.webclient.RequestMethods.callHTTPMethod(RequestMethods.java:38) 
09-29 15:03:59.321: W/System.err(26845): at com.tdzinfo.gamecom.CategoryList$GetProducts.doInBackground(CategoryList.java:74) 
09-29 15:03:59.321: W/System.err(26845): at

那么,任何人都可以建议我解决这个问题,如果我使用该域中的子文件夹,我可以为这个子域提供SSL吗?

1 个答案:

答案 0 :(得分:0)

SSL证书与主机名链接,如果主机名不同,android会抛出javax.net.ssl.SSLException。您必须为该子域(主机名)生成证书