libssh2_sign_sk(3)

πŸ“¦
version 1.11.1 Β· 2 versions
  • 1.11.1 Β· 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 (latest)
  • 1.11.0 Β· ubuntu noble
, 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_sign_sk πŸ’–

okay bestie, so this is a page from the libssh2 manual set β€” it's libssh2_sign_sk, and it's all about getting a signature out of your FIDO2 authenticator. yes, the little key you boop with your finger. iconic behaviour honestly. let's get into it 🫢


✨ NAME ✨

libssh2_sign_sk β€” Create a signature from a FIDO2 authenticator.


✨ SYNOPSIS ✨

#include <libssh2.h>

int
libssh2_sign_sk(LIBSSH2_SESSION *session,
                unsigned char **sig,
                size_t *sig_len,
                const unsigned char *data,
                size_t data_len,
                void **abstract);

typedef struct _LIBSSH2_PRIVKEY_SK {
    int algorithm;
    uint8_t flags;
    const char *application;
    const unsigned char *key_handle;
    size_t handle_len;
    LIBSSH2_USERAUTH_SK_SIGN_FUNC((*sign_callback));
    void **orig_abstract;
} LIBSSH2_PRIVKEY_SK;

✨ DESCRIPTION ✨

okay so here's the vibe β€” every single one of these parameters, explained with love πŸ’œ

  • session β€” Session instance as returned by libssh2_session_init_ex(3). that's your main character session object fr fr.
  • sig β€” A pointer to a buffer in which to place the signature. The caller is responsible for freeing the signature with LIBSSH2_FREE. yes bestie, you have to clean up after yourself, it's giving chores.
  • sig_len β€” A pointer to the length of the sig parameter.
  • data β€” The data to sign.
  • data_len β€” The length of the data parameter.
  • abstract β€” A pointer to a pointer to a LIBSSH2_PRIVKEY_SK. See description below. πŸ‘€

Create a signature from a FIDO2 authenticator, using either the sk-ssh-ed25519@openssh.com or sk-ecdsa-sha2-nistp256@openssh.com key exchange algorithms. pick your fighter, both ate. πŸŽ€

The abstract parameter is a pointer to a pointer due to the internal workings of libssh2. The LIBSSH2_PRIVKEY_SK must be completely filled out, and the caller is responsible for all memory management of its fields. no skipping fields, no cap β€” fill it all in and manage your own memory, that's the deal.

  • algorithm β€” The signing algorithm to use. Possible values are LIBSSH2_HOSTKEY_TYPE_ED25519 and LIBSSH2_HOSTKEY_TYPE_ECDSA_256.
  • flags β€” A bitmask specifying options for the authenticator. When LIBSSH2_SK_PRESENCE_REQUIRED is set, the authenticator requires a touch. When LIBSSH2_SK_VERIFICATION_REQUIRED is set, the authenticator requires a PIN. Many servers and authenticators do not work properly when LIBSSH2_SK_PRESENCE_REQUIRED is not set. 🫡 so like, set it. please. for your own good.
  • application β€” A user-defined string to use as the RP name for the authenticator. Usually "ssh:".
  • key_handle β€” The key handle to use for the authenticator's allow list.
  • handle_len β€” The length of the key_handle parameter.
  • abstract β€” User-defined data. When a PIN is required, use this to pass in the PIN, or a function pointer to retrieve the PIN.
  • key_handle The decoded key handle from the private key file.
  • handle_len The length of the key_handle parameter.
  • sign_callback β€” Responsible for communicating with the hardware authenticator to generate a signature. On success, the signature information must be placed in the sig_info sig_info parameter and the callback must return 0. On failure, it should return a negative number. See libssh2_userauth_publickey_sk(3) for more information. ✨
  • orig_abstract β€” User-defined data. When a PIN is required, use this to pass in the PIN, or a function pointer to retrieve the PIN.

✨ RETURN VALUE ✨

Return 0 on success or negative on failure. that's it, that's the whole mood πŸ’…


✨ SEE ALSO ✨


and that's a wrap, bestie 🌈 this lil page is from the libssh2 1.10.0 era, dated 1 Jun 2022. go forth, boop your authenticator, and slay πŸ‘‘πŸ’–