ssl - curl 命令有效,但 C 程序失败 NSS : client certificate not found (nickname not specified)

标签 ssl openssl libcurl nss

有许多类似的帖子,但我想了解的不仅仅是这些帖子所提供的内容。 我的 curl 命令行运行良好,能够与服务器通信并获取我想要的数据。命令看起来像

curl -v --tlsv1.2 --cert ./service_cert.pem  --key ./service_private.key  "https://myserver"

但是当我尝试运行我的 C 程序并检查 http 客户端对象时,我看到了这个

errorBuffer = "NSS: client certificate not found (nickname not specified)

进一步阅读我意识到我已经使用 NSS 构建了 libcurl,它不支持从平面文件 (.pem) 读取证书


命令行 curl 实用程序如何能够读取 pem 文件?

最佳答案

您需要使用 certutil 将您的客户端证书导入 NSS 数据库,并让您的代码使用该数据库。

引用:

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/tools/NSS_Tools_certutil

关于ssl - curl 命令有效,但 C 程序失败 NSS : client certificate not found (nickname not specified),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54699737/

相关文章:

node.js - 保护 Node Redis

objective-c - 为什么我不能在 XPC 服务中为 NSURLSessionDataTask 覆盖 SSL ServerTrust?

apache - 仅将 SSL 应用于主域 - .htaccess

linux - 如何告诉 openssl rsautl 使用存储在 TPM 中的 key ?

c++ - 我如何杀死弹出窗口?

mysql - mysql_ssl_rsa_setup 从哪里获取 OpenSSL 文件?

python 请求 SSL 错误(证书验证失败)

android - 使用 OpenSSL 和 Android 时的不同 RSA 签名

android - cURL-有没有办法强制 curl 使用特定的网络接口(interface)

c++ - C++ 中的 libcurl : converting URL to some weird symbols