diff options
| author | Brad Morgan <brad@dmgctrl.com> | 2013-05-07 13:43:10 -0400 |
|---|---|---|
| committer | Brad Morgan <brad@dmgctrl.com> | 2013-05-07 13:45:31 -0400 |
| commit | c36565c0eea7b97726cffaeaf9abe2a3279ff70b (patch) | |
| tree | 5c5c18bf78260978b39fb7a8dd19326155fb1403 /include/git2/transport.h | |
| parent | 7621519f73dfa529dab4d48532559a5e321f6526 (diff) | |
| download | libgit2-c36565c0eea7b97726cffaeaf9abe2a3279ff70b.tar.gz | |
Added SSH public key authentication
Diffstat (limited to 'include/git2/transport.h')
| -rw-r--r-- | include/git2/transport.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h index 31572c16a..cc29f8b0e 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -11,6 +11,8 @@ #include "net.h" #include "types.h" +#include <libssh2.h> + /** * @file git2/transport.h * @brief Git transport interfaces and functions @@ -28,6 +30,7 @@ typedef enum { /* git_cred_userpass_plaintext */ GIT_CREDTYPE_USERPASS_PLAINTEXT = 1, GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE = 2, + GIT_CREDTYPE_SSH_PUBLICKEY = 3, } git_credtype_t; /* The base structure for all credential types */ @@ -44,7 +47,7 @@ typedef struct git_cred_userpass_plaintext { char *password; } git_cred_userpass_plaintext; -/* A plaintext username and password */ +/* A ssh key file and passphrase */ typedef struct git_cred_ssh_keyfile_passphrase { git_cred parent; char *publickey; @@ -52,6 +55,15 @@ typedef struct git_cred_ssh_keyfile_passphrase { char *passphrase; } git_cred_ssh_keyfile_passphrase; +/* A ssh public key and authentication callback */ +typedef struct git_cred_ssh_publickey { + git_cred parent; + char *publickey; + size_t publickey_len; + void *sign_callback; + void *sign_data; +} git_cred_ssh_publickey; + /** * Creates a new plain-text username and password credential object. * The supplied credential parameter will be internally duplicated. @@ -83,6 +95,24 @@ GIT_EXTERN(int) git_cred_ssh_keyfile_passphrase_new( const char *passphrase); /** + * Creates a new ssh public key credential object. + * The supplied credential parameter will be internally duplicated. + * + * @param out The newly created credential object. + * @param publickey The bytes of the public key. + * @param publickey_len The length of the public key in bytes. + * @param sign_callback The callback method for authenticating. + * @param sign_data The abstract data sent to the sign_callback method. + * @return 0 for success or an error code for failure + */ +GIT_EXTERN(int) git_cred_ssh_publickey_new( + git_cred **out, + const char *publickey, + size_t publickey_len, + LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC((*sign_callback)), + void *sign_data); + +/** * Signature of a function which acquires a credential object. * * @param cred The newly created credential object. |
