libcurl 可以将 tpm2-tss-engine 用于 TLS 连接吗?

Can libcurl use tpm2-tss-engine for TLS connexions?

我没有找到关于如何在下面从 libcurl 官方网站获取的代码中找到的文档,我可以插入 tpm2-tss-engine 以便私钥在 TPM 中。例如,可以将 tpm2-tss-engine 插入 openssl。

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
  curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
  curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

来源:https://curl.haxx.se/libcurl/c/CURLOPT_SSLCERT.html

您可以通过设置 CURLOPT_SSLENGINE 选项来告诉 curl 使用私钥引擎,如下所示:

CURL *curl = curl_easy_init();
if(curl) {

  curl_easy_setopt(curl, CURLOPT_SSLENGINE, "tpm2tss"); /* Set the engine for SSL private key */

  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
  curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
  curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

您可以在此处查看详细信息:https://curl.haxx.se/libcurl/c/CURLOPT_SSLENGINE.html