diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2020-11-22 18:25:00 -0800 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2020-11-27 06:08:46 -0800 |
| commit | 29fe5f61ac2d5f7039ecf7dad834918fc683c98e (patch) | |
| tree | 6705df1be2b7faf002b78d55fc049937caa43411 /include/git2/cert.h | |
| parent | 4fadd5948b73a5dddad2ceff6f6d1cd100b50db0 (diff) | |
| download | libgit2-29fe5f61ac2d5f7039ecf7dad834918fc683c98e.tar.gz | |
Also add the raw hostkey to `git_cert_hostkey`
`git_cert_x509` has the raw encoded certificate. Let's do the same for
the SSH certificate for symmetry.
Diffstat (limited to 'include/git2/cert.h')
| -rw-r--r-- | include/git2/cert.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/git2/cert.h b/include/git2/cert.h index e8cd2d180..07ae8c9f9 100644 --- a/include/git2/cert.h +++ b/include/git2/cert.h @@ -80,8 +80,19 @@ typedef enum { GIT_CERT_SSH_SHA1 = (1 << 1), /** SHA-256 is available */ GIT_CERT_SSH_SHA256 = (1 << 2), + /** Raw hostkey is available */ + GIT_CERT_SSH_RAW = (1 << 3), } git_cert_ssh_t; +typedef enum { + /** The raw key is of an unknown type. */ + GIT_CERT_SSH_RAW_TYPE_UNKNOWN = 0, + /** The raw key is an RSA key. */ + GIT_CERT_SSH_RAW_TYPE_RSA = 1, + /** The raw key is a DSS key. */ + GIT_CERT_SSH_RAW_TYPE_DSS = 2, +} git_cert_ssh_raw_type_t; + /** * Hostkey information taken from libssh2 */ @@ -89,28 +100,45 @@ typedef struct { git_cert parent; /**< The parent cert */ /** - * A hostkey type from libssh2, either - * `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1` + * A bitmask containing the available fields. */ git_cert_ssh_t type; /** - * Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will + * Hostkey hash. If `type` has `GIT_CERT_SSH_MD5` set, this will * have the MD5 hash of the hostkey. */ unsigned char hash_md5[16]; /** - * Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will + * Hostkey hash. If `type` has `GIT_CERT_SSH_SHA1` set, this will * have the SHA-1 hash of the hostkey. */ unsigned char hash_sha1[20]; /** - * Hostkey hash. If type has `GIT_CERT_SSH_SHA256` set, this will + * Hostkey hash. If `type` has `GIT_CERT_SSH_SHA256` set, this will * have the SHA-256 hash of the hostkey. */ unsigned char hash_sha256[32]; + + /** + * Raw hostkey type. If `type` has `GIT_CERT_SSH_RAW` set, this will + * have the type of the raw hostkey. + */ + git_cert_ssh_raw_type_t raw_type; + + /** + * Pointer to the raw hostkey. If `type` has `GIT_CERT_SSH_RAW` set, + * this will have the raw contents of the hostkey. + */ + const char *hostkey; + + /** + * Raw hostkey length. If `type` has `GIT_CERT_SSH_RAW` set, this will + * have the length of the raw contents of the hostkey. + */ + size_t hostkey_len; } git_cert_hostkey; /** |
