libssh2_knownhost_addc.3 (2661B)
1.\" 2.\" Copyright (c) 2009, 2010 by Daniel Stenberg 3.\" 4.TH libssh2_knownhost_addc 3 "28 May 2009" "libssh2 1.2" "libssh2" 5.SH NAME 6libssh2_knownhost_addc - add a known host 7.SH SYNOPSIS 8.nf 9#include <libssh2.h> 10 11int 12libssh2_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.fi 19.SH DESCRIPTION 20Adds a known host to the collection of known hosts identified by the 'hosts' 21handle. 22 23\fIhost\fP is a pointer the host name in plain text or hashed. If hashed, it 24must be provided base64 encoded. The host name can be the IP numerical address 25of the host or the full name. 26 27If you want to add a key for a specific port number for the given host, you 28must provide the host name like '[host]:port' with the actual characters '[' 29and ']' enclosing the host name and a colon separating the host part from the 30port number. For example: \&"[host.example.com]:222". 31 32\fIsalt\fP is a pointer to the salt used for the host hashing, if the host is 33provided hashed. If the host is provided in plain text, salt has no meaning. 34The salt has to be provided base64 encoded with a trailing zero byte. 35 36\fIkey\fP is a pointer to the key for the given host. 37 38\fIkeylen\fP is the total size in bytes of the key pointed to by the \fIkey\fP 39argument 40 41\fIcomment\fP is a pointer to a comment for the key. 42 43\fIcommentlen\fP is the total size in bytes of the comment pointed to by the \fIcomment\fP argument 44 45\fItypemask\fP is a bitmask that specifies format and info about the data 46passed to this function. Specifically, it details what format the host name is, 47what format the key is and what key type it is. 48 49The host name is given as one of the following types: 50LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or 51LIBSSH2_KNOWNHOST_TYPE_CUSTOM. 52 53The key is encoded using one of the following encodings: 54LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64. 55 56The key is using one of these algorithms: 57LIBSSH2_KNOWNHOST_KEY_RSA1, LIBSSH2_KNOWNHOST_KEY_SSHRSA or 58LIBSSH2_KNOWNHOST_KEY_SSHDSS. 59 60\fIstore\fP should point to a pointer that gets filled in to point to the 61known host data after the addition. NULL can be passed if you do not care about 62this pointer. 63.SH RETURN VALUE 64Returns a regular libssh2 error code, where negative values are error codes 65and 0 indicates success. 66.SH AVAILABILITY 67Added in libssh2 1.2.5 68.SH SEE ALSO 69.BR libssh2_knownhost_init(3) 70.BR libssh2_knownhost_free(3) 71.BR libssh2_knownhost_check(3)