libssh
libssh copied to clipboard
ssh_pki_import_pubkey_blob: Unknown key type found
I am using the libssh and Visual C++ 2015 to create a SSH client ( x64) . I can compiled the code without error. But when I run it on a Windows server 2019 and tried to connect to a SSH server. It prompt Unknown key type found error.
Context
- ssh.dll ( x64) is copied to the same folder as executable.
- Visual c++ 2015 runtime distribution is installed on the Windows server 2019
Expected Behavior
It should establish the connection to the SSH server
Actual Behavior
D:\Temp>testssh.exe start the program [2020/08/10 18:58:19.335610, 2] ssh_connect: libssh 0.9.3 (c) 2003-2019 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_winlock [2020/08/10 18:58:19.351540, 2] ssh_socket_connect: Nonblocking connection socket: 476 [2020/08/10 18:58:19.355521, 2] ssh_connect: Socket connecting, now waiting for the callbacks to work [2020/08/10 18:58:19.360498, 1] socket_callback_connected: Socket connection callback: 1 (0) [2020/08/10 18:58:19.365477, 2] ssh_client_connection_callback: SSH server banner: SSH-2.0-Mocana SSH [2020/08/10 18:58:19.369458, 2] ssh_analyze_banner: Analyzing banner: SSH-2.0-Mocana SSH [2020/08/10 18:58:19.395347, 1] ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory [2020/08/10 18:58:19.401319, 2] ssh_kex_select_methods: Negotiated diffie-hellman-group-exchange-sha256,rsa-sha2-256,aes256-ctr,aes256-ctr,hmac-sha2-256,hmac-sha2-256,none,none,, [2020/08/10 18:58:22.937087, 2] ssh_packet_client_dhgex_group: SSH_MSG_KEX_DH_GEX_GROUP received [2020/08/10 18:58:29.313973, 2] ssh_packet_client_dhgex_reply: SSH_MSG_KEX_DH_GEX_REPLY received [2020/08/10 18:58:29.317924, 1] ssh_pki_import_pubkey_blob: Unknown key type found! Error connecting to 10.148.118.220:
Steps to Reproduce
-
Setup the directories for include and lib in VC++ 2015 project properties
-
Compiled the source code in VC++ 2015
-
The begining of source code // 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, "10.148.118.220"); ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "admin"); // Connect to server rc = ssh_connect(my_ssh_session); if (rc != SSH_OK) { fprintf(stderr, "Error connecting to 10.148.118.220: %s\n", ssh_get_error(my_ssh_session)); ssh_free(my_ssh_session); exit(-1); }
-
It failed at rc = ssh_connect(my_ssh_session);
Your Environment
- Version Used:libssh 0.9.3
- Operating System and Version: Windwos server 2019
- Compiler and Version(s):Visual C++ 2015
Possible Fix
Set the verbosity to as high as it goes and run the program again. This should give more detailed error information.