Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Hi everyone I am trying to establish a simple ssh connection between a windows app (a program I wrote) and a ssh server. In my code I use libssh and I have an error like that:
crypt_set_algorithms2: no crypto algorithm function found for 3des-cbc
The code I am using is:
#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 != SSH_OK)
fprintf(stderr, "Error: %s\n", ssh_get_error(my_ssh_session)); //HERE IS WHERE I GET THE ERROR
ssh_free(my_ssh_session);
exit(-1);
// Verify the server's identity
// For the source code of verify_knowhost(), check previous example
/* if (verify_knownhost(my_ssh_session) < 0)
ssh_disconnect(my_ssh_session);
ssh_free(my_ssh_session);
exit(-1);
// Authenticate ourselves
password = "pass";
rc = ssh_userauth_password(my_ssh_session, NULL, password);
if (rc != SSH_AUTH_SUCCESS)
fprintf(stderr, "Error authenticating with password: %s\n",
ssh_get_error(my_ssh_session));
ssh_disconnect(my_ssh_session);
ssh_free(my_ssh_session);
exit(-1);
ssh_disconnect(my_ssh_session);
ssh_free(my_ssh_session);
Your programm specifies that the connection must use the aes128-ctr
cipher, and does not list any alternatives. The error message you are getting suggest that the server does not support this cipher. Trying commenting out the SSH_OPTIONS_CIPHERS_C_S line, or change the argument to a list which includes a cipher supported by the server (based on what you say, 3des-cbc might work). To specify a list of ciphers, use a strings with comma seperated cipher names, e.g. "aes128-ctr,aes256-ctr,3des-cbc"
But unless you know what you are doing, just stick to the defaults, and do not specify any explicit ciphers.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.