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_addc(LIBSSH2_KNOWNHOSTS *hosts,
13                                  char *host, char *salt,
14                                  char *key, size_t keylen,
15                                  const char *comment, size_t commentlen,
16                                  int typemask,
17                                  struct libssh2_knownhost **store);
18

DESCRIPTION

20       Adds  a  known  host to the collection of known hosts identified by the
21       'hosts' handle.
22
23       host is a pointer the host name in plain text or hashed. If hashed,  it
24       must  be provided base64 encoded. The host name can be the IP numerical
25       address of the host or the full name.
26
27       If you want to add a key for a specific port number for the given host,
28       you must provide the host name like '[host]:port' with the actual char‐
29       acters '[' and ']' enclosing the host name and a colon  separating  the
30       host part from the port number. For example: "[host.example.com]:222".
31
32       salt is a pointer to the salt used for the host hashing, if the host is
33       provided hashed. If the host is provided in plain  text,  salt  has  no
34       meaning.   The  salt  has to be provided base64 encoded with a trailing
35       zero byte.
36
37       key is a pointer to the key for the given host.
38
39       keylen is the total size in bytes of the key  pointed  to  by  the  key
40       argument
41
42       comment is a pointer to a comment for the key.
43
44       commentlen  is the total size in bytes of the comment pointed to by the
45       comment argument
46
47       typemask is a bitmask that specifies format and  info  about  the  data
48       passed  to this function. Specifically, it details what format the host
49       name is, what format the key is and what key type it is.
50
51       The host name is given as one of the  following  types:  LIBSSH2_KNOWN‐
52       HOST_TYPE_PLAIN,    LIBSSH2_KNOWNHOST_TYPE_SHA1    or    LIBSSH2_KNOWN‐
53       HOST_TYPE_CUSTOM.
54
55       The key is encoded using one of the following encodings: LIBSSH2_KNOWN‐
56       HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
57
58       The  key  is using one of these algorithms: LIBSSH2_KNOWNHOST_KEY_RSA1,
59       LIBSSH2_KNOWNHOST_KEY_SSHRSA or LIBSSH2_KNOWNHOST_KEY_SSHDSS.
60
61       store should point to a pointer that gets filled in  to  point  to  the
62       known  host  data  after  the addition. NULL can be passed if you don't
63       care about this pointer.
64

RETURN VALUE

66       Returns a regular libssh2 error code, where negative values  are  error
67       codes and 0 indicates success.
68

AVAILABILITY

70       Added in libssh2 1.2.5
71

SEE ALSO

73       libssh2_knownhost_init(3)    libssh2_knownhost_free(3)   libssh2_known‐
74       host_check(3)
75
76
77
78libssh2 1.2                       28 May 2009         libssh2_knownhost_add(3)
Impressum