--- apache-sshd-2.12.0/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java 2024-10-17 09:52:06.441674383 +0200 +++ apache-sshd-2.12.0/sshd-cli/src/main/java/org/apache/sshd/cli/client/SshClientCliSupport.java 2024-10-17 11:13:10.836164379 +0200 @@ -19,6 +19,7 @@ package org.apache.sshd.cli.client; import java.io.BufferedReader; +import java.io.Console; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; @@ -492,6 +493,11 @@ throws Throwable { client.setFilePasswordProvider((session, file, index) -> { stdout.print("Enter password for private key file=" + file + ": "); + + Console cons = System.console(); + if (cons != null) { + return new String(cons.readPassword()); + } return stdin.readLine(); }); @@ -552,6 +558,10 @@ public String getUpdatedPassword(ClientSession clientSession, String prompt, String lang) { stdout.append(prompt).print(" "); try { + Console cons = System.console(); + if (cons != null) { + return new String(cons.readPassword()); + } return stdin.readLine(); } catch (IOException e) { stderr.append("WARNING: ").append(e.getClass().getSimpleName())