Android X509TrustManager 应用被拒绝 google 播放

Android X509TrustManager app rejected google play

应用程序运行良好,但在 Google Play Consol

中上传应用程序时出现以下错误

Vulnerability TrustManager To properly handle SSL certificate validation, change your code in the checkServerTrusted method of your custom X509TrustManager interface to raise either CertificateException or IllegalArgumentException whenever the certificate presented by the server does not meet your expectations. To confirm you’ve updated correctly, submit the updated version to the Developer Console and check back after five hours. If the app hasn’t been correctly upgraded, we will display a warning. For additional information and next steps, please see this Google Help Center article.

我使用下面的代码 API 调用

    DefaultHttpClient client=null;
    try {
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        // http scheme
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        // https scheme
        schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443));

        HttpParams mHttpParams = new BasicHttpParams();
        mHttpParams.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30);
        mHttpParams.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30));
        mHttpParams.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
        HttpProtocolParams.setVersion(mHttpParams, HttpVersion.HTTP_1_1);
        ClientConnectionManager cm = new ThreadSafeClientConnManager(mHttpParams, schemeRegistry);
        client = new DefaultHttpClient(cm, mHttpParams);
    } catch (Exception e) {
        e.printStackTrace();
        client = new DefaultHttpClient();
    }

我的 url 是一个基于 HTTP

的 IP

我在下面使用了 X509TrustManager

这是一个警告,您使用了不安全的 X509TrustManager 和空的 checkClientTrusted()checkServerTrusted() 方法。这些方法假定检查客户端和服务器证书作为 HTTPS 合同的一部分,并在给定的证书无效时抛出异常。通过将这些方法保留为空,您有点破坏了整个 HTTPS 安全性,因为您的代码几乎可以接受任何证书。例如,您的应用容易受到 a man in the middle attack 的攻击。这种空实现几乎与普通 HTTP 实现相同。

使用 SSLSocketFactory.getSocketFactory() 而不是 new EasySSLSocketFactory() 可以解决问题。您的应用连接的服务器必须具有有效的 CA 签名证书。

最终问题是由于 ACRA lib 我已经删除了 ACRA 和 Flurry
应用上传成功 google 播放