libssh2_userauth_publickey_frommemory.3 (2216B)
1.TH libssh2_userauth_publickey_frommemory 3 "1 Sep 2014" "libssh2" "libssh2" 2.SH NAME 3libssh2_userauth_publickey_frommemory - authenticate a session with a public key, read from memory 4.SH SYNOPSIS 5.nf 6#include <libssh2.h> 7 8int 9libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, 10 const char *username, 11 size_t username_len, 12 const char *publickeydata, 13 size_t publickeydata_len, 14 const char *privatekeydata, 15 size_t privatekeydata_len, 16 const char *passphrase); 17.fi 18.SH DESCRIPTION 19This function allows to authenticate a session with a public key read from memory. 20It is only supported when libssh2 is backed by OpenSSL. 21\fIsession\fP - Session instance as returned by 22.BR libssh2_session_init_ex(3) 23 24\fIusername\fP - Remote user name to authenticate as. 25 26\fIusername_len\fP - Length of username. 27 28\fIpublickeydata\fP - Buffer containing the contents of a public key file. 29 30\fIpublickeydata_len\fP - Length of public key data. 31 32\fIprivatekeydata\fP - Buffer containing the contents of a private key file. 33 34\fIprivatekeydata_len\fP - Length of private key data. 35 36\fIpassphrase\fP - Passphrase to use when decoding private key file. 37 38Attempt public key authentication using a PEM encoded private key file stored in memory. 39.SH RETURN VALUE 40Return 0 on success or negative on failure. It returns 41LIBSSH2_ERROR_EAGAIN when it would otherwise block. While 42LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. 43.SH ERRORS 44\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. 45 46\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket. 47 48\fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP - 49 50\fILIBSSH2_ERROR_PUBLICKEY_UNVERIFIED\fP - The username/public key 51combination was invalid. 52 53\fILIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - Authentication using the supplied 54public key was not accepted. 55.SH AVAILABILITY 56libssh2_userauth_publickey_frommemory was added in libssh2 1.6.0 57.SH SEE ALSO 58.BR libssh2_session_init_ex(3)