ssh, scp and sftp for java

Overview

sshj - SSHv2 library for Java

download sshj Codacy code quality codecov JavaDocs Maven Central

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:

  1. Add a dependency to SSHJ to your project.

  2. 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 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:

<dependency>
  <groupId>com.hierynomus</groupId>
  <artifactId>sshj</artifactId>
  <version>0.31.0</version>
</dependency>

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

  1. Clone the SSHJ repository.

  2. Ensure you have Java6 installed with the Unlimited strength Java Cryptography Extensions (JCE).

  3. 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:

  1. Install Maven 2.2.1 or up.

  2. Clone the Overthere repository.

  3. Go into the examples directory and run the command mvn eclipse:eclipse.

  4. Import the examples project into Eclipse.

  5. Change the login details in the example classes (address, username and password) and run them!

Features of the library include:

  • reading known_hosts files for host key verification

  • publickey, password and keyboard-interactive authentication

  • command, subsystem and shell channels

  • local and remote port forwarding

  • scp + complete sftp version 0-3 implementation

Supported algorithms

Implementations / adapters for the following algorithms are included:

ciphers

aes{128,192,256}-{cbc,ctr}, aes{128,256}-[email protected], blowfish-{cbc,ctr}, 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, [email protected]

SSHJ also supports the following extended (non official) key exchange algorithms:
`[email protected]`, `diffie-hellman-group15-sha256`, `[email protected]`, `[email protected]`,
`diffie-hellman-group16-sha256`, `[email protected]`, `[email protected]`, `[email protected]`
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, [email protected] [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]

compression

zlib and [email protected] (delayed zlib)

private key files

pkcs5, pkcs8, openssh-key-v1, [email protected], [email protected]

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

Comparing to other implementations

Dependencies

Java 6+. slf4j is required. bouncycastle is highly recommended and required for using some of the crypto algorithms. jzlib is required for using zlib compression.

Reporting bugs

Contributing

Fork away!

Release history

SSHJ 0.31.0 (2021-02-08)
  • Bump dependencies (asn-one 0.5.0, BouncyCastle 1.68, slf4j-api 1.7.30)

  • Merged #660: Support ED25519 and ECDSA keys in PuTTY format

  • Merged #655: Bump BouncyCastle due to CVE

  • Merged #653: Make Parameters class useable as HashMap key

  • Merged #647: Reduce log level for identification parser

  • Merged #630: Add support for [email protected] and [email protected] ciphers

  • Merged #636: Improved Android compatibility

  • Merged #627: Prevent key leakage

SSHJ 0.30.0 (2020-08-17)
  • BREAKING CHANGE: Removed setSignatureFactories and getSignatureFactories from the Config and switched them for getKeyAlgorithms and setKeyAlgorithms

  • Fixed #588: Add support for ssh-rsa2-256 and ssh-rsa2-512 signatures

  • Merged #579: Fix NPE in OpenSSHKnownHosts

  • Merged #587: Add passwordfinder retry for OpenSSHKeyV1KeyFile

  • Merged #586: Make KeyType compatible with Android Store

  • Merged #593: Change UserAuth.getAllowedMethods() to Collection return type

  • Merged #595: Allow reading arbitrary length keys

  • Merged #591: Allow to query SFTP extensions

  • Merged #603: Add method to create Stateful SFTP client

  • Merged #605: Use Daemon threads to avoid blocking JVM shutdown

  • Merged #606: Always use the JCERandom RNG by default

  • Merged #609: Clear passphrase after use to prevent security issues

  • Merged #618: Fix localport of DirectConnection for use with OpenSSH > 8.0

  • Merged #619: Upgraded BouncyCastle to 1.66

  • Merged #622: Send 'ext-info-c' with KEX algorithms

  • Merged #623: Fix transport encoding of nistp521 signatures

  • Merged #607: Fix mathing pubkeys to key algorithms

  • Merged #602: Fix RSA certificate key determination

SSHJ 0.27.0 (2019-01-24)
  • Fixed #415: Fixed wrongly prefixed '/' to path in SFTPClient.mkdirs

  • Added support for ETM (Encrypt-then-Mac) MAC algorithms.

  • Fixed #454: Added missing capacity check for Buffer.putUint64

  • Fixed #466: Added lock timeout for remote action to prevent hanging

  • Fixed #470: Made EdDSA the default (first) signature factory

  • Fixed #467: Added AES256-CBC as cipher mode in openssh-key-v1 support

  • Fixed #464: Enabled [email protected] in DefaultConfig

  • Fixed #472: Handle server initiated global requests

  • Fixed #485: Added support for all keytypes to openssh-key-v1 keyfiles.

SSHJ 0.26.0 (2018-07-24)
  • Fixed #413: Use UTF-8 for PrivateKeyFileResource

  • Fixed #427: Support encrypted ed25519 openssh-key-v1 files

  • Upgraded BouncyCastle to 1.60

  • Added support for [email protected] MAC

SSHJ 0.24.0 (2018-04-04)
  • Added support for hmac-ripemd160

  • Fixed #382: Fixed escaping in WildcardHostmatcher

  • Added integration testsuite using Docker against OpenSSH

  • Fixed #187: Fixed length bug in Buffer.putString

  • Fixed #405: Continue host verification if first hostkey does not match.

SSHJ 0.23.0 (2017-10-13)
  • Merged #372: Upgrade to 'net.i2p.crypto:eddsa:0.2.0'

  • Fixed #355 and #354: Correctly decode signature bytes

  • Fixed #365: Added support for new-style OpenSSH fingerprints of server keys

  • Fixed #356: Fixed key type detection for ECDSA public keys

  • Made SSHJ Java9 compatible

