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