rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.67k stars 384 forks source link

Fix Windows SSH authentication issues #876

Closed WSSDude closed 1 year ago

WSSDude commented 2 years ago

As was commented in issue #872 in comment, libssh2 on Windows uses WinCNG backend by default.

Its implementation is old and does not support modern key formats, making libgit2 (and by extension git2-rs bindings) unusable on Windows when one wishes to use SSH authentication, as only formats that won't cause infinite loop when trying to authenticate or fail are the ones that GitHub and others don't support anymore.

Utilizing openssl-on-win32 ssh2-rs feature allows for proper use of SSH authentication method on Windows builds without infinite loops and fails inside git2-rs. This PR does just that - enables this feature.

I don't know if this is the best approach for this (I'm still a bit new to Rust), but doing this solved all SSH auth issues I had (and which probably cannot be solved otherwise on Windows OS without libssh2 updating WinCNG backend...)

WSSDude commented 2 years ago

Think CI may also need an update, looking at the output... Dont know what exactly went wrong, OpenSSL for the test seems misconfigured having quick glance at the output.

I have no compilation issues myself (although I use vendored OpenSSL package so that may have something to do with it)