SSHJ 0.22.0 (2017-08-24)
  • Fixed #341: Fixed path walking during recursive copy

  • Merged #338: Added ConsolePasswordFinder to read password from stdin

  • Merged #336: Added support for ecdsa-sha2-nistp384 and ecdsa-sha2-nistp521 signatures

  • Fixed #331: Added support for wildcards in known_hosts file

SSHJ 0.21.1 (2017-04-25)
  • Merged #322: Fix regression from 40f956b (invalid length parameter on outputstream)

SSHJ 0.21.0 (2017-04-14)
SSHJ 0.20.0 (2017-02-09)
  • Merged #294: Reference ED25519 by constant instead of name

  • Merged #293, #295 and #301: Fixed OSGi packaging

  • Added new Diffie Hellman groups 15-18 for stronger KeyExchange algorithms

SSHJ 0.19.1 (2016-12-30)
  • Enabled PKCS5 Key files in DefaultConfig

  • Merged #291: Fixed sshj.properties loading and chained exception messages

  • Merged #284: Correctly catch interrupt in keepalive thread

  • Fixed #292: Pass the configured RandomFactory to Diffie Hellman KEX

  • Fixed #256: SSHJ now builds if no git repository present

  • LocalPortForwarder now correctly interrupts its own thread on close()

SSHJ 0.19.0 (2016-11-25)
  • Fixed #276: Add support for ed-25519 and new OpenSSH key format

  • Fixed #280: Read version from a generated sshj.properties file to correctly output version during negotiation

