Skip to content

Commit

Permalink
Merge pull request #290 from norrisjeremy/20230313
Browse files Browse the repository at this point in the history
0.2.8 changes
  • Loading branch information
mwiede authored Mar 21, 2023
2 parents 1ed3540 + 7623c8e commit 137dbde
Show file tree
Hide file tree
Showing 38 changed files with 792 additions and 920 deletions.
162 changes: 0 additions & 162 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

6 changes: 3 additions & 3 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [0.2.8](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.8)
* [#287](https://github.com/mwiede/jsch/issues/287) add algorithm type information to algorithm negotiation logs.
* [#289](https://github.com/mwiede/jsch/issues/289) wrap NoClassDefFoundError's for invalid private keys.
* [0.2.7](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.7)
* Fix exception logging in Log4j2Logger.
* [#265](https://github.com/mwiede/jsch/issues/265) change buffer_margin computation to be dynamic based upon the MAC to allow connections that advertise small maximum packet sizes.
Expand Down
9 changes: 8 additions & 1 deletion examples/AES.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ public static void main(String[] arg) {
}

public static class MyUserInfo implements UserInfo, UIKeyboardInteractive {
@Override
public String getPassword() {
return passwd;
}

@Override
public boolean promptYesNo(String str) {
Object[] options = {"yes", "no"};
int foo = JOptionPane.showOptionDialog(null, str, "Warning", JOptionPane.DEFAULT_OPTION,
Expand All @@ -61,16 +63,19 @@ public boolean promptYesNo(String str) {
}

String passwd;
JTextField passwordField = (JTextField) new JPasswordField(20);
JTextField passwordField = new JPasswordField(20);

@Override
public String getPassphrase() {
return null;
}

@Override
public boolean promptPassphrase(String message) {
return true;
}

@Override
public boolean promptPassword(String message) {
Object[] ob = {passwordField};
int result = JOptionPane.showConfirmDialog(null, ob, message, JOptionPane.OK_CANCEL_OPTION);
Expand All @@ -82,6 +87,7 @@ public boolean promptPassword(String message) {
}
}

@Override
public void showMessage(String message) {
JOptionPane.showMessageDialog(null, message);
}
Expand All @@ -90,6 +96,7 @@ public void showMessage(String message) {
GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
private Container panel;

@Override
public String[] promptKeyboardInteractive(String destination, String name, String instruction,
String[] prompt, boolean[] echo) {
panel = new JPanel();
Expand Down
16 changes: 7 additions & 9 deletions examples/ChangePassphrase.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/**
* 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.
* a new 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.*;

class ChangePassphrase {
public class ChangePassphrase {
public static void main(String[] arg) {
if (arg.length != 1) {
System.err.println("usage: java ChangePassphrase private_key");
Expand All @@ -28,7 +27,7 @@ public static void main(String[] arg) {

String passphrase = "";
while (kpair.isEncrypted()) {
JTextField passphraseField = (JTextField) new JPasswordField(20);
JTextField passphraseField = new JPasswordField(20);
Object[] ob = {passphraseField};
int result = JOptionPane.showConfirmDialog(null, ob, "Enter passphrase for " + pkey,
JOptionPane.OK_CANCEL_OPTION);
Expand All @@ -45,7 +44,7 @@ public static void main(String[] arg) {

passphrase = "";

JTextField passphraseField = (JTextField) new JPasswordField(20);
JTextField passphraseField = new JPasswordField(20);
Object[] ob = {passphraseField};
int result = JOptionPane.showConfirmDialog(null, ob,
"Enter new passphrase for " + pkey + " (empty for no passphrase)",
Expand All @@ -55,8 +54,7 @@ public static void main(String[] arg) {
}
passphrase = passphraseField.getText();

kpair.setPassphrase(passphrase);
kpair.writePrivateKey(pkey);
kpair.writePrivateKey(pkey, passphrase.getBytes());
kpair.dispose();
} catch (Exception e) {
System.out.println(e);
Expand Down
12 changes: 9 additions & 3 deletions examples/Compression.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* This program will demonstrate the packet compression. $ CLASSPATH=.:../build javac
* Compression.java $ CLASSPATH=.:../build java Compression You will be asked username, hostname and
* This program will demonstrate the packet 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.
*
Expand Down Expand Up @@ -49,10 +48,12 @@ public static void main(String[] arg) {
}

public static class MyUserInfo implements UserInfo, UIKeyboardInteractive {
@Override
public String getPassword() {
return passwd;
}

@Override
public boolean promptYesNo(String str) {
Object[] options = {"yes", "no"};
int foo = JOptionPane.showOptionDialog(null, str, "Warning", JOptionPane.DEFAULT_OPTION,
Expand All @@ -61,16 +62,19 @@ public boolean promptYesNo(String str) {
}

String passwd;
JTextField passwordField = (JTextField) new JPasswordField(20);
JTextField passwordField = new JPasswordField(20);

@Override
public String getPassphrase() {
return null;
}

@Override
public boolean promptPassphrase(String message) {
return true;
}

@Override
public boolean promptPassword(String message) {
Object[] ob = {passwordField};
int result = JOptionPane.showConfirmDialog(null, ob, message, JOptionPane.OK_CANCEL_OPTION);
Expand All @@ -82,6 +86,7 @@ public boolean promptPassword(String message) {
}
}

@Override
public void showMessage(String message) {
JOptionPane.showMessageDialog(null, message);
}
Expand All @@ -90,6 +95,7 @@ public void showMessage(String message) {
GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
private Container panel;

@Override
public String[] promptKeyboardInteractive(String destination, String name, String instruction,
String[] prompt, boolean[] echo) {
panel = new JPanel();
Expand Down
Loading

0 comments on commit 137dbde

Please sign in to comment.