Domanda

I'm currently wrapping the git_cred API in Objective-Git, and I don't understand some of the expected arguments. For reference, here are the "offending" prototypes :

int git_cred_ssh_publickey_new(
    git_cred **out,
    const char *username,
    const char *publickey, size_t publickey_len,
    git_cred_sign_callback sign_fn, void *sign_data);

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

(I extracted the last one from the #define LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC).

What is git_cred_sign_callback used for ? It takes a LIBSSH2_SESSION which is pretty low-level, even from the POV of libgit2, and I'm not sure what I'm expected to do in that callback...

È stato utile?

Soluzione

It takes a LIBSSH2_SESSION because it's a libssh2 callback; it's not low-level, it's orthogonal to the workings of libgit2.

The function is provided for you to sign the data yourself. It's provided mostly for completeness, as the underlying functionality is an undocumented quirk of libssh2.

See e.g. http://www.libssh2.org/libssh2_userauth_publickey.html and http://www.libssh2.org/mail/libssh2-devel-archive-2012-10/0071.shtml

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top