From 7755860274106826f0ca769fe221ed1ae9c30fcd Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 2 May 2025 07:36:14 -0400 Subject: [PATCH] CLI: Show deprecated types in privatekeyfile and su3file help --- core/java/src/net/i2p/crypto/SU3File.java | 5 ++++- core/java/src/net/i2p/data/PrivateKeyFile.java | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/java/src/net/i2p/crypto/SU3File.java b/core/java/src/net/i2p/crypto/SU3File.java index 0add1a48d..21e396129 100644 --- a/core/java/src/net/i2p/crypto/SU3File.java +++ b/core/java/src/net/i2p/crypto/SU3File.java @@ -714,8 +714,11 @@ public class SU3File { t == SigType.RedDSA_SHA512_Ed25519) continue; // not supported by keytool, and does double hashing right now buf.append(" ").append(t).append("\t(code: ").append(t.getCode()).append(')'); - if (t.getCode() == DEFAULT_SIG_CODE) + int code = t.getCode(); + if (code == DEFAULT_SIG_CODE) buf.append(" DEFAULT"); + else if (code < DEFAULT_SIG_CODE) + buf.append(" DEPRECATED"); buf.append('\n'); } } diff --git a/core/java/src/net/i2p/data/PrivateKeyFile.java b/core/java/src/net/i2p/data/PrivateKeyFile.java index a03cca1eb..0446445b0 100644 --- a/core/java/src/net/i2p/data/PrivateKeyFile.java +++ b/core/java/src/net/i2p/data/PrivateKeyFile.java @@ -453,11 +453,14 @@ public class PrivateKeyFile { continue; if (t.getBaseAlgorithm().equals(SigAlgo.RSA)) continue; - if (t.getCode() == 8) + int code = t.getCode(); + if (code == 8) continue; buf.append(" ").append(t).append("\t(code: ").append(t.getCode()).append(')'); - if (t.getCode() == 0) + if (code == 0) buf.append(" DEFAULT"); + if (code < 7) + buf.append(" DEPRECATED"); buf.append('\n'); } buf.append("\nAvailable encryption types:\n"); @@ -465,8 +468,11 @@ public class PrivateKeyFile { if (!t.isAvailable()) continue; buf.append(" ").append(t).append("\t(code: ").append(t.getCode()).append(')'); - if (t.getCode() == 0) + int code = t.getCode(); + if (code == 0) buf.append(" DEFAULT"); + if (code < 4) + buf.append(" DEPRECATED"); buf.append('\n'); } System.out.println(buf.toString());