Package net.i2p.router.crypto.pqc
Class MLKEMKeyFactory
java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.router.crypto.pqc.MLKEMKeyFactory
- All Implemented Interfaces:
Runnable,KeyFactory
Try to keep key pairs at the ready.
It's important to do this in a separate thread, because if we run out,
the pairs are generated other threads,
and it can fall behind.
Started by ECIESAEADEngine. One type per-thread. Only used for 768, for now.
- Since:
- 0.9.68 adapted from X25519KeyFactory
-
Nested Class Summary
Nested classes/interfaces inherited from class net.i2p.util.I2PThread
I2PThread.OOMEventListenerNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetKeys()Pulls a prebuilt keypair from the queue, or if not available, construct a new one.voidreturnUnused(KeyPair kp) Return an unused key pair to be put back onto the queue for reuse.voidrun()voidshutdown()Note that this stops the singleton precalc thread.Methods inherited from class net.i2p.util.I2PThread
addOOMEventListener, fireOOM, removeOOMEventListener, startMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
MLKEMKeyFactory
Alice side only- Parameters:
type- must be one of the internal types MLKEM*_INT
-
-
Method Details
-
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(). -
run
public void run() -
getKeys
Pulls a prebuilt keypair from the queue, or if not available, construct a new one.- Specified by:
getKeysin interfaceKeyFactory
-
returnUnused
Return an unused key pair to be put back onto the queue for reuse.
-