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