libssh2_userauth_publickey_fromfile_ex.3 (1852B)
1.TH libssh2_userauth_publickey_fromfile_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2" 2.SH NAME 3libssh2_userauth_publickey_fromfile_ex - authenticate a session with a public key, read from a file 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7 8int 9libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, 10 const char *username, 11 unsigned int username_len, 12 const char *publickey, 13 const char *privatekey, 14 const char *passphrase); 15.fi 16.SH DESCRIPTION 17\fIsession\fP - Session instance as returned by 18\fBlibssh2_session_init_ex(3)\fP 19 20\fIusername\fP - Pointer to user name to authenticate as. 21 22\fIusername_len\fP - Length of \fIusername\fP. 23 24\fIpublickey\fP - Path name of the public key file. 25(e.g. /etc/ssh/hostkey.pub). If libssh2 is built against OpenSSL, this option 26can be set to NULL. 27 28\fIprivatekey\fP - Path name of the private key file. (e.g. /etc/ssh/hostkey) 29 30\fIpassphrase\fP - Passphrase to use when decoding \fIprivatekey\fP. 31 32Attempt public key authentication using a PEM encoded private key file stored 33on disk 34.SH RETURN VALUE 35Return 0 on success or negative on failure. It returns 36LIBSSH2_ERROR_EAGAIN when it would otherwise block. While 37LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. 38.SH ERRORS 39\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. 40 41\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 42 43\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP - 44 45\fILIBSSH2_ERROR_PUBLICKEY_UNVERIFIED\fP - The username/public key 46combination was invalid. 47 48\fILIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - Authentication using the supplied 49public key was not accepted. 50.SH SEE ALSO 51.BR libssh2_session_init_ex(3)