1libssh2_knownhost_check(3) libssh2 manual libssh2_knownhost_check(3)
2
3
4
6 libssh2_knownhost_checkp - check a host+key against the list of known
7 hosts
8
10 #include <libssh2.h>
11
12 int libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
13 const char *host, int port,
14 const char *key, size_t keylen,
15 int typemask,
16 struct libssh2_knownhost **knownhost);
17
19 Checks a host and its associated key against the collection of known
20 hosts, and returns info back about the (partially) matched entry.
21
22 host is a pointer the host name in plain text. The host name can be the
23 IP numerical address of the host or the full name.
24
25 port is the port number used by the host (or a negative number to check
26 the generic host). If the port number is given, libssh2 will check the
27 key for the specific host + port number combination in addition to the
28 plain host name only check.
29
30 key is a pointer to the key for the given host.
31
32 keylen is the total size in bytes of the key pointed to by the key
33 argument
34
35 typemask is a bitmask that specifies format and info about the data
36 passed to this function. Specifically, it details what format the host
37 name is, what format the key is and what key type it is.
38
39 The host name is given as one of the following types: LIBSSH2_KNOWN‐
40 HOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
41
42 The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
43 HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
44
45 knownhost if set to non-NULL, it must be a pointer to a 'struct lib‐
46 ssh2_knownhost' pointer that gets filled in to point to info about a
47 known host that matches or partially matches.
48
50 libssh2_knownhost_check(3) returns info about how well the provided
51 host + key pair matched one of the entries in the list of known hosts.
52
53 LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check to be
54 made
55
56 LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found
57
58 LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match.
59
60 LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys didn't
61 match!
62
64 Added in libssh2 1.2.6
65
67 See the ssh2_exec.c example as provided in the tarball.
68
70 libssh2_knownhost_init(3) libssh2_knownhost_free(3) libssh2_known‐
71 host_add(3)
72
73
74
75libssh2 1.2.6 1 May 2010 libssh2_knownhost_check(3)