HostnameVerifier方法验证表明它始终返回true,这是错误的

问题描述

总的来说,我的应用收到了来自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。

enter image description here

这是怎么回事?这个错误的警告可能是GP发出消息的原因吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...