Class X25519KeyFactory

  • All Implemented Interfaces:
    Runnable, KeyFactory

    public class X25519KeyFactory
    extends I2PThread
    implements KeyFactory
    Try to keep DH pairs at the ready. It's important to do this in a separate thread, because if we run out, the pairs are generated in the NTCP Pumper thread, and it can fall behind.
    Since:
    0.9.36 from DHSessionKeyFactory.PrecalcRunner
    • Constructor Detail

      • X25519KeyFactory

        public X25519KeyFactory​(I2PAppContext ctx)
    • Method Detail

      • shutdown

        public void shutdown()
        Note that this stops the singleton precalc thread. You don't want to do this if there are multiple routers in the JVM. Fix this if you care. See Router.shutdown().
      • getKeys

        public KeyPair getKeys()
        Pulls a prebuilt keypair from the queue, or if not available, construct a new one.
        Specified by:
        getKeys in interface KeyFactory
      • returnUnused

        public void returnUnused​(KeyPair kp)
        Return an unused DH key builder to be put back onto the queue for reuse.