首页 > 解决方案 > CertificateTransparency:失败:没有证书

问题描述

您好,我使用 okhttp/certificate pinning(使用 TrustKit)实现了这个库( https://github.com/babylonhealth/certificate-transparency-android )问题是我收到了一个错误,即使主机名有日志检查Google 报告 并且有一个使用以下配置的 CT 日志即时消息:

certificateTransparencyInterceptor {
        +"*.myhostname.io"
        failOnError = false
        logger = BasicAndroidCTLogger(BuildConfig.DEBUG)
    }

但我从 logcat CertificateTransparency: domain.myhostname.io 失败:没有证书 okHttp 是这样的:

okHttpBuilder.addInterceptor(authInterceptor)
        .sslSocketFactory(OkHttp3Helper.getSSLSocketFactory(), OkHttp3Helper.getTrustManager())
        .addInterceptor(OkHttp3Helper.getPinningInterceptor())
        .addNetworkInterceptor(getCertificateTransparencyInterceptor())
        .sslSocketFactory(certificatePinning.getSSLSocketFactory(),
            certificatePinning.getTrustManager())
        .followRedirects(false)
        .followSslRedirects(false)
        .build()

我在证书中添加 intereptor.addNetworkInterceptor 被记录google_xenon2021并且cloudflare_nimbus2021 它们在默认列表中 https://www.gstatic.com/ct/log_list/log_list.json

我试图找出问题所在,但我不知道,

标签: androidcertificateclient-certificatescertificate-transparency

解决方案


目前 CT 库(现在托管在https://github.com/appmattus/certificatetransparency/上)仅支持检索作为 X.509v3 扩展嵌入在证书中的 SCT(签名证书时间戳)。

因此,如果您的域通过 TLS 扩展提供它们,那么该库将无法正常工作。

您应该能够通过在 Web 浏览器中查看证书详细信息并查找嵌入式签名证书时间戳列表条目来进行检查:

嵌入式签名证书时间戳列表


推荐阅读