---
name: "libssh2_session_methods"
section: "3"
platform: "linux"
package: "libssh2"
version: "1.11.1-7"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libssh2_session_methods"
---

# libssh2\_session\_methods(3)

return the currently active algorithms

## NAME

libssh2\_session\_methods - return the currently active algorithms

## SYNOPSIS

```
#include <libssh2.h>
const char *
libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
```

## DESCRIPTION

*session* - Session instance as returned by **[libssh2\_session\_init\_ex(3)](/libssh2_session_init_ex/3.md)**

*method\_type* - one of the method type constants: LIBSSH2\_METHOD\_KEX, LIBSSH2\_METHOD\_HOSTKEY, LIBSSH2\_METHOD\_CRYPT\_CS, LIBSSH2\_METHOD\_CRYPT\_SC, LIBSSH2\_METHOD\_MAC\_CS, LIBSSH2\_METHOD\_MAC\_SC, LIBSSH2\_METHOD\_COMP\_CS, LIBSSH2\_METHOD\_COMP\_SC, LIBSSH2\_METHOD\_LANG\_CS, LIBSSH2\_METHOD\_LANG\_SC, LIBSSH2\_METHOD\_SIGN\_ALGO.

Returns the actual method negotiated for a particular transport parameter.

## RETURN VALUE

Negotiated method or NULL if the session has not yet been started.

## ERRORS

*LIBSSH2\_ERROR\_INVAL* - The requested method type was invalid.

*LIBSSH2\_ERROR\_METHOD\_NONE* - no method has been set

## SEE ALSO

**[libssh2\_session\_init\_ex(3)](/libssh2_session_init_ex/3.md)**
