1libssh2_knownhost_check(3)          libssh2         libssh2_knownhost_check(3)
2
3
4

NAME

6       libssh2_knownhost_check  -  check  a host+key against the list of known
7       hosts
8

SYNOPSIS

10       #include <libssh2.h>
11
12       int
13       libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
14                               const char *host,
15                               const char *key, size_t keylen,
16                               int typemask,
17                               struct libssh2_knownhost **knownhost);
18

DESCRIPTION

20       Checks a host and its associated key against the  collection  of  known
21       hosts, and returns info back about the (partially) matched entry.
22
23       host is a pointer the host name in plain text. The host name can be the
24       IP numerical address of the host or the full name.
25
26       key is a pointer to the key for the given host.
27
28       keylen is the total size in bytes of the key pointed to by the key  ar‐
29       gument
30
31       typemask  is  a  bitmask  that specifies format and info about the data
32       passed to this function. Specifically, it details what format the  host
33       name is, what format the key is and what key type it is.
34
35       The  host  name  is given as one of the following types: LIBSSH2_KNOWN‐
36       HOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
37
38       The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
39       HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
40
41       knownhost  if  set  to non-NULL, it must be a pointer to a 'struct lib‐
42       ssh2_knownhost' pointer that gets filled in to point to  info  about  a
43       known host that matches or partially matches.
44

RETURN VALUE

46       libssh2_knownhost_check(3)  returns  info  about  how well the provided
47       host + key pair matched one of the entries in the list of known hosts.
48
49       LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check  to  be
50       made
51
52       LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found
53
54       LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match.
55
56       LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys did not
57       match!
58

AVAILABILITY

60       Added in libssh2 1.2
61

EXAMPLE

63       See the ssh2_exec.c example as provided in the tarball.
64

SEE ALSO

66       libssh2_knownhost_init(3)   libssh2_knownhost_free(3)    libssh2_known‐
67       host_add(3)
68
69
70
71libssh2                           28 May 2009       libssh2_knownhost_check(3)
Impressum