Changeset 30dbe24 for core


Ignore:
Timestamp:
Mar 10, 2019 12:11:13 PM (15 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
365f5a8
Parents:
e36a3b3
Message:

LS2: Allow UTF-8 for blinding secret

Location:
core/java/src/net/i2p/crypto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/crypto/Blinding.java

    re36a3b3 r30dbe24  
    149149        byte[] data;
    150150        if (secret != null && secret.length() > 0) {
    151             data = new byte[LENGTH + secret.length()];
     151            byte[] sb = DataHelper.getUTF8(secret);
     152            data = new byte[LENGTH + sb.length];
    152153            System.arraycopy(mod, 0, data, 0, LENGTH);
    153             System.arraycopy(DataHelper.getASCII(secret), 0, data, LENGTH, secret.length());
     154            System.arraycopy(sb, 0, data, LENGTH, sb.length);
    154155        } else {
    155156            data = mod;
     
    167168        hkdf.calculate(salt.getData(), data, INFO, out, out, 32);
    168169        byte[] b = EdDSABlinding.reduce(out);
     170        //net.i2p.util.Log log = ctx.logManager().getLog(Blinding.class);
     171        //log.debug("Input to salt sha256:\n" + net.i2p.util.HexDump.dump(in));
     172        //log.debug("salt:\n" + net.i2p.util.HexDump.dump(salt.getData()));
     173        //log.debug("data:\n" + net.i2p.util.HexDump.dump(data));
     174        //log.debug("hkdf output (seed):\n" + net.i2p.util.HexDump.dump(out));
     175        //log.debug("alpha (seed mod l):\n" + net.i2p.util.HexDump.dump(b));
    169176        return new SigningPrivateKey(TYPER, b);
    170177    }
  • core/java/src/net/i2p/crypto/eddsa/EdDSABlinding.java

    re36a3b3 r30dbe24  
    9595    public static byte[] reduce(byte[] b) {
    9696        if (b.length != 64)
    97             throw new IllegalArgumentException();
     97            throw new IllegalArgumentException("Must be 64 bytes");
    9898        ScalarOps sc = new BigIntegerScalarOps(FIELD, ORDER);
    9999        return sc.reduce(b);
Note: See TracChangeset for help on using the changeset viewer.