SSHJ 0.18.0 (2016-09-30)
  • Fixed Android compatibility

  • Upgrade to Gradle 3.0

  • Merged #271: Load known_hosts without requiring BouncyCastle

  • Merged #269: Brought back Java6 support by popular demand

  • Merged #267: Added support for per connection logging (Fixes #264)

  • Merged #262, #265 and #266: Added PKCS5 key file support

  • Fixed toString of sftp FileAttributes (Fixes #258)

  • Fixed #255: No longer depending on 'privately marked' classes in net.i2p.crypto.eddsa.math package, fixes OSGI dependencies

SSHJ 0.17.2 (2016-07-07)
  • Treating SSH Server identification line ending in '\n' instead of '\r\n' leniently.

SSHJ 0.17.1 (2016-07-06)
  • Improved parsing of the SSH Server identification. Too long header lines now no longer break the protocol.

SSHJ 0.17.0 (2016-07-05)
  • Introduced breaking change in SFTP copy behaviour: Previously an SFTP copy operation would behave differently if both source and target were folders with different names. In this case instead of copying the contents of the source into the target directory, the directory itself was copied as a sub directory of the target directory. This behaviour has been removed in favour of the default behaviour which is to copy the contents of the source into the target. Bringing the behaviour in line with how SCP works.

  • Fixed #252 (via: #253): Same name subdirs are no longer merged by accident

SSHJ 0.16.0 (2016-04-11)
  • Fixed #239: Remote port forwards did not work if you used the empty string as address, or a catch-all address.

  • Fixed #242: Added OSGI headers to sources jar manifest

  • Fixed #236: Remote Port forwarding with dynamic port allocation fails with BufferUnderflowException

  • Upgraded gradle distribution to 2.12

  • Closed #234: Dropped Java6 support (0.15.0 was already Java6 incompatible due to Java7 dependency)

  • Fixed #118: Added configuration switch for waiting on a server ident before sending the client ident.

  • Fixed #114: Added javadoc that you always need to call close() on a Command before inspecting the exit codes.

  • Fixed #237: Fixed race condition if a [email protected] global request is received directly after a successful auth.

SSHJ 0.15.0 (2015-11-20)
  • Fixed #220: Added support for ssh-ed25519 host keys

  • Fixed #225: Fixed bug in ECDSA fingerprint calculation that sometimes produced an incorrect fingerprint

  • Added arcfour Stream Ciphers from RFC4253 and RFC4345

  • Added all Block Ciphers from RFC4344 and RFC4253

SSHJ 0.14.0 (2015-11-04)
  • Fixed #171: Added support for [email protected] key exchange algorithm

  • Added support for ecdh-sha2-nistp256, ecdh-sha2-nistp384 and ecdh-sha2-nistp521 key exchange algorithms

  • Fixed #167: Added support for diffie-hellman-group-exchange-sha1 and diffie-hellman-group-exchange-sha256 key exchange methods

  • Fixed #212: Configure path escaping to enable shell expansion to work correctly

  • Merged #210: RemoteFileInputStream.skip returns wrong value (Fixes #209)

  • Merged #208: Added SCP bandwidth limitation support

  • Merged #211: Made keyfile format detection more robust

SSHJ 0.13.0 (2015-08-18)
  • Merged #199: Fix for IndexOutOfBoundsException in ReadAheadRemoteFileInputStream, fixes #183

  • Merged #195: New authentication supported: gssapi-with-mic

  • Merged #201: New option to verify negotiated key exchange algorithms

  • Merged #196: Fix for looking up complete hostname in known hosts file

SSHJ 0.12.0 (2015-04-14)
  • Added support for HTTP proxies when running JDK6 or JDK7, fixes: #170

  • Merged #186: Fix for detecting end-of-stream

  • Compiling to JDK6, fixes #179 and #185

  • Correctly close socket and channel when LocalPortForwarder fails to open and start the channel (Fixes #175 and #176)

  • Merged #181: Invalid write packet length when reading with offset (Fixes #180)

SSHJ 0.11.0 (2015-01-23)
  • New maven coordinates com.hierynomus:sshj:0.11.0 as @hierynomus took over as maintainer of SSHJ

  • Migrated build system to Gradle 2.2.1

  • Merged #150: Fix for incorrect file handle on some SSH servers, fixes: #54, #119, #168, #169

  • Made jzlib optional in OSGi bundling, fixes: #162

  • Improved some log levels, fixes: #161

  • Merged #156, #164, #165: Fixed block sizes for hmac-sha2-256 and hmac-sha2-512

  • Merged #141: Add proxy support

  • Merged #157, #163: Doc and build fixes

  • Upgraded BouncyCastle to 1.51, fixes: #142

  • Implemented keep-alive with connection drop detection, fixes #166

Comments
  • OSGI dependencies are broken

    OSGI dependencies are broken

    The manifest header declares a dependency to package net.i2p.crypto.eddsa.math, but bundle net.i2p.crypto.eddsa does not export that package. (The pom of net.i2p.crypto.eddsa explicitly excludes the package from the exported package list.)

    This results in a tycho error when building: Missing requirement: com.hierynomus.sshj 0.17.2 requires 'package net.i2p.crypto.eddsa.math 0.0.0' but it could not be found

    opened by 15knots 28
  • ssh certificate authentication fails

    ssh certificate authentication fails

    sshj fails where openssh succeeds without a password using two files private-key and private-key-cert.pub. What am I coding wrongly with sshj?

    (if sshj does not support certificate authentication, am willing to contribute, if pointed in the right direction...)

    Test

    object Sshj {
      def ping() = {
        val ssh = new SSHClient
        ssh.loadKnownHosts()
        ssh.connect("555.16.13.210", 26)
        try {
          ssh.authPublickey("root","~/.ssh/private-key")
          val session = ssh.startSession()
          try {
            val cmd = session.exec("ping -c 1 google.com")
            println(IOUtils.readFully(cmd.getInputStream()).toString())
            cmd.join(5, TimeUnit.SECONDS)
            println("\n** exit status: " + cmd.getExitStatus())
          } finally {
            session.close()
          }
        } finally {
          ssh.disconnect()
        }
      }
    }
    

    Scala REPL

    scala> Sshj.ping
    [INFO ] [15:05:15.179] [run-main-4] [n.schmizz.sshj.common.SecurityUtils] BouncyCastle already registered as a JCE provider
    [WARN ] [15:05:15.195] [run-main-4] [net.schmizz.sshj.DefaultConfig] Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
    [INFO ] [15:05:15.232] [run-main-4] [n.s.sshj.transport.TransportImpl] Client identity string: SSH-2.0-SSHJ_0_9_0
    [INFO ] [15:05:15.236] [run-main-4] [n.s.sshj.transport.TransportImpl] Server identity string: SSH-2.0-OpenSSH_5.9
    [DEBUG] [15:05:15.237] [run-main-4] [net.schmizz.concurrent.Promise] Setting <<kex done>> to `null`
    [DEBUG] [15:05:15.237] [run-main-4] [n.s.sshj.transport.KeyExchanger] Sending SSH_MSG_KEXINIT
    [DEBUG] [15:05:15.248] [run-main-4] [net.schmizz.concurrent.Promise] Setting <<kexinit sent>> to `SOME`
    [DEBUG] [15:05:15.249] [run-main-4] [net.schmizz.concurrent.Promise] Awaiting <<kex done>>
    [DEBUG] [15:05:15.249] [reader] [n.s.sshj.transport.KeyExchanger] Received SSH_MSG_KEXINIT
    [DEBUG] [15:05:15.251] [reader] [n.s.sshj.transport.KeyExchanger] Negotiated algorithms: [ kex=diffie-hellman-group14-sha1; sig=ssh-rsa; c2sCipher=aes128-ctr; s2cCipher=aes128-ctr; c2sMAC=hmac-sha1; s2cMAC=hmac-sha1; c2sComp=none; s2cComp=none ]
    [DEBUG] [15:05:15.290] [reader] [net.schmizz.sshj.transport.kex.DHG14] Sending SSH_MSG_KEXDH_INIT
    [DEBUG] [15:05:15.301] [reader] [n.s.sshj.transport.KeyExchanger] Received kex followup data
    [DEBUG] [15:05:15.301] [reader] [net.schmizz.sshj.transport.kex.DHG14] Received SSH_MSG_KEXDH_REPLY
    [DEBUG] [15:05:15.326] [reader] [n.s.sshj.transport.KeyExchanger] Trying to verify host key with net.schmizz.sshj.transport.verification.OpenSSHKnownHosts@576882e3
    [DEBUG] [15:05:15.327] [reader] [n.s.sshj.transport.KeyExchanger] Sending SSH_MSG_NEWKEYS
    [DEBUG] [15:05:15.327] [reader] [n.s.sshj.transport.KeyExchanger] Received SSH_MSG_NEWKEYS
    [DEBUG] [15:05:15.328] [reader] [net.schmizz.concurrent.Promise] Setting <<kexinit sent>> to `null`
    [DEBUG] [15:05:15.328] [reader] [net.schmizz.concurrent.Promise] Setting <<kex done>> to `SOME`
    [DEBUG] [15:05:15.328] [run-main-4] [net.schmizz.sshj.SSHClient] Key exchange took 0.091 seconds
    [DEBUG] [15:05:15.328] [run-main-4] [net.schmizz.sshj.SSHClient] Attempting to load key from: ~/.ssh/private-key
    [DEBUG] [15:05:15.342] [run-main-4] [net.schmizz.concurrent.Promise] Setting <<service accept>> to `null`
    [DEBUG] [15:05:15.343] [run-main-4] [n.s.sshj.transport.TransportImpl] Sending SSH_MSG_SERVICE_REQUEST for ssh-userauth
    [DEBUG] [15:05:15.343] [run-main-4] [net.schmizz.concurrent.Promise] Awaiting <<service accept>>
    [DEBUG] [15:05:15.373] [reader] [net.schmizz.concurrent.Promise] Setting <<service accept>> to `SOME`
    [DEBUG] [15:05:15.374] [run-main-4] [n.s.sshj.transport.TransportImpl] Setting active service to ssh-userauth
    [DEBUG] [15:05:15.375] [run-main-4] [net.schmizz.concurrent.Promise] Setting <<authenticated>> to `null`
    [DEBUG] [15:05:15.375] [run-main-4] [n.schmizz.sshj.userauth.UserAuthImpl] Trying `publickey` auth...
    [DEBUG] [15:05:15.376] [run-main-4] [n.s.s.userauth.method.AuthPublickey] Attempting authentication using PKCS8KeyFile{resource=[PrivateKeyFileResource] ~/.ssh/private-key}
    [DEBUG] [15:05:15.437] [run-main-4] [net.schmizz.concurrent.Promise] Awaiting <<authenticated>>
    [DEBUG] [15:05:15.441] [reader] [net.schmizz.concurrent.Promise] Setting <<authenticated>> to `false`
    [DEBUG] [15:05:15.442] [run-main-4] [n.schmizz.sshj.userauth.UserAuthImpl] `publickey` auth failed
    [INFO ] [15:05:15.443] [run-main-4] [n.s.sshj.transport.TransportImpl] Disconnected - BY_APPLICATION
    [DEBUG] [15:05:15.443] [run-main-4] [n.schmizz.sshj.userauth.UserAuthImpl] Notified of net.schmizz.sshj.transport.TransportException: [BY_APPLICATION] Disconnected
    [DEBUG] [15:05:15.443] [run-main-4] [n.s.sshj.transport.TransportImpl] Sending SSH_MSG_DISCONNECT: reason=[BY_APPLICATION], msg=[]
    [DEBUG] [15:05:15.443] [run-main-4] [net.schmizz.concurrent.Promise] Setting <<transport close>> to `SOME`
    [DEBUG] [15:05:15.444] [reader] [net.schmizz.sshj.transport.Reader] Stopping
    net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
      at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217)
      at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
      at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:365)
      at Sshj$.ping(basics.scala:59)
      ... 43 elided
    

    OpenSSH

    > ssh -v -p 26 -i ~/.ssh/private-key [email protected]
    OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to 555.16.13.210 [555.16.13.210] port 26.
    debug1: Connection established.
    debug1: identity file ~/.ssh/private-key type -1
    debug1: ssh_rsa_verify: signature correct
    debug1: identity file ~/.ssh/private-key-cert type 5
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
    debug1: match: OpenSSH_5.9 pat OpenSSH_5* compat 0x0c000000
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-ctr hmac-sha1 none
    debug1: kex: client->server aes128-ctr hmac-sha1 none
    debug1: sending SSH2_MSG_KEX_ECDH_INIT
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: RSA 1c:e0:42:f3:af:6b:15:59:1c:19:8d:44:c8:f2:99:fb
    debug1: Host '[555.16.13.210]:26' is known and matches the RSA host key.
    debug1: Found key in ~/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: Roaming not allowed by server
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Offering RSA-CERT public key: ~/.ssh/private-key
    debug1: Server accepts key: pkalg [email protected] blen 1150
    debug1: ssh_rsa_verify: signature correct
    debug1: key_parse_private2: missing begin marker
    debug1: read PEM private key done: type RSA
    debug1: Authentication succeeded (publickey).
    Authenticated to 555.16.13.210 ([555.16.13.210]:26).
    debug1: channel 0: new [client-session]
    debug1: Requesting [email protected]
    debug1: Entering interactive session.
    debug1: Sending environment.
    debug1: Sending env LANG = en_US.UTF-8
    Last login: Thu Oct 16 14:47:53 2014 from 192.168.225.2
    Unauthorized access to this system is not permitted.
    User activity may be logged for auditing or other purposes.
    UPS_FAKE=2
    [14:48:15] #
    
    feature server-specific 
    opened by WellRedPandit 26
  • osgi problem

    osgi problem

    Apache jclouds project happily relies on your project, thanks! Unfortunately a downstream project, jclouds-karaf wants to use your lib in an OSGi container but when we install the following bundle:

    install -s mvn:com.hierynomus/sshj/0.12.0
    

    we've noticed that

    karaf@root()> capabilities 113
    com.hierynomus.sshj [113] provides:
    -----------------------------------
    osgi.wiring.bundle; com.hierynomus.sshj 0.12.0 [UNUSED]
    osgi.wiring.host; com.hierynomus.sshj 0.12.0 [UNUSED]
    osgi.identity; com.hierynomus.sshj 0.12.0 [UNUSED]
    osgi.wiring.package; net.schmizz.concurrent 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.keepalive 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.common 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.connection 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.connection.channel 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.connection.channel.direct 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.connection.channel.forwarded 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.sftp 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.signature 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.cipher 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.compression 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.digest 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.kex 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.mac 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.random 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.transport.verification 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.userauth 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.userauth.keyprovider 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.userauth.method 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.userauth.password 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.xfer 0.0.0 [UNUSED]
    osgi.wiring.package; net.schmizz.sshj.xfer.scp 0.0.0 [UNUSED]
    

    which basically means that the wiring packages are unversioned.

    This may be a gradle issue build.gradle as per this SO @discussion.

    Thanks for your support.

    opened by andreaturli 19
  • AuthGssApiWithMic: Use default client creds instead of remote username

    AuthGssApiWithMic: Use default client creds instead of remote username

    Previously, AuthGssApiWithMic used params.getUsername() to create the local client credential object. However, at least when using the native GSS libraries (sun.security.jgss.native=true), the username would need to be something like "[email protected]", not "user", or the library is unable to find credentials. Also, your remote username might not be your local username.

    Instead, and more simply, call the GSSManager#createCredential variant that just uses default credentials, which should handle both of these cases.

    Tested on Windows using SSPI. I haven't tested this patch on Linux but I have confirmed that this form of call to createCredential works as I expect when using the native GSS/Kerberos library there too.

    opened by geofft 18
  • [PROTOCOL_ERROR] Received data for nonexistent channel 1.

    [PROTOCOL_ERROR] Received data for nonexistent channel 1.

    Thank you for your amazing lib. sshj version: 0.26.0 (not use source code) Client: Android

    I am facing a strange problem: In the process of using sshj, the SSH tunnel is successfully established, but in the process of passing data, an error occurs:

    net.schmizz.sshj.transport.TransportException: [PROTOCOL_ERROR] Received data for nonexistent channel 1.
    	at net.schmizz.sshj.transport.TransportImpl.gotDisconnect(TransportImpl.java:548)
    	at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:508)
    	at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:102)
    	at net.schmizz.sshj.transport.Decoder.received(Decoder.java:170)
    	at net.schmizz.sshj.transport.Reader.run(Reader.java:59)
    

    This will cause the SSH connection to be broken.

    So, my question is:

    • "[PROTOCOL_ERROR] Received data for nonexistent channel 1" What is the underlying cause of this error?

    I noticed that someone reported a similar problem in 2016: issue(https://github.com/hierynomus/sshj/issues/274)

    opened by tancolo 18
  • BouncyCastle is required to read a key of type ecdsa-sha2-nistp256

    BouncyCastle is required to read a key of type ecdsa-sha2-nistp256

    Hello all,

    i need some help with this error-message: BouncyCastle is required to read a key of type ecdsa-sha2-nistp256

    The error occures when i call connect() on my SSHClient. And the error occures only, when i'm executing the following code from inside a jar-File.

    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();
    ssh.connect("my-hostname");
    

    I hope someone knows what I have to do here. Thanks for your help!

    opened by MetalCar 18
  • ECDSA key's fingerprint is sometimes incorrect

    ECDSA key's fingerprint is sometimes incorrect

    Hi,

    we are using sshj to connect through ssh from java code to newly created VMs in the cloud and we've noticed that sometimes the fingerprint of the ECDSA public key returned by sshj is different from the one we are expecting (generated with ssh-keygen on VM startup), so our code won't accept it and won't make the ssh connection.

    After some debugging it seems that the key is read incorrectly in some cases, check the following example (I've added the keypair to this gist: https://gist.github.com/martonsereg/63b5108f7c484155becb):

    It reads the same keypair with sshj and jsch and prints out the fingerprints and the differences in the public key byte arrays.

    // load sshj keyfile
    OpenSSHKeyFile keyFile = new OpenSSHKeyFile();
    keyFile.init(new File("/tmp/test_ecdsa"));
    
    // load jsch keypair
    KeyPair jschKeyPair = KeyPair.load(new JSch(), "/tmp/test_ecdsa", "/tmp/test_ecdsa.pub");
    
    // print fingerprints
    System.out.println(SecurityUtils.getFingerprint(keyFile.getPublic()));
    System.out.println(jschKeyPair.getFingerPrint());
    // compare it with `ssh-keygen -lf /tmp/test_ecdsa.pub` - it equals the jsch fingerprint
    
    // compare public key bytes
    byte[] sshjbytes = new Buffer.PlainBuffer().putPublicKey(keyFile.getPublic()).getCompactData();
    byte[] jschbytes = jschKeyPair.getPublicKeyBlob();
    
    StringBuilder result = new StringBuilder();
    
    for (int i = 0; i < jschbytes.length; i++) {
        if (i < sshjbytes.length && jschbytes[i] != sshjbytes[i]){
            result.append(i).append(" ")
            .append(jschbytes[i]).append(" ").append(sshjbytes[i])
                    .append("\n");
        }
    }
    
    System.out.println(result.toString());
    

    Note that this code produces the same results with jsch and sshj (and ssh-keygen) in most cases but for the attached keypair for example the result is different.

    Marton

    opened by martonsereg 18
  • Make KeyType compatible with Android Keystore

    Make KeyType compatible with Android Keystore

    Android Keystore private keys do not implement PrivateKey since the raw key material is not available to applications.

    With this commit, sshj's KeyType correctly detects the algorithm associated with Android Keystore keys, which makes them usable for SSH authentication.

    opened by fmeum 17
  • Added SFTP file transfer resume support on both PUT and GET.

    Added SFTP file transfer resume support on both PUT and GET.

    Internally SFTPFileTransfer has a few sanity checks to fall back to full replacement even if the resume flag is set.

    SCP file transfers have not been changed to support this at this time.

    opened by brenttyler 15
  • Gracefully load OpenSSH known_hosts without requiring BouncyCastle

    Gracefully load OpenSSH known_hosts without requiring BouncyCastle

    If BouncyCastle is not present, I want to be able to load whatever bits of the known_hosts file I can (i.e., the ssh-dss and ssh-rsa keys).

    While making this change I noticed the KeyType.readPubKeyFromBuffer method didn't require passing in the String type name, so I cleaned that up too.

    opened by solind 15
  • SSHJ doesn't work with Dropbear 2020.80

    SSHJ doesn't work with Dropbear 2020.80

    To reproduce:

    1. Install Dropbear 2020.80. Easiest way is to do brew install dropbear.
    2. Run on local: dropbear -F -E -R -p 2222
    3. Run the following code:

    import net.schmizz.sshj.Config; import net.schmizz.sshj.DefaultConfig; import net.schmizz.sshj.SSHClient; import net.schmizz.sshj.common.Factory; import net.schmizz.sshj.common.IOUtils; import net.schmizz.sshj.common.SecurityUtils; import net.schmizz.sshj.connection.channel.direct.Session; import net.schmizz.sshj.connection.channel.direct.Session.Command; import net.schmizz.sshj.transport.kex.ECDHNistP; import net.schmizz.sshj.transport.kex.KeyExchange; import net.schmizz.sshj.userauth.keyprovider.KeyProvider;

    import java.io.Console; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit;

    public class Shell2 { private static final Console con = System.console();

    public static void main(String[] args) throws IOException {
        final SSHClient ssh = new SSHClient();
        ssh.loadKnownHosts();
        ssh.connect("localhost", 2222);
        Session session = null;
        try {
    
            File privateKey = new File("<home>/.ssh/id_rsa");
            KeyProvider keys = ssh.loadKeys(privateKey.getPath());
            ssh.authPublickey(System.getProperty("user.name"), keys);
            session = ssh.startSession();
            final Command cmd = session.exec("/bin/ls -l");
            con.writer().print(IOUtils.readFully(cmd.getInputStream()).toString());
            cmd.join(5, TimeUnit.SECONDS);
            con.writer().print("\n** exit status: " + cmd.getExitStatus());
        } finally {
            try {
                if (session != null) {
                    session.close();
                }
            } catch (IOException e) {
                // Do Nothing
            }
    
            ssh.disconnect();
        }
    }
    

    }

    I have set the kex algorithm to be one specific one since the default also doesn't work. Logs in dropbear:

    TRACE (58746) 2108.686637: <- KEXINIT TRACE (58746) 2108.686642: enter recv_msg_kexinit TRACE (58746) 2108.686663: buf_match_algo: [email protected],diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha1,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,[email protected],diffie-hellman-group15-sha256,[email protected],[email protected],diffie-hellman-group16-sha256,[email protected],[email protected],[email protected] [58746] Oct 20 11:19:18 Exit before auth from <127.0.0.1:51678>: No matching algo kex TRACE (58746) 2108.687350: enter session_cleanup TRACE (58746) 2108.687357: enter chancleanup TRACE (58746) 2108.687361: leave chancleanup

    Some points:

    1. I tried jsch program with this and it is able to work with dropbear seamlessly.
    2. I tried regular ssh client installed with Mac and it also works.
    3. TRACE (58746) 2108.686663 refers to all the kex algorithms that come from sshj, and it doesn't seem like anything matches. Interestingly enough, if I use kex algos: ecdh-sha2-nistp521, ecdh-sha2-nistp384, ecdh-sha2-nistp256 using jsch, it is able to connect.
    opened by zlgonzalez 14
  • "No such file" error while closing RemoteFile

    Hi, I am getting "no such file" exception while calling close on RemoteFile object (file.close() below).

    public void get(String path, CheckedConsumer<InputStream> consumer) throws SSHException {
            try  {
               SFTPClient client = sshClient.newSFTPClient();
                final RemoteFile file = client.getSFTPEngine().open(path, EnumSet.of(OpenMode.READ));
               InputStream inputStream = getInputStream(file);
            } finally {
                if (inputStream != null) {
                        inputStream.close();
                 }
               .....
            }
        }
     private RemoteFile.RemoteFileInputStream getInputStream(RemoteFile file) {
            return file.new RemoteFileInputStream() {
                @Override
                public void close() throws IOException {
                    try (file) {
                        super.close();
                    } finally {
                        file.close();
                    }
                }
            };
        }
    

    Here is info from stacktrace: net.schmizz.sshj.sftp.SFTPException: No such file at net.schmizz.sshj.sftp.Response.error(Response.java:140) at net.schmizz.sshj.sftp.Response.ensureStatusIs(Response.java:133) at net.schmizz.sshj.sftp.Response.ensureStatusPacketIsOK(Response.java:125) at net.schmizz.sshj.sftp.RemoteResource.close(RemoteResource.java:55)

    opened by elwira-zimoch 3
  • "no such algorithm: ECDSA for provider BC" when connect(host, port) from Android app

    I was able to use the sshj lib to connect, authenticate, and execute remote commands from a standalone Kotlin client (command line).

    But then when I tried to use the lib from a simple Android app it failed to even connect to the same server I used before from command line app.

    I get net.schmizz.sshj.transport.TransportException: no such algorithm: ECDSA for provider BC (please see below the full error stack #1 from logcat):

    The code is very simple:

    class MainActivity : AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
            CoroutineScope(Dispatchers.IO).launch{
                val ssh = SSHClient()
                ssh.addHostKeyVerifier(PromiscuousVerifier()) // it makes no difference
                ssh.connect("www.blabla.com", 22223) <== it throws exception even before authenticating
                //ssh.authPublickey(username, kp)
            }
        }
    }
    

    I've tried to add the following dependencies, but nothing really helped:

    dependencies {
    //...
        implementation 'org.bouncycastle:bcpkix-jdk15on:1.70'
        implementation 'com.hierynomus:sshj:0.34.0'
    

    Any idea what I'm doing wrong?

    Also I'm new to Android + Java + Kotlin dev, I see in "Project Structure..." I do have 6 x ways to add sshj:

    image

    What do they mean? Are they all valid options? Why in my error stack #1 I see net.schmizz.sshj*, even I'm actually using com.hierynomus:ssh*?!

    [...]

    BTW I've tried to replace com.hierynomus:ssh => net.schmizz.sshj, only to get another fatal exception:

    net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [diffie-hellman-group14-sha1, diffie-hellman-group1-sha1] and [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, [email protected], diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]

    (also see full error stack below)

    Thanks for help, Petru

    STACK #1

    2022-11-28 17:38:09.261 10147-10179 AndroidRuntime          com.example.sshjdemo                 E  FATAL EXCEPTION: DefaultDispatcher-worker-2
                                                                                                        Process: com.example.sshjdemo, PID: 10147
                                                                                                        net.schmizz.sshj.transport.TransportException: no such algorithm: ECDSA for provider BC
                                                                                                        	at net.schmizz.sshj.transport.TransportException$1.chain(TransportException.java:33)
                                                                                                        	at net.schmizz.sshj.transport.TransportException$1.chain(TransportException.java:27)
                                                                                                        	at net.schmizz.concurrent.Promise.deliverError(Promise.java:95)
                                                                                                        	at net.schmizz.concurrent.Event.deliverError(Event.java:74)
                                                                                                        	at net.schmizz.concurrent.ErrorDeliveryUtil.alertEvents(ErrorDeliveryUtil.java:34)
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.notifyError(KeyExchanger.java:416)
                                                                                                        	at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:587)
                                                                                                        	at net.schmizz.sshj.transport.Reader.run(Reader.java:66)
                                                                                                        	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@10156fe, Dispatchers.IO]
                                                                                                        Caused by: net.schmizz.sshj.common.SSHException: no such algorithm: ECDSA for provider BC
                                                                                                        	at net.schmizz.sshj.common.SSHException$1.chain(SSHException.java:37)
                                                                                                        	at net.schmizz.sshj.common.SSHException$1.chain(SSHException.java:30)
                                                                                                        	at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:582)
                                                                                                        	... 1 more
                                                                                                        Caused by: net.schmizz.sshj.common.SSHRuntimeException: no such algorithm: ECDSA for provider BC
                                                                                                        	at net.schmizz.sshj.transport.kex.DHBase.<init>(DHBase.java:41)
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519DH.<init>(Curve25519DH.java:35)
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256.<init>(Curve25519SHA256.java:54)
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256$Factory.create(Curve25519SHA256.java:44)
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256$Factory.create(Curve25519SHA256.java:39)
                                                                                                        	at net.schmizz.sshj.common.Factory$Named$Util.create(Factory.java:54)
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:242)
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:380)
                                                                                                        	at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:485)
                                                                                                        	at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113)
                                                                                                        	at net.schmizz.sshj.transport.Decoder.received(Decoder.java:200)
                                                                                                        	at net.schmizz.sshj.transport.Reader.run(Reader.java:60)
                                                                                                        Caused by: java.security.NoSuchAlgorithmException: no such algorithm: ECDSA for provider BC
                                                                                                        	at sun.security.jca.GetInstance.getService(GetInstance.java:87)
                                                                                                        	at sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
                                                                                                        	at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:319)
                                                                                                        	at net.schmizz.sshj.common.SecurityUtils.getKeyPairGenerator(SecurityUtils.java:188)
                                                                                                        	at net.schmizz.sshj.transport.kex.DHBase.<init>(DHBase.java:38)
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519DH.<init>(Curve25519DH.java:35) 
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256.<init>(Curve25519SHA256.java:54) 
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256$Factory.create(Curve25519SHA256.java:44) 
                                                                                                        	at net.schmizz.sshj.transport.kex.Curve25519SHA256$Factory.create(Curve25519SHA256.java:39) 
                                                                                                        	at net.schmizz.sshj.common.Factory$Named$Util.create(Factory.java:54) 
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:242) 
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:380) 
                                                                                                        	at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:485) 
                                                                                                        	at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113) 
                                                                                                        	at net.schmizz.sshj.transport.Decoder.received(Decoder.java:200) 
                                                                                                        	at net.schmizz.sshj.transport.Reader.run(Reader.java:60) 
    2022-11-28 17:38:09.411 10147-10179 Process                 com.example.sshjdemo                 I  Sending signal. PID: 10147 SIG: 9
    ---------------------------- PROCESS ENDED (10147) for package com.example.sshjdemo ----------------------------
    
    

    STACK #2

    2022-11-28 17:57:54.376 10506-10561 AndroidRuntime          com.example.sshjdemo                 E  FATAL EXCEPTION: DefaultDispatcher-worker-1
                                                                                                        Process: com.example.sshjdemo, PID: 10506
                                                                                                        net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [diffie-hellman-group14-sha1, diffie-hellman-group1-sha1] and [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, [email protected], diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
                                                                                                        	at net.schmizz.sshj.transport.Proposal.firstMatch(Proposal.java:145)
                                                                                                        	at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:128)
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:219)
                                                                                                        	at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:344)
                                                                                                        	at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:458)
                                                                                                        	at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:107)
                                                                                                        	at net.schmizz.sshj.transport.Decoder.received(Decoder.java:175)
                                                                                                        	at net.schmizz.sshj.transport.Reader.run(Reader.java:61)
                                                                                                        	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@b10e967, Dispatchers.IO]
    2022-11-28 17:57:54.498 10506-10561 Process                 com.example.sshjdemo                 I  Sending signal. PID: 10506 SIG: 9
    ---------------------------- PROCESS ENDED (10506) for package com.example.sshjdemo ----------------------------
    
    
    opened by petrum 1
  • Http Proxy using CustomSocketFactory in SSHJ fails

    Http Proxy using CustomSocketFactory in SSHJ fails

    My Java 7 application needs to connect to a remote SFTP server via HTTPS proxy. As per the depprecated method for connect via proxy in SocketClient, I created a custom javax.net.SocketFactory which creates a Socket(using java.net.Socket#Socket(java.net.Proxy) ) to the remote SFTP server and injected the SocketFactory into the SocketClient.

    Code snippet :

                 SSHClient client = new SSHClient();
    	client.addHostKeyVerifier(new PromiscuousVerifier());
    	
    	Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
    	Authenticator.setDefault(new Authenticator() {
    		@Override
    		public PasswordAuthentication getPasswordAuthentication() {
    			return new PasswordAuthentication(proxyUser, proxyPassword.toCharArray());
    		}
    	});
    	final SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
    	Socket socket = new Socket(proxy);
    	SocketAddress socketAddress=new InetSocketAddress(InetAddress.getLoopbackAddress(),0);
    	// binding the socket with the inetAddress and port number
    	socket.bind(socketAddress);
    	
    	// connect() method connects the specified socket to the server
    	socket.connect(new InetSocketAddress(sftpHost, sftpPort));
    		
    	factory.createSocket(socket, socket.getInetAddress().getHostName(), socket.getPort(), true);
    
    	client.setSocketFactory(factory);
    	
    	KeyProvider keyProvider = client.loadKeys(sftpPrivateKeyPath, sftpPrivateKeyPassprhase);
    	client.authPublickey(sftpUser, keyProvider);
    

    I could connect to the remote SFTP server via the proxy but the public key authentication fails with the error that the socket is not connected. Its because the 'socket' instance in SSHClient is not initialised via client.connect(..)

    Caused by: java.rmi.RemoteException: ; nested exception is: java.lang.IllegalStateException: Not connected at net.schmizz.sshj.SSHClient.checkConnected(SSHClient.java:823) at net.schmizz.sshj.SSHClient.auth(SSHClient.java:216) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:342) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:360)

    I tried to call client.connect(sftpHost, sftpPort) but this is trying to create a new socket using the SocketFactory ignoring the proxy configuration. Could there be some way to inject the 'socket' itself so that the lib uses custom socket with proxy settings?

    Many Thanks in advance for a quick feedback!

    opened by PriyankaSureshMS 1
  • Is there a vulnerability disclosure channel?

    Is there a vulnerability disclosure channel?

    I would like to ask, if the developer finds a vulnerability in sshj, will there be a specific security staff to confirm the feedback here? After the confirmation, if it is a vulnerability, will it be disclosed?

    opened by BadTrasher 0
  • How to upload file with append mode?

    How to upload file with append mode?

    I have many little files, i want to combine theirs into a new file on SFTP server

    I have try to use RemoteFile, open file and set file open mode as 'WRITE' and 'APPEND' ,example:

    EnumSet<OpenMode> modeEnumSet = EnumSet.of(OpenMode.WRITE, OpenMode.APPEND);
    RemoteFile rf = sftpClient.open(fileName, modeEnumSet);
    try (RemoteFile.RemoteFileOutputStream os = rf.new RemoteFileOutputStream(0, 10)) {
        IOUtils.write(inputStream, os);
    }
    

    but i found is also run as 'CREAT' mode, it's cover the file on SFTP server when write call write method

    but,how to run with append mode?

    Thanks!

    opened by Flyfish2015 0
