1
2libssh2_knownhost_add(3)        libssh2 manual        libssh2_knownhost_add(3)
3
4
5

NAME

7       libssh2_knownhost_add - add a known host
8

SYNOPSIS

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

DESCRIPTION

19       Adds  a  known  host to the collection of known hosts identified by the
20       'hosts' handle.
21
22       host is a pointer the host name in plain text or hashed. If hashed,  it
23       must  be provided base64 encoded. The host name can be the IP numerical
24       address of the host or the full name.
25
26       saltP is a pointer to the salt used for the host hashing, if  the  host
27       is  provided hashed. If the host is provided in plain text, salt has no
28       meaning.  The salt has to be provided base64 encoded  with  a  trailing
29       zero byte.
30
31       key is a pointer to the key for the given host.
32
33       keylen  is  the  total  size  in bytes of the key pointed to by the key
34       argument
35
36       typemask is a bitmask that specifies format and  info  about  the  data
37       passed  to  this  function. Specificly, it details what format the host
38       name is, what format the key is and what key type it is.
39
40       The host name is given as one of the  following  types:  LIBSSH2_KNOWN‐
41       HOST_TYPE_PLAIN,    LIBSSH2_KNOWNHOST_TYPE_SHA1    or    LIBSSH2_KNOWN‐
42       HOST_TYPE_CUSTOM.
43
44       The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
45       HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
46
47       The  key  is using one of these algorithms: LIBSSH2_KNOWNHOST_KEY_RSA1,
48       LIBSSH2_KNOWNHOST_KEY_SSHRSA or LIBSSH2_KNOWNHOST_KEY_SSHDSS.
49
50       store should point to a pointer that gets filled in  to  point  to  the
51       known  host  data  after  the addition. NULL can be passed if you don't
52       care about this pointer.
53

RETURN VALUE

55       Returns a regular libssh2 error code, where negative values  are  error
56       codes and 0 indicates success.
57

AVAILABILITY

59       Added in libssh2 1.2
60

SEE ALSO

62       libssh2_knownhost_init(3)    libssh2_knownhost_free(3)   libssh2_known‐
63       host_check(3)
64
65
66
67libssh2 1.2                       28 May 2009         libssh2_knownhost_add(3)
Impressum