CURLOPT_HTTPSIG_ALGORITHM explained
Name
CURLOPT_HTTPSIG_ALGORITHM - RFC 9421 HTTP Message Signatures algorithm
Synopsis
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPSIG_ALGORITHM, long algorithm);
Description
This feature is experimental and may change before it is considered stable. We advise against using it in production.
Enable RFC 9421 HTTP Message Signatures on outgoing requests. Pass a long set to one of the values below to select the signing algorithm.
Disable HTTP Message Signatures.
Sign with Ed25519 (RFC 8032). Requires a TLS backend with Ed25519 support.
Sign with HMAC-SHA256.
Setting this option to a non-zero value also sets CURLOPT_HTTPAUTH to CURLAUTH_HTTPSIG. The options CURLOPT_HTTPSIG_KEY and CURLOPT_HTTPSIG_KEYID must also be set.
Default
CURLHTTPSIG_NONE (0)
Protocols
This functionality affects http only
Example
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/api");
curl_easy_setopt(curl, CURLOPT_HTTPSIG_ALGORITHM,
CURLHTTPSIG_ED25519);
curl_easy_setopt(curl, CURLOPT_HTTPSIG_KEY,
"9f8362f87a484a954e6e740c5b4c0e84"
"229139a20aa8ab56ff66586f6a7d29c5");
curl_easy_setopt(curl, CURLOPT_HTTPSIG_KEYID, "my-key-id");
curl_easy_perform(curl);
}
}
Availability
Added in curl 8.22.0
Return value
curl_easy_setopt returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors.
See also
CURLOPT_HTTPAUTH(3), CURLOPT_HTTPSIG_HEADERS(3), CURLOPT_HTTPSIG_KEY(3), CURLOPT_HTTPSIG_KEYID(3)
This HTML page was made with roffit.