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