cURL / Mailing Lists / curl-library / Single Mail

curl-library

Public key login with putty generated keys

From: Khaled El Manawhly <k.elmanawhly_at_gmail.com>
Date: Mon, 1 Oct 2012 10:09:50 -0400

Hey everyone, so I have been trying relentlessly to log into my SSH server
with a key pair but with no success.

The keys I'm using are generated by Putty (by copy-pasting the generating
public key into a text file then removing its file extensiion, and by
saving the private key through the "save private key" program option with a
passphrase). The server I'm using for testing is FreeSSHd.

When I try to log in through Putty using these keys, everything goes just
fine. However, using them in my libcurl program generates the following
message:

"SSH public key authentication failed: Callback returned error" and it
closes with a Curl error code: 67.

Here is the relevant code that I'm using:

curl_easy_setopt(hCurl, CURLOPT_KEYPASSWD, "koko");
curl_easy_setopt(hCurl, CURLOPT_USERNAME, "koko");
curl_easy_setopt(hCurl, CURLOPT_PASSWORD, "koko"); //probably useless but
just in case
curl_easy_setopt(hCurl, CURLOPT_SSH_PUBLIC_KEYFILE, "C:/keys/koko");
curl_easy_setopt(hCurl, CURLOPT_SSH_PRIVATE_KEYFILE, "C:/keys/kokoPK.ppk");
curl_easy_setopt(hCurl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PUBLICKEY);

Both the server and client are running on Windows 7.

Can anyone tell me what I'm doing wrong?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-01