libssh2_session_hostkey(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_session_hostkey(3) πŸ’–

okay so bestie, this one lives in the libssh2 manual, and it's genuinely one of the most useful little gremlins in the whole library. let's get into it 🫢


✨ NAME ✨

libssh2_session_hostkey β€” get the remote key πŸ”‘


✨ SYNOPSIS ✨

#include <libssh2.h>

const char *
libssh2_session_hostkey(LIBSSH2_SESSION *session,
                        size_t *len, int *type);

✨ DESCRIPTION ✨

so basically πŸ’… this function hands you back a pointer to the current host key, and the value that len points to gets filled in with the length of the key. two-for-one, we love to see it ✨

and type? yeah that one points to the type of hostkey, and it's gonna be one of these three, no cap:

  • LIBSSH2_HOSTKEY_TYPE_RSA
  • LIBSSH2_HOSTKEY_TYPE_DSS β€” deprecated 🫠 like, it's still listed, but consider this your soft launch warning
  • LIBSSH2_HOSTKEY_TYPE_UNKNOWN
it's giving "three options only," and honestly? that's the whole list. periodt. πŸ’€

✨ RETURN VALUE ✨

a pointer πŸ’– … or NULL if something went wrong 😭 (the villain era of return values).


✨ SEE ALSO ✨


and that's the whole vibe check, bestie πŸŽ€ this page is from libssh2 0.15, dated 1 Jun 2007 (yes, she's an elder icon πŸ‘‘, main character since day one, and we respect her fr fr πŸŒΈβœ¨πŸ’…)