1libssh2_userauth_publickey_fromfillieb(s3s)h2 mlainbusaslh2_userauth_publickey_fromfile(3)
2
3
4
6 libssh2_userauth_publickey_fromfile - authenticate a session with a
7 public key, read from a file
8
10 #include <libssh2.h>
11
12 int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
13 const char *username,
14 unsigned int ousername_len,
15 const char *publickey,
16 const char *privatekey,
17 const char *passphrase);
18
20 session - Session instance as returned by libssh2_session_init_ex(3)
21
22 username - Pointer to user name to authenticate as.
23
24 username_len - Length of username.
25
26 publickey - Path name of the public key file. (e.g.
27 /etc/ssh/hostkey.pub). If libssh2 is built against OpenSSL, this option
28 can be set to NULL.
29
30 privatekey - Path name of the private key file. (e.g. /etc/ssh/hostkey)
31
32 passphrase - Passphrase to use when decoding privatekey.
33
34 Attempt public key authentication using a PEM encoded private key file
35 stored on disk
36
37
39 Return 0 on success or negative on failure. It returns LIB‐
40 SSH2_ERROR_EAGAIN when it would otherwise block. While LIB‐
41 SSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per
42 se.
43
44
46 LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
47
48 LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
49
50 LIBSSH2_ERROR_SOCKET_TIMEOUT -
51
52 LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED - The username/public key combina‐
53 tion was invalid.
54
55 LIBSSH2_ERROR_AUTHENTICATION_FAILED - Authentication using the supplied
56 public key was not accepted.
57
58
60 libssh2_session_init_ex(3)
61
62
63
64libssh2 0.15 1 Jun 2l0i0b7ssh2_userauth_publickey_fromfile(3)