由于HostnameVerifier问题,Google拒绝了该应用 [英] Google rejected app because of HostnameVerifier issue

查看:114
本文介绍了由于HostnameVerifier问题,Google拒绝了该应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新了我的应用程序,以信任第17号及以下版本SDK中的volley中的所有证书,因为在没有主机名验证程序的情况下,第13版及更高版本的volley可以正常工作.一切正常,但Google拒绝了我的应用更新

Updated my app to trust all certificates in volley for sdk 17 and below as volley works fine without hostname verifier for higher sdk. It worked fine but google rejected my app update saying

您的应用正在使用HostnameVerifier接口的不安全实现.

Your app(s) are using an unsafe implementation of the HostnameVerifier interface.

我正在使用以下代码

TrustManager[] trustAllCertsc = new TrustManager[] { new X509TrustManager() {
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return null;
        }
        public void checkClientTrusted(X509Certificate[] certs, String authType) {
        }
        public void checkServerTrusted(X509Certificate[] certs, String authType) {
        }
    } };
    SSLContext scc = null;
    try {
        scc = SSLContext.getInstance("SSL");
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }
    try {
        scc.init(null, trustAllCertsc, new java.security.SecureRandom());
    } catch (KeyManagementException e) {
        e.printStackTrace();
    }
    HttpsURLConnection.setDefaultSSLSocketFactory(scc.getSocketFactory());
    // Create all-trusting host name verifier
    HostnameVerifier allHostsValidc = new HostnameVerifier() {
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    // Install the all-trusting host verifier
    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValidc);

推荐答案

删除所有这些代码.您将无法通过多个Play商店检查( HostnameVerifier 和一个接受所有的 TrustManager ).另外,Play商店拒绝您的应用的原因是,通过此代码,您正在削弱应用的安全性.

Delete all of that code. You will fail multiple Play Store checks (HostnameVerifier and an accept-all TrustManager). Plus, the reason why the Play Store is rejecting your app is because, through this code, you are weakening app security.

这篇关于由于HostnameVerifier问题,Google拒绝了该应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