Skip to content

Commit

Permalink
sync to 0.1.54
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiu.lj authored and is committed Jul 8, 2018
1 parent b2ac6d9 commit 234fab0
Show file tree
Hide file tree
Showing 173 changed files with 9,968 additions and 3,713 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
664 changes: 482 additions & 182 deletions ChangeLog

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
over to a BSD-style license.

------------------------------------------------------------------------------
Copyright (c) 2002-2010 Atsuhiko Yamanaka, JCraft,Inc.
Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
16 changes: 12 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

Last modified: Wed Nov 1 14:43:31 UTC 2006
Last modified: Thu Mar 18 13:58:16 UTC 2015


Description
Expand Down Expand Up @@ -50,14 +50,21 @@ Features
o J2SE 1.2.2 and later and Bouncycastle's JCE implementation that
can be obtained at http://www.bouncycastle.org/
* SSH2 protocol support.
* Key exchange: diffie-hellman-group-exchange-sha1, diffie-hellman-group1-sha1
* Key exchange: diffie-hellman-group-exchange-sha1,
diffie-hellman-group1-sha1,
diffie-hellman-group14-sha1,
diffie-hellman-group-exchange-sha256,
ecdh-sha2-nistp256,
ecdh-sha2-nistp384,
ecdh-sha2-nistp521
* Cipher: blowfish-cbc,3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc
3des-ctr,aes128-ctr,aes192-ctr,aes256-ctc,
arcfour,arcfour128,arcfour256
* MAC: hmac-md5,hmac-md5-96,hmac-sha1,hmac-sha1-96
* Host key type: ssh-dss, ssh-rsa
* Host key type: ssh-dss,ssh-rsa,
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
* Userauth: password
* Userauth: publickey(DSA,RSA)
* Userauth: publickey(DSA,RSA,ECDSA)
* Userauth: keyboard-interactive
* Userauth: gssapi-with-mic
* X11 forwarding.
Expand All @@ -72,6 +79,7 @@ Features
* envrironment variable passing.
* remote exec.
* generating DSA and RSA key pairs.
* supporting private keys in OpenSSL(traditional SSLeay) and PKCS#8 format.
* SSH File Transfer Protocol(version 0, 1, 2, 3)
* partial authentication
* packet compression: zlib, [email protected]
Expand Down
38 changes: 29 additions & 9 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ sshd server and use port forwarding, X11 forwarding, file transfer, etc., and
you can integrate its functionality into your own Java programs
</description>
<!-- set global properties for this build -->
<property name="version" location="0.1.40"/>
<property name="src" location="src"/>
<property name="version" value="0.1.54"/>
<property name="src" location="src/main/java/"/>
<property name="exasrc" location="examples"/>
<property name="build" location="build"/>
<property name="exabuild" location="examples"/>
<property name="dist" location="dist"/>
<property name="javadoc" location="javadoc"/>
<property name="javac.debug" value="true"/>
<path id="lib.path.ref">
<fileset dir="lib" includes="*.jar"/>
</path>
<path id="project.cp">
<pathelement location="${build}"/>
</path>
Expand All @@ -27,22 +30,39 @@ you can integrate its functionality into your own Java programs
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<available property="jzlib.available"
classname="com.jcraft.jzlib.ZStream"/>
<javac srcdir="${src}" destdir="${build}" debug="${javac.debug}">
classname="com.jcraft.jzlib.ZStream">
<classpath refid="lib.path.ref"/>
</available>
<javac srcdir="${src}"
destdir="${build}"
target="1.4"
source="1.4"
debug="${javac.debug}">
<classpath refid="lib.path.ref"/>
<exclude name="com/jcraft/jsch/jcraft/Compression.java"
unless="jzlib.available"/>
</javac>
</target>
<target name="run" depends="compile">
<java classname="Login" classpathref="project.cp"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>

<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/jsch-${DSTAMP}.jar" basedir="${build}"/>
<!-- Put everything in ${build} into the MyProject-${version}.jar file -->
<jar jarfile="${dist}/lib/jsch-${version}.jar" basedir="${build}">
<!--
<manifest>
<attribute name="Bundle-ClassPath" value="."/>
<attribute name="Bundle-Vendor" value="JCraft, Inc."/>
<attribute name="Bundle-Name" value="com.jcraft.jsch"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-SymbolicName" value="com.jcraft.jsch"/>
<attribute name="Bundle-Version" value="${version}"/>
<attribute name="Export-Package" value='com.jcraft.jsch;version="${version}",com.jcraft.jsch.jce;version="${version}";x-internal:=true,com.jcraft.jsch.jcraft;version="${version}";x-internal:=true,com.jcraft.jsch.jgss;version="${version}";x-internal:=true'/>
<attribute name="Import-Package" value="javax.crypto,javax.crypto.spec,javax.crypto.interfaces,org.ietf.jgss,com.jcraft.jzlib"/>
</manifest>
-->
</jar>
</target>

