CURLOPT_SS...KEY_SHA256(3)
π CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3) π
okay bestie, this cutie comes straight out of the Library Functions Manual, and it's here to check the SHA256 hash of an SSH server's public key. no cap. β¨
πΈ NAME πΈ
CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 β SHA256 hash of SSH server public key.
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
char *sha256);
π DESCRIPTION π
You pass a char pointer pointing to a string containing a Base64-encoded SHA256 hash of the remote host's public key. The transfer fails if the given hash does not match the hash the remote host provides. π«Ά
The application does not have to keep the string around after setting this option. So you can let it go after setting it β she's done her job. π
Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again. Last one wins, periodt. π
π DEFAULT π
NULL
π¦ PROTOCOLS π¦
This functionality affects scp and sftp. π§
π₯ EXAMPLE π₯
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
"NDVkMTQxMGQ1ODdmMjQ3MjczYjAyOTY5MmRkMjVmNDQ=");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π NOTES π
Requires the libssh2 backend. so like, no libssh2, no vibe check. π
π AVAILABILITY π
Added in curl 7.80.0. β
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). π
π«Ά SEE ALSO π«Ά
mwah π this page is from source/version libcurl, dated 2026-10-12, and its footer title is CURLOPT_SS...KEY_SHA256(3). bye bestie, go check those hashes π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms