Add DH-based key exchange algorithms in SftpService and SshService to ensure compatibility with Java 8 minimal JRE
This commit is contained in:
@@ -38,6 +38,8 @@ public class SftpService {
|
|||||||
|
|
||||||
Session session = jsch.getSession(conn.getUsername(), conn.getHost(), conn.getPort());
|
Session session = jsch.getSession(conn.getUsername(), conn.getHost(), conn.getPort());
|
||||||
session.setConfig("StrictHostKeyChecking", "no");
|
session.setConfig("StrictHostKeyChecking", "no");
|
||||||
|
// Use only DH-based kex to avoid "Algorithm ECDH not available" on Java 8 / minimal JRE
|
||||||
|
session.setConfig("kex", "diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1");
|
||||||
if (conn.getAuthType() == Connection.AuthType.PASSWORD && password != null) {
|
if (conn.getAuthType() == Connection.AuthType.PASSWORD && password != null) {
|
||||||
session.setPassword(password);
|
session.setPassword(password);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class SshService {
|
|||||||
|
|
||||||
Session session = jsch.getSession(conn.getUsername(), conn.getHost(), conn.getPort());
|
Session session = jsch.getSession(conn.getUsername(), conn.getHost(), conn.getPort());
|
||||||
session.setConfig("StrictHostKeyChecking", "no");
|
session.setConfig("StrictHostKeyChecking", "no");
|
||||||
|
// Use only DH-based kex to avoid "Algorithm ECDH not available" on Java 8 / minimal JRE
|
||||||
|
session.setConfig("kex", "diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1");
|
||||||
|
|
||||||
if (conn.getAuthType() == Connection.AuthType.PASSWORD && password != null) {
|
if (conn.getAuthType() == Connection.AuthType.PASSWORD && password != null) {
|
||||||
session.setPassword(password);
|
session.setPassword(password);
|
||||||
|
|||||||
Reference in New Issue
Block a user