Changeset a6434fb


Ignore:
Timestamp:
May 22, 2019 11:02:12 AM (11 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
62649a6
Parents:
a8f11d1
Message:

NTCP2: Use KeyGenerator? for X25519 keys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/crypto/X25519KeyFactory.java

    ra8f11d1 ra6434fb  
    22
    33import java.util.concurrent.LinkedBlockingQueue;
    4 
    5 import com.southernstorm.noise.crypto.x25519.Curve25519;
    64
    75import net.i2p.I2PAppContext;
     
    140138    private KeyPair precalc() {
    141139        long start = System.currentTimeMillis();
    142         byte[] priv = new byte[32];
    143         do {
    144             _context.random().nextBytes(priv);
    145             // little endian, loop if too small
    146             // worth doing?
    147         } while (priv[31] == 0);
    148         byte[] pub = new byte[32];
    149         Curve25519.eval(pub, 0, priv, null);
    150         KeyPair rv = new KeyPair(new PublicKey(EncType.ECIES_X25519, pub), new PrivateKey(EncType.ECIES_X25519, priv));
     140        KeyPair rv = _context.keyGenerator().generatePKIKeys(EncType.ECIES_X25519);
    151141        long end = System.currentTimeMillis();
    152142        long diff = end - start;
Note: See TracChangeset for help on using the changeset viewer.