libssh2_userauth_publickey_fromfile()
fails with error code
-19 (LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED).
I want to use Public key authentication method only (and not password based authentication). Authentication by password works fine.
System: Windows Server 2019
API call:
libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)
I have defined keyfile1 and keyfile2 in my C file as:
const char *keyfile1 = "C:\\Users\\Administrator\\.ssh\\id_rsa.pub";
const char *keyfile2 = "C:\\Users\\Administrator\\.ssh\\id_rsa";
I suspect that it has to do something with EOL with the key files on Windows (This call works pretty well on my Linux system (with appropriate key file locations)).
Any idea on how could we remove EOL or extra spaces from the key files so that the libssh2
API call succeeds?