forked from I2P_Developers/i2p.i2p
SigUtil: Catch EdDSA IAE
SU3File: Hide EdDSA and unavailable sig types from help text
This commit is contained in:
@@ -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");
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user