【发布时间】: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