Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

libssh2_knownhost_addc (3ssh2)

Name

libssh2_knownhost_addc - add a known host

Synopsis

#include <libssh2.h>

int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
char *host, char *salt,
char *key, size_t keylen,
const char *comment, size_t commentlen,
int typemask,
struct libssh2_knownhost **store);

Description


libssh2 manual                                    libssh2_knownhost_add(3ssh2)



NAME
       libssh2_knownhost_add - add a known host

SYNOPSIS
       #include <libssh2.h>

       int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
                                  char *host, char *salt,
                                  char *key, size_t keylen,
                                  const char *comment, size_t commentlen,
                                  int typemask,
                                  struct libssh2_knownhost **store);

DESCRIPTION
       Adds  a  known  host to the collection of known hosts identified by the
       'hosts' handle.

       host is a pointer the host name in plain text or hashed. If hashed,  it
       must  be provided base64 encoded. The host name can be the IP numerical
       address of the host or the full name.

       If you want to add a key for a specific port number for the given host,
       you must provide the host name like '[host]:port' with the actual char-
       acters '[' and ']' enclosing the host name and a colon  separating  the
       host part from the port number. For example: "[host.example.com]:222".

       salt is a pointer to the salt used for the host hashing, if the host is
       provided hashed. If the host is provided in plain  text,  salt  has  no
       meaning.   The  salt  has to be provided base64 encoded with a trailing
       zero byte.

       key is a pointer to the key for the given host.

       keylen is the total size in bytes of the key  pointed  to  by  the  key
       argument

       comment is a pointer to a comment for the key.

       commentlen  is the total size in bytes of the comment pointed to by the
       comment argument

       typemask is a bitmask that specifies format and  info  about  the  data
       passed  to this function. Specifically, it details what format the host
       name is, what format the key is and what key type it is.

       The host name is given as one of the  following  types:  LIBSSH2_KNOWN-
       HOST_TYPE_PLAIN,    LIBSSH2_KNOWNHOST_TYPE_SHA1    or    LIBSSH2_KNOWN-
       HOST_TYPE_CUSTOM.

       The key is encoded using one of the following encodings: LIBSSH2_KNOWN-
       HOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.

       The  key  is using one of these algorithms: LIBSSH2_KNOWNHOST_KEY_RSA1,
       LIBSSH2_KNOWNHOST_KEY_SSHRSA or LIBSSH2_KNOWNHOST_KEY_SSHDSS.

       store should point to a pointer that gets filled in  to  point  to  the
       known  host  data  after  the addition. NULL can be passed if you don't
       care about this pointer.

RETURN VALUE
       Returns a regular libssh2 error code, where negative values  are  error
       codes and 0 indicates success.

AVAILABILITY
       Added in libssh2 1.2.5


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | library/libssh2  |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

SEE ALSO
       libssh2_knownhost_init(3)    libssh2_knownhost_free(3)   libssh2_known-
       host_check(3)



NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source  was  downloaded   from    https://www.libssh2.org/download/lib-
       ssh2-1.10.0.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.libssh2.org/.



libssh2 1.2                       28 May 2009
                                                  libssh2_knownhost_add(3ssh2)