{"action":"created","issue":{"url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/20","labels_url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/20/comments","events_url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/20/events","html_url":"https://github.com/alexcrichton/ssh2-rs/issues/20","id":92129432,"number":20,"title":"Windows MSVC build: \"Unable to exchange encryption keys\"","user":{"login":"CraZySacX","id":1423378,"avatar_url":"https://avatars.githubusercontent.com/u/1423378?v=3","gravatar_id":"","url":"https://api.github.com/users/CraZySacX","html_url":"https://github.com/CraZySacX","followers_url":"https://api.github.com/users/CraZySacX/followers","following_url":"https://api.github.com/users/CraZySacX/following{/other_user}","gists_url":"https://api.github.com/users/CraZySacX/gists{/gist_id}","starred_url":"https://api.github.com/users/CraZySacX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CraZySacX/subscriptions","organizations_url":"https://api.github.com/users/CraZySacX/orgs","repos_url":"https://api.github.com/users/CraZySacX/repos","events_url":"https://api.github.com/users/CraZySacX/events{/privacy}","received_events_url":"https://api.github.com/users/CraZySacX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-30T15:49:34Z","updated_at":"2015-07-21T03:29:59Z","closed_at":null,"body":"The following code below successfully authenticates when built on Linux.   When built with the MSVC build on windows it fails at the handshake with:\r\n\r\n```\r\n[\"diffie-hellman-group14-sha1\", \"diffie-hellman-group-exchange-sha1\", \"diffie-hellman-group1-sha1\"]\r\n[\"ssh-rsa\", \"ssh-dss\"]\r\n[\"aes256-cbc\", \"rijndael-cbc@lysator.liu.se\", \"aes192-cbc\", \"aes128-cbc\", \"arcfour128\", \"arcfour\", \"3des-cbc\"]\r\nERROR: Error { code: -5, msg: \"Unable to exchange encryption keys\" }\r\n```\r\nI've verified that the server supports all three of the key exchange types.  I also built ssh2-rs against libssh2 1.6.0 as they had fixed some WinCG bugs, but that also resulted in the same error.  I could try and gather more debugging info on the client side, but I'm not sure how to configure libssh2 to spit out more info.\r\n\r\n```rust\r\nextern crate mush as ssh2;\r\n\r\nuse ssh2::Session;\r\nuse std::net::TcpStream;\r\n\r\nuse ssh2::MethodType::*;\r\n\r\nfn main() {\r\n    // Connect to the local SSH server\r\n    let tcp = TcpStream::connect(\"aservericonnecto:22\").unwrap();\r\n    let mut sess = Session::new().unwrap();\r\n\r\n    match sess.supported_algs(Kex) {\r\n        Ok(res) => {\r\n            println!(\"{:?}\", res);\r\n        },\r\n        Err(e) => {\r\n            println!(\"ERROR: {:?}\", e);\r\n            return\r\n        }\r\n    }\r\n\r\n    match sess.supported_algs(HostKey) {\r\n        Ok(res) => {\r\n            println!(\"{:?}\", res);\r\n        },\r\n        Err(e) => {\r\n            println!(\"ERROR: {:?}\", e);\r\n            return\r\n        }\r\n    }\r\n\r\n    match sess.supported_algs(CryptCs) {\r\n        Ok(res) => {\r\n            println!(\"{:?}\", res);\r\n        },\r\n        Err(e) => {\r\n            println!(\"ERROR: {:?}\", e);\r\n            return\r\n        }\r\n    }\r\n\r\n    // Errors out here on Windows MSVC build\r\n    match sess.handshake(&tcp) {\r\n        Ok(_) => {},\r\n        Err(e) => {\r\n            println!(\"ERROR: {:?}\", e);\r\n            return\r\n        }\r\n    }\r\n\r\n    // Try to authenticate with the first identity in the agent.\r\n    match sess.userauth_agent(\"username\") {\r\n        Ok(_) => {}\r\n        Err(e) => println!(\"ERROR: {:?}\", e),\r\n    }\r\n\r\n    // Make sure we succeeded\r\n    assert!(sess.authenticated());\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/comments/123140666","html_url":"https://github.com/alexcrichton/ssh2-rs/issues/20#issuecomment-123140666","issue_url":"https://api.github.com/repos/alexcrichton/ssh2-rs/issues/20","id":123140666,"user":{"login":"CraZySacX","id":1423378,"avatar_url":"https://avatars.githubusercontent.com/u/1423378?v=3","gravatar_id":"","url":"https://api.github.com/users/CraZySacX","html_url":"https://github.com/CraZySacX","followers_url":"https://api.github.com/users/CraZySacX/followers","following_url":"https://api.github.com/users/CraZySacX/following{/other_user}","gists_url":"https://api.github.com/users/CraZySacX/gists{/gist_id}","starred_url":"https://api.github.com/users/CraZySacX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CraZySacX/subscriptions","organizations_url":"https://api.github.com/users/CraZySacX/orgs","repos_url":"https://api.github.com/users/CraZySacX/repos","events_url":"https://api.github.com/users/CraZySacX/events{/privacy}","received_events_url":"https://api.github.com/users/CraZySacX/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T03:29:59Z","updated_at":"2015-07-21T03:29:59Z","body":"Seems to be a problem with wincng in libssh2.  I finally cobbled together a libssh2 build with openssl and everything works as expected."}}