libssh2\_session\_hostkey(3) libssh2 libssh2\_session\_hostkey(3)

# [NAME](#NAME)

libssh2\_session\_hostkey - get the remote key

# [SYNOPSIS](#SYNOPSIS)

```
#include <libssh2.h>
const char *
libssh2_session_hostkey(LIBSSH2_SESSION *session,


                        size_t *len, int *type);
```

# [DESCRIPTION](#DESCRIPTION)

Returns a pointer to the current host key, the value *len* points to will get the length of the key.

The value *type* points to the type of hostkey which is one of: LIBSSH2\_HOSTKEY\_TYPE\_RSA, LIBSSH2\_HOSTKEY\_TYPE\_DSS (deprecated), or LIBSSH2\_HOSTKEY\_TYPE\_UNKNOWN.

# [RETURN VALUE](#RETURN_VALUE)

A pointer, or NULL if something went wrong.

# [SEE ALSO](#SEE_ALSO)

[**libssh2\_knownhost\_check(3)**](/man/os/libssh2/libssh2_knownhost_check.3) [**libssh2\_knownhost\_add(3)**](/man/os/libssh2/libssh2_knownhost_add.3)

1 Jun 2007 libssh2 0.15

---

Document: libssh2_session_hostkey(3) from libssh2 1.11.1-r10 (Chainguard OS)
Source: https://github.com/libssh2/libssh2.git
