libssh2_userauth_publickey(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… libssh2_userauth_publickey β€” bestie, we're logging in with a callback

okay so real talk: this page lives in the libssh2 manual, and it's about authenticating with a public key, except instead of handing over a file path you hand over a callback function that does the signing for you. main character energy honestly 🫢


✨ NAME ✨

libssh2_userauth_publickey β€” authenticate using a callback function

🌸 SYNOPSIS 🌸

#include <libssh2.h>

int
libssh2_userauth_publickey(LIBSSH2_SESSION *session,
                           const char *user,
                           const unsigned char *pubkeydata,
                           size_t pubkeydata_len,
                           sign_callback,
                           void **abstract);

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically you authenticate using the sign_callback callback, and that callback has to match the prototype down there in the CALLBACK section. That's the whole vibe. No file paths, no drama β€” you bring the function, it brings the signature ✨

πŸŽ€ CALLBACK πŸŽ€

here's the shape your callback has to have, bestie, keep it exact:

int name(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
         const unsigned char *data, size_t data_len, void **abstract);

This function gets called...

ngl that trailing ellipsis is literally all the original gives us πŸ™ˆ we are NOT inventing more, that's the rules.

πŸ’– RETURN VALUE πŸ’–

Returns 0 on success, or negative on failure. periodt.

πŸ‘‘ SEE ALSO πŸ‘‘


that's the page!! πŸ’œ it's from the libssh2 manual, version 0.15, dated 1 Jun 2007 β€” so like, vintage, but she still ate. go sign something gorgeous, bestie πŸŒˆπŸŽ€πŸ¦‹