logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

libssh2_knownhost_add - add a known host

Availability

       Added in libssh2 1.2, deprecated since libssh2 1.2.5. Use libssh2_knownhost_addc(3) instead!

Description

       We  discourage  use  of  this  function  as  of  libssh2  1.2.5.  Instead  we  strongly urge users to use
       libssh2_knownhost_addc(3) instead, which as a more complete API. libssh2_knownhost_add(3) is subject  for
       removal in a future release.

       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.

       saltPisapointertothesaltusedforthehosthashing,ifthehostisprovidedhashed.Ifthehostisprovidedinplaintext,salthasnomeaning.Thesalthastobeprovidedbase64encodedwithatrailingzerobyte.keyisapointertothekeyforthegivenhost.keylenisthetotalsizeinbytesofthekeypointedtobythekeyargumenttypemaskisabitmaskthatspecifiesformatandinfoaboutthedatapassedtothisfunction.Specifically,itdetailswhatformatthehostnameis,whatformatthekeyisandwhatkeytypeitis.Thehostnameisgivenasoneofthefollowingtypes:LIBSSH2_KNOWNHOST_TYPE_PLAIN,LIBSSH2_KNOWNHOST_TYPE_SHA1orLIBSSH2_KNOWNHOST_TYPE_CUSTOM.Thekeyisencodedusingoneofthefollowingencodings:LIBSSH2_KNOWNHOST_KEYENC_RAWorLIBSSH2_KNOWNHOST_KEYENC_BASE64.Thekeyisusingoneofthesealgorithms:LIBSSH2_KNOWNHOST_KEY_RSA1,LIBSSH2_KNOWNHOST_KEY_SSHRSAorLIBSSH2_KNOWNHOST_KEY_SSHDSS(deprecated).storeshouldpointtoapointerthatgetsfilledintopointtotheknownhostdataaftertheaddition.NULLcanbepassedifyoudonotcareaboutthispointer.

Name

       libssh2_knownhost_add - add a known host

Return Value

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

See Also

libssh2_knownhost_init(3)libssh2_knownhost_free(3)libssh2_knownhost_check(3)libssh2_knownhost_addc(3)

libssh2                                            28 May 2009                          libssh2_knownhost_add(3)

Synopsis

       #include <libssh2.h>

       int
       libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
                             char *host, char *salt,
                             char *key, size_t keylen,
                             int typemask,
                             struct libssh2_knownhost **store);

See Also