Hi Stephen McRoberts. Stephen McRoberts have written on Tue, 30 May 2017 10:37:04 -0400:
> Supporting information below but question: > How can I simulate the "-k" option in libcurl? Any idea why > authentication fails? > > -- Details -- > Running on MacOS 10.12.5 > Installed libssh2 using brew > Downloaded curl-7.54.0 > ---cd curl-7.54.0 > ---./configure --with-libssh2=/usr/local > ---make > ---sudo make install > > Downloaded sftpget.c as test and added this: > char* nameenc = curl_easy_escape(curl, NAME, 0); > char* passenc = curl_easy_escape(curl, PASS, 0); > curl_easy_setopt(curl, CURLOPT_URL, > "sftp://raspberrypi.local/~/test.txt"); curl_easy_setopt(curl, > CURLOPT_USERNAME, nameenc); curl_easy_setopt(curl, CURLOPT_PASSWORD, > passenc); > > But I get this (truncated): > SSH authentication methods available: publickey,password > No identity would match > Authentication failure > curl told us 67 > > I tried the same thing with cURL: > curl -k "sftp://raspberrypi.local/~/test.txt" --user "NAME:PASS" -o > "/Users/steve/Downloads/test.txt" and it worked fine. Although, > omitting the "-k" option failed with: curl: (51) SSL peer certificate > or SSH remote key was not OK how about to add --libcurl myoutput.c to your line and see what curl produces. In the meantime you can try this option. https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html Regards Aleks > Note that I normally use public/private key to login to > raspberrypi.local without password and that works fine. > > > ------------------------------------------------------------------- > Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library > Etiquette: https://curl.haxx.se/mail/etiquette.html ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
