Skip to content

Commit 234fab0

Browse files
weiqiu.ljis
weiqiu.lj
authored andcommitted
sync to 0.1.54
1 parent b2ac6d9 commit 234fab0

File tree

173 files changed

+9968
-3713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+9968
-3713
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

ChangeLog

Lines changed: 482 additions & 182 deletions
Large diffs are not rendered by default.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ JSch 0.0.* was released under the GNU LGPL license. Later, we have switched
22
over to a BSD-style license.
33

44
------------------------------------------------------------------------------
5-
Copyright (c) 2002-2010 Atsuhiko Yamanaka, JCraft,Inc.
5+
Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc.
66
All rights reserved.
77

88
Redistribution and use in source and binary forms, with or without

README

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

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

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

1111

1212
Description
@@ -50,14 +50,21 @@ Features
5050
o J2SE 1.2.2 and later and Bouncycastle's JCE implementation that
5151
can be obtained at http://www.bouncycastle.org/
5252
* SSH2 protocol support.
53-
* Key exchange: diffie-hellman-group-exchange-sha1, diffie-hellman-group1-sha1
53+
* Key exchange: diffie-hellman-group-exchange-sha1,
54+
diffie-hellman-group1-sha1,
55+
diffie-hellman-group14-sha1,
56+
diffie-hellman-group-exchange-sha256,
57+
ecdh-sha2-nistp256,
58+
ecdh-sha2-nistp384,
59+
ecdh-sha2-nistp521
5460
* Cipher: blowfish-cbc,3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc
5561
3des-ctr,aes128-ctr,aes192-ctr,aes256-ctc,
5662
arcfour,arcfour128,arcfour256
5763
* MAC: hmac-md5,hmac-md5-96,hmac-sha1,hmac-sha1-96
58-
* Host key type: ssh-dss, ssh-rsa
64+
* Host key type: ssh-dss,ssh-rsa,
65+
ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
5966
* Userauth: password
60-
* Userauth: publickey(DSA,RSA)
67+
* Userauth: publickey(DSA,RSA,ECDSA)
6168
* Userauth: keyboard-interactive
6269
* Userauth: gssapi-with-mic
6370
* X11 forwarding.
@@ -72,6 +79,7 @@ Features
7279
* envrironment variable passing.
7380
* remote exec.
7481
* generating DSA and RSA key pairs.
82+
* supporting private keys in OpenSSL(traditional SSLeay) and PKCS#8 format.
7583
* SSH File Transfer Protocol(version 0, 1, 2, 3)
7684
* partial authentication
7785
* packet compression: zlib, [email protected]

build.xml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ sshd server and use port forwarding, X11 forwarding, file transfer, etc., and
55
you can integrate its functionality into your own Java programs
66
</description>
77
<!-- set global properties for this build -->
8-
<property name="version" location="0.1.40"/>
9-
<property name="src" location="src"/>
8+
<property name="version" value="0.1.54"/>
9+
<property name="src" location="src/main/java/"/>
1010
<property name="exasrc" location="examples"/>
1111
<property name="build" location="build"/>
1212
<property name="exabuild" location="examples"/>
1313
<property name="dist" location="dist"/>
1414
<property name="javadoc" location="javadoc"/>
1515
<property name="javac.debug" value="true"/>
16+
<path id="lib.path.ref">
17+
<fileset dir="lib" includes="*.jar"/>
18+
</path>
1619
<path id="project.cp">
1720
<pathelement location="${build}"/>
1821
</path>
@@ -27,22 +30,39 @@ you can integrate its functionality into your own Java programs
2730
description="compile the source " >
2831
<!-- Compile the java code from ${src} into ${build} -->
2932
<available property="jzlib.available"
30-
classname="com.jcraft.jzlib.ZStream"/>
31-
<javac srcdir="${src}" destdir="${build}" debug="${javac.debug}">
33+
classname="com.jcraft.jzlib.ZStream">
34+
<classpath refid="lib.path.ref"/>
35+
</available>
36+
<javac srcdir="${src}"
37+
destdir="${build}"
38+
target="1.4"
39+
source="1.4"
40+
debug="${javac.debug}">
41+
<classpath refid="lib.path.ref"/>
3242
<exclude name="com/jcraft/jsch/jcraft/Compression.java"
3343
unless="jzlib.available"/>
3444
</javac>
3545
</target>
36-
<target name="run" depends="compile">
37-
<java classname="Login" classpathref="project.cp"/>
38-
</target>
3946
<target name="dist" depends="compile"
4047
description="generate the distribution" >
4148
<!-- Create the distribution directory -->
4249
<mkdir dir="${dist}/lib"/>
4350