Owner
Jeroen van Erp
Jeroen van Erp
Konas Client de-obfuscated and manually remaped by Gopro336, Perry, and other based people

Konas-Deobf-Remap This project doesent really have a purpose anymore now that the real source code has leaked (this is a higher version tho) Deobfusca

null 52 Dec 13, 2022
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
A Java event based WebSocket and HTTP server

Webbit - A Java event based WebSocket and HTTP server Getting it Prebuilt JARs are available from the central Maven repository or the Sonatype Maven r

null 808 Jan 3, 2023
Base classes and utilities for Java Carbyne Stack service clients

Carbyne Stack Java HTTP Client This project provides common functionality for the Java-based HTTP clients for the Carbyne Stack microservices. License

Carbyne Stack 5 Oct 15, 2022
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

Square 43.4k Jan 5, 2023
http-kit is a minimalist, event-driven, high-performance Clojure HTTP server/client library with WebSocket and asynchronous support

HTTP Kit A simple, high-performance event-driven HTTP client+server for Clojure CHANGELOG | API | current Break Version: [http-kit "2.5.3"] ; Publish

HTTP Client/Server for Clojure 2.3k Dec 31, 2022
This tool can read the QR code from the Remote Admin menu and copy the ID of the User to the Clipboard.

SCP-SL-QR-Reader Tool for easy copying This tool can read the QR code from the Remote Admin menu and copy the ID of the User to the Clipboard. Detecta

