CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)
β¨ NAME β¨
Okay bestie, this is CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3) from the libcurl Library Functions Manual β the glow-up guide to checking an SSH serverβs public key with an MD5 checksum. π
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
char *md5);
π DESCRIPTION π
So you pass a char pointer that points at a string containing 32 hexadecimal digits. That string should be the 128 bit MD5 checksum of the remote hostβs public key, and then libcurl literally aborts the connection to the host unless the MD5 checksum match. Yes, itβs a whole vibe check for the key. π«Ά
π¨ Bestie, MD5 is a weak algorithm. We strongly recommend using CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3) instead. Like, for real, use the SHA256 one. π
The application does not have to keep the string around after setting this option. So no stressing about its lifetime after you set it. π
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, and NULL is the off switch. π
πΈ DEFAULT πΈ
NULL
Yep, default is NULL, bestie. π
π¦ PROTOCOLS π¦
This functionality affects scp and sftp. π¦
β EXAMPLE β
Hereβs the exact example β main character energy, but make it SFTP:
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_MD5,
"afe17cd62a0f3b61f1ab9cb22ba269a7");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π AVAILABILITY π
Added in curl 7.17.1. Iconic. π
π₯ 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). So 0 = slay, non-zero = check the error code, bestie. π
π SEE ALSO π
CURLOPT_SSH_AUTH_TYPES(3)CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3)CURLOPT_SSH_KNOWNHOSTS(3)CURLOPT_SSH_PUBLIC_KEYFILE(3)
Thatβs the whole page, bestie. Stay safe out there and remember: MD5 is weak, SHA256 is the moment. π This was libcurl, dated 2026-10-12. π
π¦ 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