RFR: 8295803: Console should be usable in jshell and other environments [v2]

Naoto Sato naoto at openjdk.org
Fri Dec 2 22:03:02 UTC 2022


On Fri, 2 Dec 2022 15:21:40 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Naoto has confirmed that the password prompt from keytool does not echo, good!
>> 
>> The intention is that Console be usable in jshell so I think the issue is that readPassword is echo'ing when used in jshell. Maybe someone experimenting with the Console API might run into this but we can separate out that issue.
>
> Still not sure what the expected behavior is, but for keytool, because of the updated check, `sun.security.util.Password` now uses `System.in.read` instead of `Console.readPassword`, therefore the password is echoing. I tried removing the check and force `Console.readPassword` to be called. There is no echo but the return key also does not work. I have to Ctrl-C to break out.

I thought that in `jshell`, `System.console()` returns null, so it is always not using `Console.readPassword`. Anyway, I think the scenario is not practical (changing password using jshell), and in the future, jshell can provide its own Console implementation (that's a part of this enhancement's motivation) that would nicely handle this situation.

-------------

PR: https://git.openjdk.org/jdk/pull/11421


More information about the security-dev mailing list