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

Viewed 435

I have not found documentation about how in the below code taken from official website of libcurl, can I plug tpm2-tss-engine so that the private key is in the TPM. As an example, it's possible to plug tpm2-tss-engine to 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);
}

Source: https://curl.haxx.se/libcurl/c/CURLOPT_SSLCERT.html

1 Answers

You can tell curl to use an engine for the private key by setting the CURLOPT_SSLENGINE option as follows:

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);
}

You can view details here: https://curl.haxx.se/libcurl/c/CURLOPT_SSLENGINE.html

Related