Add DH-based key exchange algorithms in SftpService and SshService to ensure compatibility with Java 8 minimal JRE

This commit is contained in:
liumangmang
2026-02-04 12:03:29 +08:00
parent a67562bfea
commit ea38d1c026
2 changed files with 4 additions and 0 deletions

View File

@@ -28,6 +28,8 @@ public class SshService {
Session session = jsch.getSession(conn.getUsername(), conn.getHost(), conn.getPort());
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) {
session.setPassword(password);