diff --git a/core/java/src/net/i2p/crypto/Blinding.java b/core/java/src/net/i2p/crypto/Blinding.java index 3cc7af0479f39ee8c0cc5666ce18eecabcb424c0..584a35163ec5870a0c58e77e802828ec858000f1 100644 --- a/core/java/src/net/i2p/crypto/Blinding.java +++ b/core/java/src/net/i2p/crypto/Blinding.java @@ -148,9 +148,10 @@ public final class Blinding { byte[] mod = DataHelper.getASCII(modVal); byte[] data; if (secret != null && secret.length() > 0) { - data = new byte[LENGTH + secret.length()]; + byte[] sb = DataHelper.getUTF8(secret); + data = new byte[LENGTH + sb.length]; System.arraycopy(mod, 0, data, 0, LENGTH); - System.arraycopy(DataHelper.getASCII(secret), 0, data, LENGTH, secret.length()); + System.arraycopy(sb, 0, data, LENGTH, sb.length); } else { data = mod; } @@ -166,6 +167,12 @@ public final class Blinding { Hash salt = ctx.sha().calculateHash(in); hkdf.calculate(salt.getData(), data, INFO, out, out, 32); byte[] b = EdDSABlinding.reduce(out); + //net.i2p.util.Log log = ctx.logManager().getLog(Blinding.class); + //log.debug("Input to salt sha256:\n" + net.i2p.util.HexDump.dump(in)); + //log.debug("salt:\n" + net.i2p.util.HexDump.dump(salt.getData())); + //log.debug("data:\n" + net.i2p.util.HexDump.dump(data)); + //log.debug("hkdf output (seed):\n" + net.i2p.util.HexDump.dump(out)); + //log.debug("alpha (seed mod l):\n" + net.i2p.util.HexDump.dump(b)); return new SigningPrivateKey(TYPER, b); } diff --git a/core/java/src/net/i2p/crypto/eddsa/EdDSABlinding.java b/core/java/src/net/i2p/crypto/eddsa/EdDSABlinding.java index 1438b7037855b87d5eb8feeb6bbec340c650a50c..0835ca4a158dcb995f821429f9b7796f5ced6d2c 100644 --- a/core/java/src/net/i2p/crypto/eddsa/EdDSABlinding.java +++ b/core/java/src/net/i2p/crypto/eddsa/EdDSABlinding.java @@ -94,7 +94,7 @@ public final class EdDSABlinding { */ public static byte[] reduce(byte[] b) { if (b.length != 64) - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Must be 64 bytes"); ScalarOps sc = new BigIntegerScalarOps(FIELD, ORDER); return sc.reduce(b); }