1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_SSH_AUTH_TYPES (3)
9  - CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3)
10  - CURLOPT_SSH_KNOWNHOSTS (3)
11  - CURLOPT_SSH_PUBLIC_KEYFILE (3)
12Protocol:
13  - SFTP
14  - SCP
15Added-in: 7.17.1
16---
17
18# NAME
19
20CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 - MD5 checksum of SSH server public key
21
22# SYNOPSIS
23
24~~~c
25#include <curl/curl.h>
26
27CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
28                          char *md5);
29~~~
30
31# DESCRIPTION
32
33Pass a char pointer pointing to a string containing 32 hexadecimal digits. The
34string should be the 128 bit MD5 checksum of the remote host's public key, and
35libcurl aborts the connection to the host unless the MD5 checksum match.
36
37MD5 is a weak algorithm. We strongly recommend using
38CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3) instead.
39
40The application does not have to keep the string around after setting this
41option.
42
43Using this option multiple times makes the last set string override the
44previous ones. Set it to NULL to disable its use again.
45
46# DEFAULT
47
48NULL
49
50# %PROTOCOLS%
51
52# EXAMPLE
53
54~~~c
55int main(void)
56{
57  CURL *curl = curl_easy_init();
58  if(curl) {
59    CURLcode res;
60    curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
61    curl_easy_setopt(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
62                     "afe17cd62a0f3b61f1ab9cb22ba269a7");
63    res = curl_easy_perform(curl);
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
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