cURL / Mailing Lists / curl-library / Single Mail


Getting empty key on CURLOPT_SSH_KEYFUNCTION callback

From: Rubén Durán Balda <>
Date: Tue, 11 Nov 2014 10:45:08 +0100


I'm trying to write a tests program that is able to show the remote key
provided by an SSH server and will eventually ask the user to accept or
decline it. You'll find attached a really simplified version that only
lists the root folder of a server and tries to print the remote key on
screen. I'm just telling curl to use a known_host file and to use my custom
CURLOPT_SSH_KEYFUNCTION (which in the attachment only prints the remote key
and accepts it).

I debugged it and the values provided to ssh_keycallback are:
* match is CURLKHMATCH_MISSING, which is correct since my known_host file
is empty
* knownkey is a null pointer, which is correct for the same reason
* foundkey points to a structure with keytype set to CURLKHTYPE_RSA, len
set to 0x117 and key set to ""

I've got this behaviour both with libcurl 7.38.0 and 7.39.0 in Windows and
with 7.26 en Linux.

Am I doing anything wrong or is it a bug? If I can provide you with more
information just ask for it, I tried debugging libcurl and libssh2 but I
eventually got lost.


List admin:

Received on 2014-11-11