问题描述
总的来说,我的应用收到了来自Google Play的与HostnameVerifier相关的警告:
Your app(s) are using an unsafe implementation of the HostnameVerifier interface
我的代码中只有一个地方可以进行验证:
@Override
public boolean verify(String host,SSLSession session) {
try {
Certificate[] certificates = session.getPeerCertificates();
boolean b = verify(host,(X509Certificate) certificates[0]);
return b;
} catch (SSLException e) {
return false;
}
}
当我将鼠标悬停在验证上时,我收到消息,验证方法将始终返回true,但绝对不是这样。当我使用错误的主机名运行时,该方法会很好地返回false。
这是怎么回事?这个错误的警告可能是GP发出消息的原因吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)