libssh2_session_methods(3)
β¨ libssh2_session_methods β bestie, let's find out which algorithms are ACTUALLY running π
ok so real talk: this is the libssh2 function that tells you which algorithms your session ended up using. Like, you asked for a whole menu of options and SSH picked one β this is how you find out which one. Iconic behaviour fr fr. π¦
πΈ SYNOPSIS πΈ
#include <libssh2.h>
const char *
libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
π DESCRIPTION π
So you pass in two things, bestie:
sessionβ the session instance, aka the thing you got back fromlibssh2_session_init_ex(3). You know her. πmethod_typeβ literally just one of these method type constants, pick your fighter:LIBSSH2_METHOD_KEXLIBSSH2_METHOD_HOSTKEYLIBSSH2_METHOD_CRYPT_CSLIBSSH2_METHOD_CRYPT_SCLIBSSH2_METHOD_MAC_CSLIBSSH2_METHOD_MAC_SCLIBSSH2_METHOD_COMP_CSLIBSSH2_METHOD_COMP_SCLIBSSH2_METHOD_LANG_CSLIBSSH2_METHOD_LANG_SCLIBSSH2_METHOD_SIGN_ALGO
And what does it do?? It returns the actual method negotiated for that particular transport parameter. Not the list you offered. Not the list they offered. The one that actually got picked. The main character. π
π RETURN VALUE π
You get the negotiated method back as a string. π«
But β and this is the plot twist β you get NULL if the session has not yet been started. Like, girl hasn't even shown up to the party yet, there's nothing to report. π
π ERRORS π
LIBSSH2_ERROR_INVALβ the requested method type was invalid. You handed it a constant that doesn't exist, bestie, that's on you. πLIBSSH2_ERROR_METHOD_NONEβ no method has been set. Empty. Void. Nothing there. π
π SEE ALSO π
and that's the whole vibe check, babe β go forth and inspect your transport parameters, you absolute legend π«Άβ¨
mwah π this page lives in libssh2 1.11, dated 8 Nov 2021, and it's part of the libssh2 manual β now go slay some SSH π π
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms