google-play-services - 如何修复包含不安全的 TrustManager 实现的应用程序?

标签 google-play-services android-security developer-console trustmanager

在开发者控制台中我的应用名称旁边看到了来自 Google 的警告,内容涉及 TrustManager 的不安全实现。我浏览了代码,但没有使用 TrustManager 或 checkServerTrusted 方法的单一位置,因此我不确定在哪里处理 Google 建议的异常。我能想到的唯一可能的地方是 IAB(应用内计费)相关库。有什么想法吗?

更新
虽然每个人造成此错误的原因可能有所不同,但在我的特定情况下,问题出在 Flurry 分析库上。我有一个相当旧的版本,一旦删除它,问题就消失了。

最佳答案

在您的事件中添加以下代码

public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                try {
                    chain[0].checkValidity();
                } catch (Exception e) {
                    throw new CertificateException("Certificate not valid or trusted.");
                }
            }

关于google-play-services - 如何修复包含不安全的 TrustManager 实现的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35700090/

相关文章:

android - 定位到 Android 12 时,由于 pendingIntent 导致应用程序崩溃

java - Google Api Client 接口(interface)方法解释?

android - 如何在 Google Play 服务中访问 Google Fit 用户目标?

Android 应用漏洞 - HostnameVerifier,不在代码库中的任何位置

Android Beta 应用声明为 "Unreleased"

android - 谷歌播放服务 sdk 丢失

android如何隐藏或保护源代码中的url链接

安卓安全 : Google Play warning: Your app contains a SQL Injection issue

unity3d - 您上传的 APK 或 Android App Bundle 使用尚未生效的证书签名

Android Developer Console 如何发送 HTTP 请求?