RFR: 8286032: keytool -list -alias should not assume it is always a certificate

Weijun Wang weijun at openjdk.org
Thu Jan 15 18:25:43 UTC 2026


On Thu, 15 Jan 2026 10:58:10 GMT, Hai-May Chao <hchao at openjdk.org> wrote:

> This fix the warnings of the keytool -list -alias for a secret key that was created with a legacy algorithm.

src/java.base/share/classes/sun/security/tools/keytool/Main.java line 1297:

> 1295: 
> 1296:             if (alias != null) {
> 1297:                 doPrintEntry("<" + alias + ">", alias, out);

`doPrintEntry` is called twice and now the 1st arg is always `"<" + alias + ">"`, how about remove the parameter and add `String label = "<" + alias + ">";` as a local variable inside the method?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29250#discussion_r2695484072


More information about the security-dev mailing list