我接手了一个项目,但在实施 SSL 方面遇到了困难。我们的应用程序使用 libcurl 从服务器访问远程内容。该设备正在寻找我拥有的 cacert.pem 文件,但不确定将其放置在哪里。我尝试将其放置在应用程序的根目录中,但这没有帮助。
同事建议将该文件直接放入 /sdcard,但这也没有帮助。
有谁知道我应该将 cacert.pem 文件放在应用程序中的哪个位置以使其能够被 libcurl 使用?
I've taken over a project and am having a hard time implementing the SSL side of things. Our application makes use of libcurl to access remote content from a server. The device is looking for a cacert.pem file to which I have, but am unsure where to place it. I've tried to place it in the root of the application but that did not help.
Co workers suggested the file should be placed directly into /sdcard but that did not help either.
Does anyone know where I should place the cacert.pem file within the application to enable it to be used by libcurl?
发布评论
评论(1)
您可以使用
curl_easy_setopt
和CURLOPT_CAINFO
指定 libcurl 在何处查找 CA 信息:以下示例演示了完整的 SSL 会话,包括指定 CA 证书文件:
http://curl.haxx.se/libcurl/c/simpllessl.html
You can specify where libcurl looks for the CA information using
curl_easy_setopt
withCURLOPT_CAINFO
:The following example demonstrates a full SSL session, including specifying the CA certificate file:
http://curl.haxx.se/libcurl/c/simplessl.html