当我运行这段代码时,我得到了错误信息:
- 即将 connect() 到 10.12.190.155 端口 443 (#0)
- 正在尝试 10.12.190.155... * 已连接
- 连接到 10.12.190.155 (10.12.190.155) 端口 443 (#0)
- 使用 certpath 初始化 NSS:sql:/etc/pki/nssdb
- CAfile:/home/wh/work/sslkey/ca.crt CApath:无
- 无法加载客户端密钥 -8178。
- NSS 错误 -8178
- 关闭连接 #0
- 本地 SSL 证书问题
卷曲*卷曲;CURLcode 资源;
//static const char *pClientCert = "/home/wh/work/sslkey/user1.pem";
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl)
{
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "https://10.12.190.155/");
curl_easy_setopt(curl, CURLOPT_CAINFO, "/home/wh/work/sslkey/ca.crt");
curl_easy_setopt(curl,CURLOPT_SSLCERT,"/home/wh/work/sslkey/user1.pem");
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
curl_global_cleanup();