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       We  discourage  use  of  this  function as of libssh2 1.2.5. Instead we
20       strongly urge users to use libssh2_knownhost_addc(3) instead, which  as
21       a more complete API. libssh2_knownhost_add(3) is subject for removal in
22       a future release.
23
24       Adds a known host to the collection of known hosts  identified  by  the
25       'hosts' handle.
26
27       host  is a pointer the host name in plain text or hashed. If hashed, it
28       must be provided base64 encoded. The host name can be the IP  numerical
29       address of the host or the full name.
30
31       saltP  is  a pointer to the salt used for the host hashing, if the host
32       is provided hashed. If the host is provided in plain text, salt has  no
33       meaning.   The  salt  has to be provided base64 encoded with a trailing
34       zero byte.
35
36       key is a pointer to the key for the given host.
37
38       keylen is the total size in bytes of the key  pointed  to  by  the  key
39       argument
40
41       typemask  is  a  bitmask  that specifies format and info about the data
42       passed to this function. Specifically, it details what format the  host
43       name is, what format the key is and what key type it is.
44
45       The  host  name  is given as one of the following types: LIBSSH2_KNOWN‐
46       HOST_TYPE_PLAIN,    LIBSSH2_KNOWNHOST_TYPE_SHA1    or    LIBSSH2_KNOWN‐
47       HOST_TYPE_CUSTOM.
48
49       The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
50       HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
51
52       The key is using one of these  algorithms:  LIBSSH2_KNOWNHOST_KEY_RSA1,
53       LIBSSH2_KNOWNHOST_KEY_SSHRSA or LIBSSH2_KNOWNHOST_KEY_SSHDSS.
54
55       store  should  point  to  a pointer that gets filled in to point to the
56       known host data after the addition. NULL can be  passed  if  you  don't
57       care about this pointer.
58

RETURN VALUE

60       Returns  a  regular libssh2 error code, where negative values are error
61       codes and 0 indicates success.
62

AVAILABILITY

64       Added  in  libssh2  1.2,  deprecated  since  libssh2  1.2.5.  Use  lib‐
65       ssh2_knownhost_addc(3) instead!
66

SEE ALSO

68       libssh2_knownhost_init(3)    libssh2_knownhost_free(3)   libssh2_known‐
69       host_check(3) libssh2_knownhost_addc(3)
70
71
72
73libssh2 1.2                       28 May 2009         libssh2_knownhost_add(3)
Impressum