【问题标题】:HostNameVerifier Play Store AndroidHostNameVerifier Play Store Android
【发布时间】:2018-08-26 18:35:21
【问题描述】:

我在提交我的应用时遇到问题。 我已经完成了如下 Volley 设置,但 Play 商店显示拒绝。

主机名验证器

您的应用正在使用 HostnameVerifier 接口的不安全实现。您可以在这篇 Google 帮助中心文章中找到有关如何解决此问题的更多信息。

    RequestQueue queue = Volley.newRequestQueue(Services.this, new HurlStack(null, newSslSocketFactory()));
        // Request a string response from the provided URL.

        try {
            final ProgressDialog pDialog = new ProgressDialog(Services.this);
            pDialog.setMessage("Wainting ...");
            pDialog.show();

            String url = "https://sitesecurity.com";
                 StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>(){
                @Override
                public void onResponse(String response) {
}



     private SSLSocketFactory newSslSocketFactory() {
            try {
                HttpsURLConnection.setDefaultHostnameVerifier(new HttpsTrustManager());
                SSLContext context = SSLContext.getInstance("TLS");
                context.init(null, new X509TrustManager[]{new DadosConsultaPerto.NullX509TrustManager()}, new SecureRandom());
                HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
                SSLSocketFactory sf = context.getSocketFactory();
                return sf;
            } catch (Exception e) {
                throw new AssertionError(e);
            }
        }

我尝试了几种方法,但错误仍然存​​在。

漏洞 APK 版本已过期 主机名验证器

您的应用正在使用 HostnameVerifier 接口的不安全实现。您可以在这篇 Google 帮助中心文章中找到有关如何解决此问题的更多信息。 2017 年 3 月 1 日 5 日

【问题讨论】:

  • 那么您是否查看了关于 HostnameVerifier 的 Google 帮助中心文章,您具体尝试了什么?
  • 我按照谷歌的指示做了。我没有客户端证书,因为 WebService 获得了共享证书。 ' public boolean verify(String hostname, SSLSession session) { Log.i("RestUtilImpl", "Approving certificate for " + hostname);返回真; }'
  • 我希望这个问题在过去 3 年内得到了解决。您能分享一下解决方案吗?

标签: android ssl ssl-certificate android-volley android-security


【解决方案1】:

首先选择 apk 版本,然后在 Alerts(发布前报告)中选择安全和信任,详细信息您会发现受影响的类。

【讨论】:

    【解决方案2】:

    删除 newSslSocketFactory() 并停止在您的 HurlStack 构造函数调用中引用它。这就是您以完全不安全的方式使用HostnameVerifier 的地方。

    我的猜测是你的HttpsTrustManagerthis one,这也是完全不安全的,会导致你的应用被 Play 商店禁止。删除newSslSocketFactory() 也可以解决这个问题。

    【讨论】:

    • 我照他说的做了,他还是拒绝了。
    猜你喜欢
    • 1970-01-01
    • 2021-03-28
    • 2020-06-23
    • 1970-01-01
    • 1970-01-01
    • 2021-05-23
    • 2012-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多