0

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

tiennou
  • 487
  • 3
  • 13

1 Answers1

1

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

Carlos Martín Nieto
  • 5,207
  • 1
  • 15
  • 16
  • Hmm, yeah sorry, I meant "low-level" somewhat as in "implementation-detail". I'm really wondering what to do with those two links though, the first says "This function gets called..." and stops and the other "Noone seems to remember quite how this API call works and it isn't documented." though there's a reference to another related call that has a `sign_callback`. Thanks for that pointer ! – tiennou Sep 16 '13 at 10:40