"Kex error : did not find one of algos diffie-hellman-group1-sha1- in list" when connecting with sshlib
"Kex error : did not find one of algos diffie-hellman-group1-sha1- in list" when connecting with sshlib
我正在 Windows 中实现 SFTP C++ 来传输一些文件。我已经通过 using this 下载并附加了所有库(libssh 0.5.0)。
我从 this author : Desphilboy 中找到了一些代码。但它显示错误为:
Error: Kex error : did not find one of algos diffie-hellman-group1-sha1- in list curve25519-sha256@libssh.org.ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 for kex algos. Could not connect the ssh session.1 Error : Writing packet: error on socket(or connection closed): No error.
我想使用这些系统用户名和密码连接到特定 IP。对此有什么建议吗?
下面是我的主要class
#include "ssh.h"
int main()
{
pSFTPConnector sshc = new SFTPConnector(L".\", L"147.13.5.123", 22, L"John", L"password"); // change the hostname , port , username, password to your sftp server, your credentials
FILE *nullfile = fopen("null", "w");
sshc->setLogFile(nullfile);
sshc->setVerbosity(1); // you can change the verbosity as appropriate for you
int i = sshc->InitSession();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->ConnectSession();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->InitSFTP();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->SFTPrename("renamed_myfile.txt", "myfile.txt"); //change these file names
i = sshc->Makedir("sftpdir");
i = sshc->testUploadFile("myfile2.txt", "1234567890testfile");
i = sshc->SFTPreget("c:\testdir\reget_downloaded_CAR_HIRE_FINAL.jpg", "CAR_HIRE_FINAL.jpg", 64 * 1024);
sshc->setBlockTransferDelay(1);
i = sshc->GetSessionStatus();
i = sshc->SFTPreput("c:\testdir\CentOS-6.5-x86_64-bin-DVD1.iso", "reput_CentOS-6.5-x86_64-bin-DVD1.iso", 64 * 1024);
i = sshc->SFTPreput("c:\testdir\Reget_CentOS-6.5-x86_64-bin-DVD1.iso", "reput2_CentOS-6.5-x86_64-bin-DVD1.iso", 64 * 1024);
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
delete sshc;
getchar();
return 0;
}
头文件是 ssh.h 我按照 this
中的描述添加到我的项目中
libssh 0.5 已经 7 岁了。因此它不支持许多最新服务器所需的现代算法。更不用说它可能存在许多安全问题。
使用最新版本的libssh。
我正在 Windows 中实现 SFTP C++ 来传输一些文件。我已经通过 using this 下载并附加了所有库(libssh 0.5.0)。
我从 this author : Desphilboy 中找到了一些代码。但它显示错误为:
Error: Kex error : did not find one of algos diffie-hellman-group1-sha1- in list curve25519-sha256@libssh.org.ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 for kex algos. Could not connect the ssh session.1 Error : Writing packet: error on socket(or connection closed): No error.
我想使用这些系统用户名和密码连接到特定 IP。对此有什么建议吗?
下面是我的主要class
#include "ssh.h"
int main()
{
pSFTPConnector sshc = new SFTPConnector(L".\", L"147.13.5.123", 22, L"John", L"password"); // change the hostname , port , username, password to your sftp server, your credentials
FILE *nullfile = fopen("null", "w");
sshc->setLogFile(nullfile);
sshc->setVerbosity(1); // you can change the verbosity as appropriate for you
int i = sshc->InitSession();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->ConnectSession();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->InitSFTP();
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
i = sshc->SFTPrename("renamed_myfile.txt", "myfile.txt"); //change these file names
i = sshc->Makedir("sftpdir");
i = sshc->testUploadFile("myfile2.txt", "1234567890testfile");
i = sshc->SFTPreget("c:\testdir\reget_downloaded_CAR_HIRE_FINAL.jpg", "CAR_HIRE_FINAL.jpg", 64 * 1024);
sshc->setBlockTransferDelay(1);
i = sshc->GetSessionStatus();
i = sshc->SFTPreput("c:\testdir\CentOS-6.5-x86_64-bin-DVD1.iso", "reput_CentOS-6.5-x86_64-bin-DVD1.iso", 64 * 1024);
i = sshc->SFTPreput("c:\testdir\Reget_CentOS-6.5-x86_64-bin-DVD1.iso", "reput2_CentOS-6.5-x86_64-bin-DVD1.iso", 64 * 1024);
if (i != E_OK) wprintf(L"%s", sshc->errstring.c_str());
delete sshc;
getchar();
return 0;
}
头文件是 ssh.h 我按照 this
中的描述添加到我的项目中libssh 0.5 已经 7 岁了。因此它不支持许多最新服务器所需的现代算法。更不用说它可能存在许多安全问题。
使用最新版本的libssh。