summaryrefslogtreecommitdiff
path: root/include/git2/transport.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-07-04 12:45:43 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-09-16 17:01:30 +0200
commit9b9405865e15da3a0a6ee0a67b59b36c5a973a8c (patch)
treeab758a8c8b5ff4ecb6d5e2d91926c0ca397d56f8 /include/git2/transport.h
parentd99c8ca1783cfd04869e88f8707c036fc6053a05 (diff)
downloadlibgit2-9b9405865e15da3a0a6ee0a67b59b36c5a973a8c.tar.gz
Provide a callback for certificate validation
If the certificate validation fails (or always in the case of ssh), let the user decide whether to allow the connection. The data structure passed to the user is the native certificate information from the underlying implementation, namely OpenSSL or WinHTTP.
Diffstat (limited to 'include/git2/transport.h')
-rw-r--r--include/git2/transport.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h
index 7090698ac..cd4429fee 100644
--- a/include/git2/transport.h
+++ b/include/git2/transport.h
@@ -20,6 +20,43 @@
*/
GIT_BEGIN_DECL
+/**
+ * Type of host certificate structure that is passed to the check callback
+ */
+typedef enum git_cert_t {
+ /**
+ * The `data` argument to the callback will be a pointer to
+ * OpenSSL's `X509` structure.
+ */
+ GIT_CERT_X509_OPENSSL,
+ GIT_CERT_X509_WINHTTP,
+ /**
+ * The `data` argument to the callback will be a pointer to a
+ * `git_cert_hostkey` structure.
+ */
+ GIT_CERT_HOSTKEY_LIBSSH2,
+} git_cert_t;
+
+/**
+ * Hostkey information taken from libssh2
+ */
+typedef struct {
+ /**
+ * A hostkey type from libssh2, either
+ * `LIBSSH2_HOSTKEY_HASH_MD5` or `LIBSSH2_HOSTKEY_HASH_SHA1`
+ */
+ int type;
+ /**
+ * Hostkey hash. If the type is MD5, only the first 16 bytes
+ * will be set.
+ */
+ unsigned char hash[20];
+} git_cert_hostkey;
+
+/*
+ *** Begin interface for credentials acquisition ***
+ */
+
/** Authentication type requested */
typedef enum {
/* git_cred_userpass_plaintext */