null 6 Aug 14, 2021
Thanks to @HausemasterIssue for the partial deobf of this, and again recaf for remapping this sh*t

------------------------------------------- Source installation information for modders ------------------------------------------- This code follows

null 9 Dec 2, 2022
Feign makes writing java http clients easier

Feign makes writing java http clients easier Feign is a Java to HTTP client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign's first goal

null 8.5k Dec 30, 2022
Google HTTP Client Library for Java

Google HTTP Client Library for Java Description Written by Google, the Google HTTP Client Library for Java is a flexible, efficient, and powerful Java

Google APIs 1.3k Jan 4, 2023
⚗️ Lightweight HTTP extensions for Java 11

Methanol A lightweight library that complements java.net.http for a better HTTP experience. Overview Methanol provides useful lightweight HTTP extensi

Moataz Abdelnasser 175 Dec 17, 2022
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: <!-- Pull in as a traditional dependency --> <dependency> <groupId>com.konghq</groupId> <artifactId>unire

Kong 2.4k Jan 5, 2023
Java HTTP Request Library

Http Request A simple convenience library for using a HttpURLConnection to make requests and access the response. This library is available under the

Kevin Sawicki 3.3k Dec 30, 2022
Tiny, easily embeddable HTTP server in Java.

NanoHTTPD – a tiny web server in Java NanoHTTPD is a light-weight HTTP server designed for embedding in other applications, released under a Modified

NanoHttpd 6.5k Jan 5, 2023
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: <!-- Pull in as a traditional dependency --> <dependency> <groupId>com.konghq</groupId> <artifactId>unire

Kong 2.4k Jan 5, 2023
Feign makes writing java http clients easier

Feign makes writing java http clients easier Feign is a Java to HTTP client binder inspired by Retrofit, JAXRS-2.0, and WebSocket. Feign's first goal

null 8.5k Jan 1, 2023
AltiriaSmsJavaClient, the official Java client of Altiria

¡Atención! Este proyecto aún se encuentra en desarrollo. Pronto se publicará la versión final para su uso. Altiria, cliente SMS Java Altiria SMS Java

Altiria 4 Dec 5, 2022
GithubReleases4J - GitHub Releases for Java , based on GitHub RESTful API .

GithubReleases4J - GitHub Releases for Java , based on GitHub RESTful API .

Carm 5 Jun 27, 2022