CURLOPT_HTTPSIG_KEYID(3)

πŸ“¦
version 8.23.0 Β· 3 versions
, in alpine 3.23, alpine 3.24

✨ CURLOPT_HTTPSIG_KEYID(3) ✨

okay so bestie, welcome to the CURLOPT_HTTPSIG_KEYID page β€” it lives in the libcurl manual and it's literally all about telling the server which key you signed with πŸ’…


πŸŽ€ NAME πŸŽ€

CURLOPT_HTTPSIG_KEYID β€” the key identifier for HTTP Message Signatures, iykyk


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPSIG_KEYID, char *keyid);

🌸 DESCRIPTION 🌸

heads up bestie: this feature is experimental and may change before it's considered stable. we genuinely advise against using it in production. no cap. 😭

So what you do is pass a null-terminated string that identifies the key used for RFC 9421 HTTP Message Signatures. That value gets included as the keyid parameter in the Signature-Input header, which is how the server looks up the matching verification key. like a little name tag for your key πŸŽ€

Good news: the application does not have to keep the string around after setting this option. curl's got it, you can let it go, main character energy ✨

If you use this option multiple times, the last set string overrides the previous ones. Set it to NULL to disable its use again. simple as that 🫢


πŸ’– DEFAULT πŸ’–

NULL


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

like look at that, "my-key-id" just chilling there being iconic πŸ‘‘


⭐ AVAILABILITY ⭐

Added in curl 8.22.0 β€” a whole new era fr fr


πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK β€” slay. non-zero means an error occurred, so go check libcurl-errors(3). πŸ’€


πŸ“ SEE ALSO πŸ“


and that's the whole vibe check bestie πŸ§šπŸ’– this page came to you from libcurl, dated 2026-10-25 β€” go forth and sign those messages, you absolute icon 🌟

πŸ“¦ where this page comes from