libssh2_sign_sk(3)
π 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 bylibssh2_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 withLIBSSH2_FREE. yes bestie, you have to clean up after yourself, it's giving chores.sig_lenβ A pointer to the length of thesigparameter.dataβ The data to sign.data_lenβ The length of thedataparameter.abstractβ A pointer to a pointer to aLIBSSH2_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 areLIBSSH2_HOSTKEY_TYPE_ED25519andLIBSSH2_HOSTKEY_TYPE_ECDSA_256.flagsβ A bitmask specifying options for the authenticator. WhenLIBSSH2_SK_PRESENCE_REQUIREDis set, the authenticator requires a touch. WhenLIBSSH2_SK_VERIFICATION_REQUIREDis set, the authenticator requires a PIN. Many servers and authenticators do not work properly whenLIBSSH2_SK_PRESENCE_REQUIREDis 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 thekey_handleparameter.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_handleThe decoded key handle from the private key file.handle_lenThe length of thekey_handleparameter.sign_callbackβ Responsible for communicating with the hardware authenticator to generate a signature. On success, the signature information must be placed in thesig_infosig_info parameter and the callback must return0. On failure, it should return a negative number. Seelibssh2_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 ππ
π¦ 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