小编mac*_*sto的帖子

如何用c++建立简单的ssh连接

我正在尝试制作一个将连接到 ssh 服务器(我的笔记本电脑)的 C++ 程序。服务器没问题,因为我可以通过腻子连接。虽然到目前为止我写的程序不能。在我的代码中,我使用库 libssh.h 并进行开发,我使用了 Visual Studio 2015。我得到的错误是:crypt_set_algorithms2: no crypto algorithm function found for 3des-cbc 我到目前为止还没有找到任何东西,所以我希望你帮助。我使用的代码:

#include <libssh/libssh.h>
#include <stdlib.h>
#include <stdio.h> 
int main()
{
    ssh_session my_ssh_session;
    int rc;
    int port = 22;
    int verbosity = SSH_LOG_PROTOCOL;
    char *password;
    // Open session and set options
    my_ssh_session = ssh_new();
    if (my_ssh_session == NULL)
        exit(-1);
    ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "192.168.1.6");
    ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "john");
    ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
    ssh_options_set(my_ssh_session, SSH_OPTIONS_CIPHERS_C_S,"aes128-ctr");

    //ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
    // Connect to server
    rc = ssh_connect(my_ssh_session);
    if (rc != …
Run Code Online (Sandbox Code Playgroud)

c++ ssh libssh visual-studio-2015

9
推荐指数
1
解决办法
3万
查看次数

标签 统计

c++ ×1

libssh ×1

ssh ×1

visual-studio-2015 ×1