<target name="examples"
Expand Down
4 changes: 4 additions & 0 deletions examples/AES.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate how to use "aes128-cbc".
*
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
Expand Down
11 changes: 11 additions & 0 deletions examples/ChangePassphrase.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate to change the passphrase for a
* private key file instead of creating a new private key.
* $ CLASSPATH=.:../build javac ChangePassphrase.java
* $ CLASSPATH=.:../build java ChangePassphrase private-key
* A passphrase will be prompted if the given private-key has been
* encrypted. After successfully loading the content of the
* private-key, the new passphrase will be prompted and the given
* private-key will be re-encrypted with that new passphrase.
*
*/
import com.jcraft.jsch.*;
import javax.swing.*;

Expand Down
9 changes: 9 additions & 0 deletions examples/Compression.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate the packet compression.
* $ CLASSPATH=.:../build javac Compression.java
* $ CLASSPATH=.:../build java Compression
* You will be asked username, hostname and passwd.
* If everything works fine, you will get the shell prompt.
* In this program, all data from sshd server to jsch will be compressed.
*
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
Expand Down
5 changes: 5 additions & 0 deletions examples/Daemon.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate how to provide a network service like
* inetd by using remote port-forwarding functionality.
*
*/
import com.jcraft.jsch.*;
import java.io.*;
import java.awt.*;
Expand Down
10 changes: 10 additions & 0 deletions examples/Exec.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate remote exec.
* $ CLASSPATH=.:../build javac Exec.java
* $ CLASSPATH=.:../build java Exec
* You will be asked username, hostname, displayname, passwd and command.
* If everything works fine, given command will be invoked
* on the remote side and outputs will be printed out.
*
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
Expand Down Expand Up @@ -69,6 +78,7 @@ public static void main(String[] arg){
System.out.print(new String(tmp, 0, i));
}
if(channel.isClosed()){
if(in.available()>0) continue;
System.out.println("exit-status: "+channel.getExitStatus());
break;
}
Expand Down
37 changes: 34 additions & 3 deletions examples/KeyGen.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This progam will demonstrate the DSA keypair generation.
* $ CLASSPATH=.:../build javac KeyGen.java
* $ CLASSPATH=.:../build java KeyGen rsa output_keyfile comment
* or
* $ CLASSPATH=.:../build java KeyGen dsa output_keyfile comment
* You will be asked a passphrase for output_keyfile.
* If everything works fine, you will get the DSA or RSA keypair,
* output_keyfile and output_keyfile+".pub".
* The private key and public key are in the OpenSSH format.
*
*/
import com.jcraft.jsch.*;
import javax.swing.*;

class KeyGen{
public static void main(String[] arg){
int key_size = 1024;
if(arg.length<3){
System.err.println(
"usage: java KeyGen rsa output_keyfile comment\n"+
" java KeyGen dsa output_keyfile comment");
" java KeyGen dsa output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-256 output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-384 output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-521 output_keyfile comment");
System.exit(-1);
}
String _type=arg[0];
int type=0;
if(_type.equals("rsa")){type=KeyPair.RSA;}
else if(_type.equals("dsa")){type=KeyPair.DSA;}
else if(_type.equals("ecdsa-sha2-nistp256")){
type=KeyPair.ECDSA;
key_size=256;
}
else if(_type.equals("ecdsa-sha2-nistp384")){
type=KeyPair.ECDSA;
key_size=384;
}
else if(_type.equals("ecdsa-sha2-nistp521")){
type=KeyPair.ECDSA;
key_size=521;
}
else {
System.err.println(
"usage: java KeyGen rsa output_keyfile comment\n"+
" java KeyGen dsa output_keyfile comment");
" java KeyGen dsa output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-256 output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-384 output_keyfile comment\n"+
" java KeyGen ecdsa-sha2-521 output_keyfile comment");
System.exit(-1);
}
String filename=arg[1];
Expand All @@ -36,7 +67,7 @@ public static void main(String[] arg){
}

try{
KeyPair kpair=KeyPair.genKeyPair(jsch, type);
KeyPair kpair=KeyPair.genKeyPair(jsch, type, key_size);
kpair.setPassphrase(passphrase);
kpair.writePrivateKey(filename);
kpair.writePublicKey(filename+".pub", comment);
Expand Down
10 changes: 10 additions & 0 deletions examples/KnownHosts.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate the 'known_hosts' file handling.
* $ CLASSPATH=.:../build javac KnownHosts.java
* $ CLASSPATH=.:../build java KnownHosts
* You will be asked username, hostname, a path for 'known_hosts' and passwd.
* If everything works fine, you will get the shell prompt.
* In current implementation, jsch only reads 'known_hosts' for checking
* and does not modify it.
*
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
Expand Down
4 changes: 4 additions & 0 deletions examples/Logger.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/**
* This program will demonstrate how to enable logging mechanism and
* get logging messages.
*/
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
Expand Down
Loading

0 comments on commit 234fab0

Please sign in to comment.