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
14---
15
16# NAME
17
18CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 - SHA256 hash of SSH server public key
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
26                          char *sha256);
27~~~
28
29# DESCRIPTION
30
31Pass a char pointer pointing to a string containing a Base64-encoded SHA256
32hash of the remote host's public key. The transfer fails if the given hash
33does not match the hash the remote host provides.
34
35# DEFAULT
36
37NULL
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    CURLcode res;
47    curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
48    curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256,
49                     "NDVkMTQxMGQ1ODdmMjQ3MjczYjAyOTY5MmRkMjVmNDQ=");
50    res = curl_easy_perform(curl);
51    curl_easy_cleanup(curl);
52  }
53}
54~~~
55
56# AVAILABILITY
57
58Added in 7.80.0
59Requires the libssh2 backend.
60
61# RETURN VALUE
62
63Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
64CURLE_OUT_OF_MEMORY if there was insufficient heap space.
65