44-
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
45-
<jar jarfile="${dist}/lib/jsch-${DSTAMP}.jar" basedir="${build}"/>
51+
<!-- Put everything in ${build} into the MyProject-${version}.jar file -->
52+
<jar jarfile="${dist}/lib/jsch-${version}.jar" basedir="${build}">
53+
<!--
54+
<manifest>
55+
<attribute name="Bundle-ClassPath" value="."/>
56+
<attribute name="Bundle-Vendor" value="JCraft, Inc."/>
57+
<attribute name="Bundle-Name" value="com.jcraft.jsch"/>
58+
<attribute name="Bundle-ManifestVersion" value="2"/>
59+
<attribute name="Bundle-SymbolicName" value="com.jcraft.jsch"/>
60+
<attribute name="Bundle-Version" value="${version}"/>
61+
<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'/>
62+
<attribute name="Import-Package" value="javax.crypto,javax.crypto.spec,javax.crypto.interfaces,org.ietf.jgss,com.jcraft.jzlib"/>
63+
</manifest>
64+
-->
65+
</jar>
4666
</target>
4767

4868
<target name="examples"

examples/AES.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate how to use "aes128-cbc".
4+
*
5+
*/
26
import com.jcraft.jsch.*;
37
import java.awt.*;
48
import javax.swing.*;

examples/ChangePassphrase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate to change the passphrase for a
4+
* private key file instead of creating a new private key.
5+
* $ CLASSPATH=.:../build javac ChangePassphrase.java
6+
* $ CLASSPATH=.:../build java ChangePassphrase private-key
7+
* A passphrase will be prompted if the given private-key has been
8+
* encrypted. After successfully loading the content of the
9+
* private-key, the new passphrase will be prompted and the given
10+
* private-key will be re-encrypted with that new passphrase.
11+
*
12+
*/
213
import com.jcraft.jsch.*;
314
import javax.swing.*;
415

examples/Compression.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate the packet compression.
4+
* $ CLASSPATH=.:../build javac Compression.java
5+
* $ CLASSPATH=.:../build java Compression
6+
* You will be asked username, hostname and passwd.
7+
* If everything works fine, you will get the shell prompt.
8+
* In this program, all data from sshd server to jsch will be compressed.
9+
*
10+
*/
211
import com.jcraft.jsch.*;
312
import java.awt.*;
413
import javax.swing.*;

examples/Daemon.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate how to provide a network service like
4+
* inetd by using remote port-forwarding functionality.
5+
*
6+
*/
27
import com.jcraft.jsch.*;
38
import java.io.*;
49
import java.awt.*;

examples/Exec.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate remote exec.
4+
* $ CLASSPATH=.:../build javac Exec.java
5+
* $ CLASSPATH=.:../build java Exec
6+
* You will be asked username, hostname, displayname, passwd and command.
7+
* If everything works fine, given command will be invoked
8+
* on the remote side and outputs will be printed out.
9+
*
10+
*/
211
import com.jcraft.jsch.*;
312
import java.awt.*;
413
import javax.swing.*;
@@ -69,6 +78,7 @@ public static void main(String[] arg){
6978
System.out.print(new String(tmp, 0, i));
7079
}
7180
if(channel.isClosed()){
81+
if(in.available()>0) continue;
7282
System.out.println("exit-status: "+channel.getExitStatus());
7383
break;
7484
}

