libssh2 and libssh both provide an API to develop SSH based applications.
Here's an attempt to put some light on the differences between them.
libssh2 1.11.1
- License: 3-clause BSD License
- Developed in: C (41463 SLOC), sh (1252 SLOC), Perl (879 SLOC), Lisp (33 SLOC), AWK (23 SLOC)
- Number of functions: 186
- Key Exchange Methods: diffie-hellman-group-exchange-sha256, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1
- Hostkey Types: ssh-ed25519, ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp521, ecdsa-sha2-nistp384, ecdsa-sha2-nistp256, ssh-rsa, ssh-dss
- Ciphers: chacha20-poly1305@openssh.com, aes256-gcm@openssh.com, aes128-gcm@openssh.com, aes256-ctr, aes192-ctr, aes128-ctr, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, arcfour, arcfour128
- Compression Schemes: zlib, zlib@openssh.com, none
- MAC hashes: hmac-sha2-512, hmac-sha2-512-etm@openssh.com, hmac-sha2-256, hmac-sha2-256-etm@openssh.com, hmac-sha1, hmac-sha1-96, hmac-md5, hmac-md5-96, hmac-ripemd160 (hmac-ripemd160@openssh.com)
- Authentication: none, password, public-key, hostbased, keyboard-interactive
- Channels: shell, exec (incl. SCP wrapper), direct-tcpip, subsystem
- Global Requests: tcpip-forward
- Channel Requests: x11, pty, exit-signal, keepalive@openssh.com
- Subsystems: sftp(version 3), publickey(version 2)
- SFTP: statvfs@openssh.com, fstatvfs@openssh.com, posix-rename@openssh.com
- Thread-safe: just do not share handles simultaneously
- Non-blocking: it can be used both blocking and non-blocking
- Your sockets: the app hands over the socket, calls select() etc.
- OpenSSL, Libgcrypt or WinCNG (native since Windows Vista): builds with either
- License: GNU Lesser General Public License
- Developed in: C (72888 SLOC), C++ (563 SLOC), sh (189 SLOC), Python (9 SLOC)
- Number of functions: 421
- Key Exchange Methods: curve25519-sha256, ecdh-sha2-nistp256, diffie-hellman-group18-sha512, diffie-hellman-group16-sha512, diffie-hellman-group-exchange-sha256, diffie-hellman-group14-sha1, diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1
- Hostkey Types: ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, rsa-sha2-512,rsa-sha2-256, ssh-rsa, ssh-dss
- Ciphers: chacha20-poly1305, aes256-gcm@openssh.com, aes128-gcm@openssh.com, aes256-ctr, aes192-ctr, aes128-ctr, aes256-cbc, aes192-cbc, aes128-cbc, 3des-cbc
- Compression Schemes: zlib, zlib@openssh.com, none
- MAC hashes: hmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha1-etm@openssh.com, hmac-sha2-512, hmac-sha2-256, hmac-sha1, none
- Authentication: none, password, public-key, keyboard-interactive, gssapi-with-mic
- Channels: shell, exec (incl. SCP wrapper), direct-tcpip, subsystem, auth-agent-req@openssh.com
- Global Requests: tcpip-forward, forwarded-tcpip
- Channel Requests: x11, pty, exit-status, signal, exit-signal, keepalive@openssh.com, auth-agent-req@openssh.com
- Subsystems: sftp(version 3), OpenSSH Extensions
- SFTP: statvfs@openssh.com, fstatvfs@openssh.com
- Thread-safe: Just don't share sessions
- Non-blocking: it can not be used entirely non-blocking.
- Your sockets: the app hands over the socket, or uses libssh sockets
- OpenSSL, mbedTLS or gcrypt
- Client and server support
- SSHv2 protocol support
- Supports Linux, UNIX, BSD, Solaris, OS/2 and Windows
- Automated test cases with nightly tests
- Event model based on poll(2), or a poll(2)-emulation.
- FIPS 140-2 compatibility
Feature by feature
The same data, in a table:
item |
libssh2 |
libssh |
Licence |
BSD |
LGPL |
Server-side support |
no |
yes |
GSSAPI authentication |
no |
yes |
Elliptic Curve Key Exchange |
yes |
yes |
Elliptic Curve Hostkeys |
yes |
yes |
Certificate support |
no |
yes |
FIPS 140-2 compliant |
no |
yes |
Continuous Integration |
Just compile tests |
Fully featured testsuite including OpenSSH and dropbear client/server testing |
Stable API |
yes |
mostly |
C compatibility |
C89 |
C99 |
strict namespace |
yes |
yes |
man pages for all functions |
yes |
no |
Doxygen documentation for all functions |
no |
yes |
Tutorial |
no |
yes |
Build concept |
Autotools and CMake |
CMake |