错误javax.net.ssl.SSLPeerUnverifiedException:没有对等证书和SSLNullSession.java:104

时间:2017-03-27 11:23:42

标签: android ssl-certificate

当我使用https连接服务器时,我遇到此错误javax.net.ssl.SSLPeerUnverifiedException: No peer certificate on android version lower than Marshmallow,我收到此异常:

   03-27 16:15:04.481 23391-23469/com.intellinects.app W/System.err: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at com.android.org.conscrypt.SSLNullSession.getPeerCertificates(SSLNullSession.java:104)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:388)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
   03-27 16:15:04.495 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at com.intellinects.app.Network.executeService(Network.java:77)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at com.intellinects.app.Network.checkSecureConnection(Network.java:180)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at com.intellinects.app.Network.get(Network.java:124)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at com.intellinects.app.SplashActivity$CheckURL.doInBackground(SplashActivity.java:144)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at com.intellinects.app.SplashActivity$CheckURL.doInBackground(SplashActivity.java:127)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
   03-27 16:15:04.496 23391-23469/com.intellinects.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
   03-27 16:15:04.497 23391-23469/com.intellinects.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
   03-27 16:15:04.497 23391-23469/com.intellinects.app W/System.err:     at java.lang.Thread.run(Thread.java:818)

2 个答案:

答案 0 :(得分:0)

您连接的服务器没有很好的SSL证书。快速搜索StackOverflow转发给我这个伟大的问题和答案:Safely fixing: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate

答案 1 :(得分:0)

您尝试连接的服务器未获得授权。您必须执行SSL固定,下载由任何CA签名的SSL证书。