---
name: "libssh2_userauth_publickey"
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_userauth_publickey"
---

# libssh2\_userauth\_publickey(3)

authenticate using a callback function

## 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

Authenticate with the *sign\_callback* callback that matches the prototype below

## CALLBACK

```
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...

## RETURN VALUE

Return 0 on success or negative on failure.

## SEE ALSO

**[libssh2\_userauth\_publickey\_fromfile\_ex(3)](/libssh2_userauth_publickey_fromfile_ex/3.md)**
