1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_SSH_AUTH_TYPES (3) 9 - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) 10 - CURLOPT_SSH_PUBLIC_KEYFILE (3) 11Protocol: 12 - SFTP 13 - SCP 14Added-in: 7.80.0 15--- 16 17# NAME 18 19CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 - SHA256 hash of SSH server public key 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, 27 char *sha256); 28~~~ 29 30# DESCRIPTION 31 32Pass a char pointer pointing to a string containing a Base64-encoded SHA256 33hash of the remote host's public key. The transfer fails if the given hash 34does not match the hash the remote host provides. 35 36The application does not have to keep the string around after setting this 37option. 38 39Using this option multiple times makes the last set string override the 40previous ones. Set it to NULL to disable its use again. 41 42# DEFAULT 43 44NULL 45 46# %PROTOCOLS% 47 48# EXAMPLE 49 50~~~c 51int main(void) 52{ 53 CURL *curl = curl_easy_init(); 54 if(curl) { 55 CURLcode res; 56 curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file"); 57 curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, 58 "NDVkMTQxMGQ1ODdmMjQ3MjczYjAyOTY5MmRkMjVmNDQ="); 59 res = curl_easy_perform(curl); 60 curl_easy_cleanup(curl); 61 } 62} 63~~~ 64 65# NOTES 66 67Requires the libssh2 backend. 68 69# %AVAILABILITY% 70 71# RETURN VALUE 72 73Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 74CURLE_OUT_OF_MEMORY if there was insufficient heap space. 75