is / jsch

Mirror of JSch from JCraft.
Other
381 stars 190 forks source link
                                  JSch

                            Java Secure Channel
                     by ymnk@jcraft.com, JCraft,Inc.

                        http://www.jcraft.com/jsch/

Last modified: Thu Mar 18 13:58:16 UTC 2015

Description

JSch is a pure Java implementation of SSH2. JSch allows you to connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs. JSch is licensed under BSD style license.

Documentation

Directories & Files in the Source Tree

Why JSch?

Our intension in developing this stuff is to enable users of our pure java X servers, WiredX(http://wiredx.net/) and WeirdX, to enjoy secure X sessions. Our efforts have mostly targeted the SSH2 protocol in relation to X Window System and X11 forwarding. Of course, we are also interested in adding other functionality - port forward, file transfer, terminal emulation, etc.

Features

How To Try

This archive does not include java byte code, so please compile the source code by your self. $ cd jsch-?.?.?/src $ javac com/jcraft/jsch/java com/jcraft/jsch/jce/java com/jcraft/jzlib/*.java '/examples/' directory has included some samples to demonstrate what JSch can do. Please refer to '/examples/README' file.

AES cipher

JSch supports aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr, aes256-ctr but you require AES support in your J2SE to choose some of them.
If you are using Sun's J2SE, J2SE 1.4.2 or later is required.
And then, J2SE 1.4.2(or later) does not support aes256 by the default, because of 'import control restrictions of some countries'. We have confirmed that by applying "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 1.4.2" on http://java.sun.com/j2se/1.4.2/download.html#docs we can enjoy 'aes256-cbc,aes256-ctr'.

Stream Forwarding

JSch has a unique functionality, Stream Forwarding. Stream Forwarding allows you to plug Java I/O streams directly into a remote TCP port without assigning and opening a local TCP port. In port forwarding, as with the -L option of ssh command, you have to assign and open a local TCP port and that port is also accessible by crackers on localhost. In some case, that local TCP port may be plugged to a secret port via SSH session. A sample program, /example/StreamForwarding.java , demonstrates this functionality.

Generating Authentication Keys

JSch allows you to generate DSA and RSA key pairs, which are in OpenSSH format. Please refer to 'examples/KeyGen.java'.

Packet Compression

According to the draft from IETF sesch working group, the packet compression can be applied to each data stream directions; from sshd server to ssh client and from ssh client to sshd server. So, jsch allows you to choose which data stream direction will be compressed or not. For example, in X11 forwarding session, the packet compression for data stream from sshd to ssh client will save the network traffic, but usually the traffic from ssh client to sshd is light, so by omitting the compression for this direction, you may be able to save some CPU time. Please refer to a sample program 'examples/Compression.java'.

Property

By setting properties, you can control the behavior of jsch. Here is an example of enabling the packet compression,

  Session session=jsch.getSession(user, host, 22);
  java.util.Properties config=new java.util.Properties();
  config.put("compression.s2c", "zlib,none");
  config.put("compression.c2s", "zlib,none");
  session.setConfig(config);
  session.connect();

Current release has supported following properties,

TODO

Copyrights & Disclaimers

JSch is copyrighted by ymnk, JCraft,Inc. and is licensed through BSD style license. Read the LICENSE.txt file for the complete license.

Credits and Acknowledgments

JSch has been developed by ymnk@jcraft.com and it can not be hacked without several help.

If you have any comments, suggestions and questions, write us at jsch@jcraft.com

``SSH is a registered trademark and Secure Shell is a trademark of SSH Communications Security Corp (www.ssh.com)''.