diff --git a/build.xml b/build.xml
index fa1a194..b549a9c 100644
--- a/build.xml
+++ b/build.xml
@@ -5,7 +5,7 @@ sshd server and use port forwarding, X11 forwarding, file transfer, etc., and
you can integrate its functionality into your own Java programs
-
+
diff --git a/pom.xml b/pom.xml
index d37e93d..3912948 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.jcraft
jsch
jar
- 0.1.53
+ 0.1.53.2
JSch
http://www.jcraft.com/jsch/
JSch is a pure Java implementation of SSH2
@@ -45,6 +45,13 @@
1.0.7
true
+
+
+ org.bouncycastle
+ bcprov-jdk16
+ 1.46
+
+
diff --git a/src/main/java/com/jcraft/jsch/JSch.java b/src/main/java/com/jcraft/jsch/JSch.java
index 031a6e5..65fe63b 100644
--- a/src/main/java/com/jcraft/jsch/JSch.java
+++ b/src/main/java/com/jcraft/jsch/JSch.java
@@ -78,6 +78,7 @@ public class JSch {
config.put("ecdh-sha2-nistp", "com.jcraft.jsch.jce.ECDHN");
+ config.put(com.jcraft.jsch.jce.DH.KEY_BOUNCY_CASTLE_ENABLE, "true");
config.put("dh", "com.jcraft.jsch.jce.DH");
config.put("3des-cbc", "com.jcraft.jsch.jce.TripleDESCBC");
config.put("blowfish-cbc", "com.jcraft.jsch.jce.BlowfishCBC");
diff --git a/src/main/java/com/jcraft/jsch/jce/DH.java b/src/main/java/com/jcraft/jsch/jce/DH.java
index ef1544e..aa7f3c7 100644
--- a/src/main/java/com/jcraft/jsch/jce/DH.java
+++ b/src/main/java/com/jcraft/jsch/jce/DH.java
@@ -29,6 +29,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
package com.jcraft.jsch.jce;
+import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import javax.crypto.KeyAgreement;
@@ -41,6 +42,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
import java.security.PublicKey;
public class DH implements com.jcraft.jsch.DH {
+
+ public static final String KEY_BOUNCY_CASTLE_ENABLE = "dh.bouncycastle.enable";
+
BigInteger p;
BigInteger g;
BigInteger e; // my public key
@@ -53,7 +57,12 @@ public class DH implements com.jcraft.jsch.DH {
private KeyAgreement myKeyAgree;
public void init() throws Exception {
- myKpairGen = KeyPairGenerator.getInstance("DH");
+ if ("TRUE".equalsIgnoreCase(JSch.getConfig(KEY_BOUNCY_CASTLE_ENABLE))) {
+ myKpairGen = new org.bouncycastle.jce.provider.JDKKeyPairGenerator.DH();
+ }
+ else {
+ myKpairGen = KeyPairGenerator.getInstance("DH");
+ }
myKeyAgree = KeyAgreement.getInstance("DH");
}