Libssh - Can't connect to Windows host

Viewed 21

I have some code that initiates a simple SSH client session using Libssh.

int main()
{
ssh_session my_ssh_session;
int rc;
int port = 22;
const char* password;
int verbosity = SSH_LOG_FUNCTIONS;

// 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.10.10.100");
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "user");
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);

// Connect to server
rc = ssh_connect(my_ssh_session);
if (rc != SSH_OK)
{
    fprintf(stderr, "Error connecting to localhost: %s\n",
        ssh_get_error(my_ssh_session));
    ssh_free(my_ssh_session);
    exit(-99);
}

The issue is the connection won't establish successfully.

I have changed the verbosity on the logging, and it looks like it might be something to do with a PKI signature, but I am trying to authenticate using a username and password and I am not sure how to resolve.

[2022/09/23 05:27:38.440674, 2] ssh_packet_newkeys:  Received SSH_MSG_NEWKEYS    
[2022/09/23 05:27:38.440674, 4] ssh_pki_signature_verify:  Going to verify a ssh-ed25519 type signature    
[2022/09/23 05:27:38.440674, 4] pki_verify_data_signature:  ED25519 error: Signature invalid    
[2022/09/23 05:27:38.440674, 3] ssh_packet_socket_callback:  Processing 276 bytes left in socket buffer    
[2022/09/23 05:27:38.440674, 3] ssh_packet_socket_callback:  Packet: processed 0 bytes    
[2022/09/23 05:27:38.471928, 3] ssh_packet_socket_callback:  Packet: processed 0 bytes    
[2022/09/23 05:27:38.471928, 3] ssh_connect:  current state : 9

I can connect to the SSH server using Putty with no issues.

Any help greatly appreciated

0 Answers
Related