android - OpenSSL 1.0.2 读取 md5 CA 证书

标签 android ssl curl openssl ssl-certificate

我已经为 Android 构建了 curl 7.39.0 和 openssl 1.0.2。我将 openssl 指向 CA 证书目录:

curl_easy_setopt( curl, CURLOPT_CAPATH, "/system/etc/security/cacerts" );

但是当我调用 curl_easy_perform 时,我收到错误代码 60:无法使用给定的 CA 证书验证对等证书

来自一点googling我发现 Android cacerts 是使用 md5 哈希生成的,但从版本 1.0.0 开始,openssl 使用 sha1。

有谁知道如何让 openssl 1.0.2 能够读取 Android 的 md5 ca 证书?

Google 一定以某种方式做到了这一点,因为他们的 openssl repo android 使用版本 1.0.1j。

否则我想我的选择是像 this answer 中那样使用 openssl 0.9.8 ,或使用我自己的 CA 证书包 - 但我宁愿拥有最新版本,而不必担心自己维护 CA 证书。

最佳答案

/system/etc/security/cacerts 文件夹中的所有这些文件都是 PEM 格式的证书,名称是主题的哈希值。我认为您不能像使用较新的 openssl 版本那样使用该文件夹。但是您可以将所有这些文件简单地归为一个文件,并将其与 CURLOPT_CAINFO 一起使用。虽然这不如直接使用目录好,但它可能比从其他地方获取 CA 包更好。

关于android - OpenSSL 1.0.2 读取 md5 CA 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26935662/

相关文章:

python - 客户端证书在 curl 中有效,但在 Python 中无效

curl - 在curl顶部使用curlpp从youtube下载flv-视频无法播放

shell - 如何将命令行中本地 `curl`的结果一行传到远程服务器?

amazon-web-services - AWS 为负载均衡器请求 ACM HTTPS 证书

android - list 合并失败 : Android Studio

java - 如何将 java AffineTransform 映射到 android 的矩阵?

android - API Callback_URL 无效调用

Android将我自制的CA证书识别为用户证书,并且无法正确安装

ssl - 使用 StartSSL 配置 Jenkins - 添加发行者链

android - Appflow 部署插件导致错误 : 'uncaught (in promise) string resource id #0x0' in Ionic Capacitor project