我怎么可能得到“javax.net.ssl.SSLPeerUnverifiedException:没有对等证书”异常,但仅限于移动数据。当连接 WiFi 时,它工作正常。
我的设备正在运行 CM 11 M10。 证书由StartCom颁发。
这是我的代码:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("https://" + hostName + ":8080");
HttpResponse httpResponse;
try
{
httpResponse = httpClient.execute(httpGet); // this throw 'javax.net.ssl.SSLPeerUnverifiedException'
}
catch (IOException e)
{
e.printStackTrace();
return null;
}
有没有人有想法?
最佳答案
How is it possible that I get
SSLPeerUnverifiedException: No peer certificate' exception
, but only on Mobile Data.
这通常有两个原因。
首先,设备上的时钟不对,由于notBefore
和notAfter
导致证书验证失败。上线后,设备可以更新其时钟并验证证书。
其次,运营商通过缓存代理拦截请求。参见,例如,Death Twitches: Nokia Caught Wiretapping Encrypted Traffic From Its Handsets .
关于java - “无对等证书”异常,但仅限于移动数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26318083/