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 const char *host,
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 key is a pointer to the key for the given host.
26
27 keylen is the total size in bytes of the key pointed to by the key
28 argument
29
30 typemask is a bitmask that specifies format and info about the data
31 passed to this function. Specificly, it details what format the host
32 name is, what format the key is and what key type it is.
33
34 The host name is given as one of the following types: LIBSSH2_KNOWN‐
35 HOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
36
37 The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
38 HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
39
40 knownhost if set to non-NULL, it must be a pointer to a 'struct lib‐
41 ssh2_knownhost' pointer that gets filled in to point to info about a
42 known host that matches or partially matches.
43
45 libssh2_knownhost_check(3) returns info about how well the provided
46 host + key pair matched one of the entries in the list of known hosts.
47
48 LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check to be
49 made
50
51 LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found
52
53 LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match.
54
55 LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys didn't
56 match!
57
59 Added in libssh2 1.2
60
62 See the ssh2_exec.c example as provided in the tarball.
63
65 libssh2_knownhost_init(3) libssh2_knownhost_free(3) libssh2_known‐
66 host_add(3)
67
68
69
70libssh2 1.2 28 May 2009 libssh2_knownhost_check(3)