diff --git a/core/java/src/net/i2p/crypto/SU3File.java b/core/java/src/net/i2p/crypto/SU3File.java index b401c8f28..6647c8d45 100644 --- a/core/java/src/net/i2p/crypto/SU3File.java +++ b/core/java/src/net/i2p/crypto/SU3File.java @@ -515,6 +515,10 @@ public class SU3File { StringBuilder buf = new StringBuilder(256); buf.append("Available signature types:\n"); for (SigType t : EnumSet.allOf(SigType.class)) { + if (!t.isAvailable()) + continue; + if (t == SigType.EdDSA_SHA512_25519) + 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) buf.append(" DEFAULT"); diff --git a/core/java/src/net/i2p/crypto/SigUtil.java b/core/java/src/net/i2p/crypto/SigUtil.java index 3d423c662..cbf330ccb 100644 --- a/core/java/src/net/i2p/crypto/SigUtil.java +++ b/core/java/src/net/i2p/crypto/SigUtil.java @@ -248,14 +248,22 @@ public class SigUtil { private static EdDSAPublicKey cvtToJavaEdDSAKey(SigningPublicKey pk) throws GeneralSecurityException { - return new EdDSAPublicKey(new EdDSAPublicKeySpec( + try { + return new EdDSAPublicKey(new EdDSAPublicKeySpec( pk.getData(), (EdDSAParameterSpec) pk.getType().getParams())); + } catch (IllegalArgumentException iae) { + throw new InvalidKeyException(iae); + } } private static EdDSAPrivateKey cvtToJavaEdDSAKey(SigningPrivateKey pk) throws GeneralSecurityException { - return new EdDSAPrivateKey(new EdDSAPrivateKeySpec( + try { + return new EdDSAPrivateKey(new EdDSAPrivateKeySpec( pk.getData(), (EdDSAParameterSpec) pk.getType().getParams())); + } catch (IllegalArgumentException iae) { + throw new InvalidKeyException(iae); + } } public static SigningPublicKey fromJavaKey(EdDSAPublicKey pk, SigType type)