hierynomus / sshj

ssh, scp and sftp for java
Apache License 2.0
2.51k stars 601 forks source link
java scp sftp sftp-client ssh ssh-client

= sshj - SSHv2 library for Java Jeroen van Erp :sshj_groupid: com.hierynomus :sshj_version: 0.38.0 :source-highlighter: pygments

image:https://github.com/hierynomus/sshj/actions/workflows/gradle.yml/badge.svg[link="https://github.com/hierynomus/sshj/actions/workflows/gradle.yml"] image:https://app.codacy.com/project/badge/Grade/2c8a5a67c6a54ed89c9a699fd6b27305["Codacy Grade", link="https://app.codacy.com/gh/hierynomus/sshj"] image:https://codecov.io/gh/hierynomus/sshj/branch/master/graph/badge.svg["codecov", link="https://codecov.io/gh/hierynomus/sshj"] image:http://www.javadoc.io/badge/com.hierynomus/sshj.svg?color=blue["JavaDocs", link="http://www.javadoc.io/doc/com.hierynomus/sshj"] image:https://maven-badges.herokuapp.com/maven-central/com.hierynomus/sshj/badge.svg["Maven Central",link="https://maven-badges.herokuapp.com/maven-central/com.hierynomus/sshj"]

WARNING: SSHJ versions up to and including 0.37.0 are vulnerable to https://nvd.nist.gov/vuln/detail/CVE-2023-48795[CVE-2023-48795 - Terrapin]. Please upgrade to 0.38.0 or higher.

To get started, have a look at one of the examples. Hopefully you will find the API pleasant to work with :)

== Getting SSHJ

To get SSHJ, you have two options:

. Add a dependency to SSHJ to your project. . Build SSHJ yourself.

And, if you want, you can also run the SSHJ examples.

Binary releases of SSHJ are not provided here, but you can download it http://search.maven.org/#artifactdetails%7C{sshj_groupid}%7Csshj%7C{sshj_version}%7Cjar[straight from the Maven Central repository] if you want to.

== Depending on SSHJ If you're building your project using Maven, you can add the following dependency to the pom.xml:

[source,xml,subs="verbatim,attributes"]

{sshj_groupid} sshj {sshj_version}

If your project is built using another build tool that uses the Maven Central repository, translate this dependency into the format used by your build tool.

== Building SSHJ . Clone the SSHJ repository. . Ensure you have Java6 installed with the http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html[Unlimited strength Java Cryptography Extensions (JCE)]. . Run the command ./gradlew clean build.

== Running the examples In the examples directory, there is a separate Maven project that shows how the library can be used in some sample cases. If you want to run them, follow these guidelines:

. Install http://maven.apache.org/[Maven 2.2.1] or up. . Clone the SSHJ repository. . Go into the examples directory and run the command mvn eclipse:eclipse. . Import the examples project into Eclipse. . Change the login details in the example classes (address, username and password) and run them!

== Features of the library include:

== Supported algorithms Implementations / adapters for the following algorithms are included:

ciphers:: aes{128,192,256}-{cbc,ctr}, aes{128,256}-gcm@openssh.com, blowfish-{cbc,ctr}, chacha20-poly1305@openssh.com, 3des-{cbc,ctr}, twofish{128,192,256}-{cbc,ctr}, twofish-cbc, serpent{128,192,256}-{cbc,ctr}, idea-{cbc,ctr}, cast128-{cbc,ctr}, arcfour, arcfour{128,256} SSHJ also supports the following extended (non official) ciphers: camellia{128,192,256}-{cbc,ctr}, camellia{128,192,256}-{cbc,ctr}@openssh.org

key exchange:: diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group14-sha256, diffie-hellman-group15-sha512, diffie-hellman-group16-sha512, diffie-hellman-group17-sha512, diffie-hellman-group18-sha512 diffie-hellman-group-exchange-sha1, diffie-hellman-group-exchange-sha256, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, curve25519-sha256@libssh.org

SSHJ also supports the following extended (non official) key exchange algorithms: diffie-hellman-group14-sha256@ssh.com, diffie-hellman-group15-sha256, diffie-hellman-group15-sha256@ssh.com, diffie-hellman-group15-sha384@ssh.com, diffie-hellman-group16-sha256, diffie-hellman-group16-sha384@ssh.com, diffie-hellman-group16-sha512@ssh.com, diffie-hellman-group18-sha512@ssh.com

signatures:: ssh-rsa, ssh-dss, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-ed25519, ssh-rsa2-256, ssh-rsa2-512

mac:: hmac-md5, hmac-md5-96, hmac-sha1, hmac-sha1-96, hmac-sha2-256, hmac-sha2-512, hmac-ripemd160, hmac-ripemd160@openssh.com hmac-md5-etm@openssh.com, hmac-md5-96-etm@openssh.com, hmac-sha1-etm@openssh.com, hmac-sha1-96-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-ripemd160-etm@openssh.com

compression:: zlib and zlib@openssh.com (delayed zlib)

private key files:: pkcs5, pkcs8, openssh-key-v1, ssh-rsa-cert-v01@openssh.com, ssh-dsa-cert-v01@openssh.com

If you need something that is not included, it shouldn't be too hard to add (do contribute it!)

== Comparing to other implementations http://ssh-comparison.quendi.de/comparison.html[SSH Implementation Comparison]

== Dependencies

== Reporting bugs Issue tracker: https://github.com/hierynomus/sshj/issues

== Contributing Fork away!

== Release history SSHJ 0.38.0 (2024-01-02)::

SSHJ 0.32.0 (2021-10-12)::

SSHJ 0.31.0 (2021-02-08)::