CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md (1646B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_SSH_AUTH_TYPES (3) 9 - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3) 10 - CURLOPT_SSH_PUBLIC_KEYFILE (3) 11 Protocol: 12 - SFTP 13 - SCP 14 Added-in: 7.80.0 15 --- 16 17 # NAME 18 19 CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 - SHA256 hash of SSH server public key 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, 27 char *sha256); 28 ~~~ 29 30 # DESCRIPTION 31 32 Pass a char pointer pointing to a string containing a Base64-encoded SHA256 33 hash of the remote host's public key. The transfer fails if the given hash 34 does not match the hash the remote host provides. 35 36 The application does not have to keep the string around after setting this 37 option. 38 39 Using this option multiple times makes the last set string override the 40 previous ones. Set it to NULL to disable its use again. 41 42 # DEFAULT 43 44 NULL 45 46 # %PROTOCOLS% 47 48 # EXAMPLE 49 50 ~~~c 51 int 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 67 Requires the libssh2 backend. 68 69 # %AVAILABILITY% 70 71 # RETURN VALUE 72 73 curl_easy_setopt(3) returns a CURLcode indicating success or error. 74 75 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 76 libcurl-errors(3).