examples/KeyGen.java

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This progam will demonstrate the DSA keypair generation.
4+
* $ CLASSPATH=.:../build javac KeyGen.java
5+
* $ CLASSPATH=.:../build java KeyGen rsa output_keyfile comment
6+
* or
7+
* $ CLASSPATH=.:../build java KeyGen dsa output_keyfile comment
8+
* You will be asked a passphrase for output_keyfile.
9+
* If everything works fine, you will get the DSA or RSA keypair,
10+
* output_keyfile and output_keyfile+".pub".
11+
* The private key and public key are in the OpenSSH format.
12+
*
13+
*/
214
import com.jcraft.jsch.*;
315
import javax.swing.*;
416

517
class KeyGen{
618
public static void main(String[] arg){
19+
int key_size = 1024;
720
if(arg.length<3){
821
System.err.println(
922
"usage: java KeyGen rsa output_keyfile comment\n"+
10-
" java KeyGen dsa output_keyfile comment");
23+
" java KeyGen dsa output_keyfile comment\n"+
24+
" java KeyGen ecdsa-sha2-256 output_keyfile comment\n"+
25+
" java KeyGen ecdsa-sha2-384 output_keyfile comment\n"+
26+
" java KeyGen ecdsa-sha2-521 output_keyfile comment");
1127
System.exit(-1);
1228
}
1329
String _type=arg[0];
1430
int type=0;
1531
if(_type.equals("rsa")){type=KeyPair.RSA;}
1632
else if(_type.equals("dsa")){type=KeyPair.DSA;}
33+
else if(_type.equals("ecdsa-sha2-nistp256")){
34+
type=KeyPair.ECDSA;
35+
key_size=256;
36+
}
37+
else if(_type.equals("ecdsa-sha2-nistp384")){
38+
type=KeyPair.ECDSA;
39+
key_size=384;
40+
}
41+
else if(_type.equals("ecdsa-sha2-nistp521")){
42+
type=KeyPair.ECDSA;
43+
key_size=521;
44+
}
1745
else {
1846
System.err.println(
1947
"usage: java KeyGen rsa output_keyfile comment\n"+
20-
" java KeyGen dsa output_keyfile comment");
48+
" java KeyGen dsa output_keyfile comment\n"+
49+
" java KeyGen ecdsa-sha2-256 output_keyfile comment\n"+
50+
" java KeyGen ecdsa-sha2-384 output_keyfile comment\n"+
51+
" java KeyGen ecdsa-sha2-521 output_keyfile comment");
2152
System.exit(-1);
2253
}
2354
String filename=arg[1];
@@ -36,7 +67,7 @@ public static void main(String[] arg){
3667
}
3768

3869
try{
39-
KeyPair kpair=KeyPair.genKeyPair(jsch, type);
70+
KeyPair kpair=KeyPair.genKeyPair(jsch, type, key_size);
4071
kpair.setPassphrase(passphrase);
4172
kpair.writePrivateKey(filename);
4273
kpair.writePublicKey(filename+".pub", comment);

examples/KnownHosts.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate the 'known_hosts' file handling.
4+
* $ CLASSPATH=.:../build javac KnownHosts.java
5+
* $ CLASSPATH=.:../build java KnownHosts
6+
* You will be asked username, hostname, a path for 'known_hosts' and passwd.
7+
* If everything works fine, you will get the shell prompt.
8+
* In current implementation, jsch only reads 'known_hosts' for checking
9+
* and does not modify it.
10+
*
11+
*/
212
import com.jcraft.jsch.*;
313
import java.awt.*;
414
import javax.swing.*;

examples/Logger.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
2+
/**
3+
* This program will demonstrate how to enable logging mechanism and
4+
* get logging messages.
5+
*/
26
import com.jcraft.jsch.*;
37
import java.awt.*;
48
import javax.swing.*;

0 commit comments

Comments
 (0)