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