libssh2_knownhost_check.3 (2194B)
1.\" 2.\" Copyright (c) 2009 by Daniel Stenberg 3.\" 4.TH libssh2_knownhost_check 3 "28 May 2009" "libssh2" "libssh2" 5.SH NAME 6libssh2_knownhost_check - check a host+key against the list of known hosts 7.SH SYNOPSIS 8.nf 9#include <libssh2.h> 10 11int 12libssh2_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.fi 18.SH DESCRIPTION 19Checks a host and its associated key against the collection of known hosts, 20and returns info back about the (partially) matched entry. 21 22\fIhost\fP is a pointer the host name in plain text. The host name can be the 23IP numerical address of the host or the full name. 24 25\fIkey\fP is a pointer to the key for the given host. 26 27\fIkeylen\fP is the total size in bytes of the key pointed to by the \fIkey\fP 28argument 29 30\fItypemask\fP is a bitmask that specifies format and info about the data 31passed to this function. Specifically, it details what format the host name is, 32what format the key is and what key type it is. 33 34The host name is given as one of the following types: 35LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM. 36 37The key is encoded using one of the following encodings: 38LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64. 39 40\fIknownhost\fP if set to non-NULL, it must be a pointer to a 'struct 41libssh2_knownhost' pointer that gets filled in to point to info about a known 42host that matches or partially matches. 43.SH RETURN VALUE 44\fIlibssh2_knownhost_check(3)\fP returns info about how well the provided 45host + key pair matched one of the entries in the list of known hosts. 46 47LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check to be made 48 49LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found 50 51LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match. 52 53LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys did not match! 54.SH AVAILABILITY 55Added in libssh2 1.2 56.SH EXAMPLE 57See the ssh2_exec.c example as provided in the tarball. 58.SH SEE ALSO 59.BR libssh2_knownhost_init(3) 60.BR libssh2_knownhost_free(3) 61.BR libssh2_knownhost_add(3)