请教哪位大神,我在使用libssh2编写sftp客户端时执行到libssh_2_userauth_publickey_fromfil函数总是失败的,请问为什么呢?调用都是代码就是libssh2自带的测试案例。
if (libssh2_userauth_publickey_fromfile(*session, strUser, "~/.ssh/id_rsa.pub", "~/.ssh/id_rsa", strPass))
{
fprintf(stderr, "\tAuthentication by public key failed!\n");
goto shutdown;
} else {
fprintf(stderr, "\tAuthentication by public key succeeded.\n");
}
~/.ssh/id_rsa和~/.ssh/id_rsa.pub都是本机的秘钥
哪位大神可以指点下。